You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hudi.apache.org by "alexeykudinkin (via GitHub)" <gi...@apache.org> on 2023/02/13 19:27:26 UTC

[GitHub] [hudi] alexeykudinkin commented on a diff in pull request #7672: [HUDI-5557]Avoid converting columns that are not indexed in CSI

alexeykudinkin commented on code in PR #7672:
URL: https://github.com/apache/hudi/pull/7672#discussion_r1104911822


##########
hudi-spark-datasource/hudi-spark-common/src/main/scala/org/apache/hudi/ColumnStatsIndexSupport.scala:
##########
@@ -209,11 +209,11 @@ class ColumnStatsIndexSupport(spark: SparkSession,
     // NOTE: We're sorting the columns to make sure final index schema matches layout
     //       of the transposed table
     val sortedTargetColumnsSet = TreeSet(queryColumns:_*)
-    val sortedTargetColumns = sortedTargetColumnsSet.toSeq
 
     // NOTE: This is a trick to avoid pulling all of [[ColumnStatsIndexSupport]] object into the lambdas'
     //       closures below
     val indexedColumns = this.indexedColumns
+    val sortedTargetColumns = sortedTargetColumnsSet.filter(indexedColumns.contains(_)).toSeq

Review Comment:
   Let's rename this to be `indexedTargetColumns` to disambiguate



##########
hudi-spark-datasource/hudi-spark/src/test/scala/org/apache/hudi/functional/TestColumnStatsIndex.scala:
##########
@@ -244,7 +247,8 @@ class TestColumnStatsIndex extends HoodieClientTestBase {
       // We have to include "c1", since we sort the expected outputs by this column
       val requestedColumns = Seq("c4", "c1")
 
-      val expectedColStatsSchema = composeIndexSchema(requestedColumns.sorted, sourceTableSchema)
+      val realIndexColumns = requestedColumns.filter(targetColumnsToIndex.contains(_))

Review Comment:
   This filtering should be performed w/in `composeIndexSchema` itself



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org