From 41bbbfc7541e080f24ffb80aba5adf6e7fded7fd Mon Sep 17 00:00:00 2001 From: zouxxyy Date: Wed, 18 Sep 2024 13:03:20 +0800 Subject: [PATCH] 1 --- .../src/main/java/org/apache/paimon/utils/Projection.java | 7 +++++-- .../org/apache/paimon/spark/sql/PaimonQueryTest.scala | 1 + 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/paimon-common/src/main/java/org/apache/paimon/utils/Projection.java b/paimon-common/src/main/java/org/apache/paimon/utils/Projection.java index baf06bf3b634..11c0b6ce4b84 100644 --- a/paimon-common/src/main/java/org/apache/paimon/utils/Projection.java +++ b/paimon-common/src/main/java/org/apache/paimon/utils/Projection.java @@ -310,8 +310,11 @@ public Projection complement(int fieldsNumber) { @Override public int[] toTopLevelIndexes() { - // todo: fix it usage - return Arrays.stream(projection).mapToInt(arr -> arr[0]).toArray(); + return Arrays.stream(projection) + .map(arr -> arr[0]) + .distinct() + .mapToInt(Integer::intValue) + .toArray(); } @Override diff --git a/paimon-spark/paimon-spark-common/src/test/scala/org/apache/paimon/spark/sql/PaimonQueryTest.scala b/paimon-spark/paimon-spark-common/src/test/scala/org/apache/paimon/spark/sql/PaimonQueryTest.scala index d1169378bcbc..4f5e17fd16f8 100644 --- a/paimon-spark/paimon-spark-common/src/test/scala/org/apache/paimon/spark/sql/PaimonQueryTest.scala +++ b/paimon-spark/paimon-spark-common/src/test/scala/org/apache/paimon/spark/sql/PaimonQueryTest.scala @@ -194,6 +194,7 @@ class PaimonQueryTest extends PaimonSparkTestBase { sql(""" |SELECT + | course.grade, | name, | course.course_name |FROM