wombatu-kun commented on code in PR #12649:
URL: https://github.com/apache/hudi/pull/12649#discussion_r1918129199
##########
hudi-spark-datasource/hudi-spark/src/test/scala/org/apache/spark/sql/hudi/procedure/TestClusteringProcedure.scala:
##########
@@ -774,6 +774,50 @@ class TestClusteringProcedure extends
HoodieSparkProcedureTestBase {
}
}
+ test("Test Call show_clustering with limit parameter") {
+ withSQLConf("hoodie.compact.inline" -> "false",
"hoodie.compact.inline.max.delta.commits" -> "1") {
+ withTempDir { tmp =>
+ val tableName = generateTableName
+ val basePath = s"${tmp.getCanonicalPath}/$tableName"
+ val hudiOptions = Map(
+ "hoodie.table.name" -> tableName,
+ "hoodie.datasource.write.table.type" -> "COPY_ON_WRITE",
+ "hoodie.datasource.write.recordkey.field" -> "a",
+ "hoodie.datasource.write.partitionpath.field" -> "a,b,c",
+ "hoodie.clean.automatic" -> "true",
+ "hoodie.metadata.enable" -> "true",
+ "hoodie.clustering.inline" -> "true",
+ "hoodie.clustering.inline.max.commits" -> "1",
+ "hoodie.cleaner.commits.retained" -> "2",
+ "hoodie.datasource.write.operation" -> "insert_overwrite"
+ )
+
+ val data = Seq(
+ (1, 2, 4),
+ (1, 2, 4),
+ (1, 2, 3)
+ )
+ val schema = StructType(Array(
+ StructField("a", IntegerType, true),
+ StructField("b", IntegerType, true),
+ StructField("c", IntegerType, true)
+ ))
+
+ val df =
spark.createDataFrame(spark.sparkContext.parallelize(data).map {
+ case (a, b, c) => Row(a, b, c)
+ }, schema)
+
+ df.write
+ .options(hudiOptions)
+ .format("hudi")
+ .mode("append")
+ .save(s"$basePath")
+
+ assertResult(1)(spark.sql(s"call show_clustering(path =>
'$basePath')").count())
Review Comment:
As the test is called 'with limit parameter', add please assertions on
calling show_clustering also with limit=1 and with limit more than 1 (to prove
that it fixes the issue).
--
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]