yihua commented on a change in pull request #4308:
URL: https://github.com/apache/hudi/pull/4308#discussion_r770897157
##########
File path:
hudi-spark-datasource/hudi-spark/src/test/scala/org/apache/hudi/TestHoodieFileIndex.scala
##########
@@ -253,6 +253,30 @@ class TestHoodieFileIndex extends HoodieClientTestBase {
assertEquals(5, readDF2.filter("dt = '2021/03/01' and hh ='10'").count())
}
+ @ParameterizedTest
+ @CsvSource(Array("true,a.b.c","false,a.b.c","true,c","false,c"))
+ def testQueryPartitionPathsForNestedPartition(useMetaFileList:Boolean,
partitionBy:String): Unit = {
+ val inputDF = spark.range(100)
+ .withColumn("c",lit("c"))
+ .withColumn("b",struct("c"))
+ .withColumn("a",struct("b"))
+ inputDF.write.format("hudi")
+ .options(commonOpts)
+ .option(DataSourceWriteOptions.OPERATION.key,
DataSourceWriteOptions.INSERT_OPERATION_OPT_VAL)
+ .option(RECORDKEY_FIELD.key, "id")
+ .option(PRECOMBINE_FIELD.key, "id")
+ .option(PARTITIONPATH_FIELD.key, partitionBy)
+ .option(HoodieMetadataConfig.ENABLE.key(), useMetaFileList)
+ .mode(SaveMode.Overwrite)
+ .save(basePath)
+ metaClient = HoodieTableMetaClient.reload(metaClient)
+ val fileIndex = HoodieFileIndex(spark, metaClient, None,
+ queryOpts ++ Map(HoodieMetadataConfig.ENABLE.key ->
useMetaFileList.toString))
+ // test if table is partitioned on nested columns,
getAllQueryPartitionPaths does not break
+
assert(fileIndex.getAllQueryPartitionPaths.get(0).partitionPath.equals("c"))
+ }
+
+
Review comment:
nit: remove the empty line here?
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]