dramaticlly commented on code in PR #8560:
URL: https://github.com/apache/iceberg/pull/8560#discussion_r1329081393
##########
spark/v3.4/spark-extensions/src/test/java/org/apache/iceberg/spark/extensions/TestRewriteDataFilesProcedure.java:
##########
@@ -491,6 +523,39 @@ public void testRewriteDataFilesWithAllPossibleFilters() {
// " where => 'c2 like \"%s\"')", catalogName, tableIdent, "%car%");
}
+ @Test
+ public void testRewriteDataFilesWithPossibleV2Filters() {
+ // currently spark session catalog only resolve to v1 functions instead of
desired v2 functions
+ //
https://github.com/apache/spark/blob/branch-3.4/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/Analyzer.scala#L2070-L2083
+
Assume.assumeFalse(catalogName.equals(SparkCatalogConfig.SPARK.catalogName()));
+
+ SystemFunctionPushDownHelper.createPartitionedTable(spark, tableName,
"id");
+ sql(
+ "CALL %s.system.rewrite_data_files(table => '%s',"
+ + " where => '%s.system.bucket(2, data) >= 0')",
+ catalogName, tableIdent, catalogName);
+ sql(
+ "CALL %s.system.rewrite_data_files(table => '%s',"
+ + " where => '%s.system.truncate(4, id) >= 1')",
+ catalogName, tableIdent, catalogName);
+ sql(
+ "CALL %s.system.rewrite_data_files(table => '%s',"
+ + " where => '%s.system.years(ts) >= 1')",
+ catalogName, tableIdent, catalogName);
+ sql(
+ "CALL %s.system.rewrite_data_files(table => '%s',"
+ + " where => '%s.system.months(ts) >= 1')",
+ catalogName, tableIdent, catalogName);
+ sql(
+ "CALL %s.system.rewrite_data_files(table => '%s',"
+ + " where => '%s.system.days(ts) >= date(\"2023-01-01\")')",
+ catalogName, tableIdent, catalogName);
+ sql(
+ "CALL %s.system.rewrite_data_files(table => '%s',"
+ + " where => '%s.system.hours(ts) >= 1')",
+ catalogName, tableIdent, catalogName);
Review Comment:
hey @advancedxy, this test `testRewriteDataFilesWithPossibleV2Filters` aimed
to verify the rewriteDataFiles can be executed with all possible v2 filter
expressions, similar to existing tests named
`testRewriteDataFilesWithAllPossibleFilters`. You can refer to other unit tests
such as `testRewriteDataFilesWithFilterOnOnBucketExpression` to see how
procedure outputs gets verified
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]