ConeyLiu commented on code in PR #8394:
URL: https://github.com/apache/iceberg/pull/8394#discussion_r1327324325


##########
spark/v3.4/spark-extensions/src/test/java/org/apache/iceberg/spark/extensions/TestRewriteDataFilesProcedure.java:
##########
@@ -763,6 +764,35 @@ public void testDefaultSortOrder() {
     assertEquals("Data after compaction should not change", expectedRecords, 
actualRecords);
   }
 
+  @Test
+  public void testRewriteDataFilesWithSystemFunctions() {
+    Assumptions.assumeThat(catalogName).isNotEqualTo("spark_catalog");
+
+    sql(
+        "CREATE TABLE %s (c1 INT, c2 STRING, c3 TIMESTAMP) "
+            + "USING iceberg "
+            + "PARTITIONED BY (days(c3)) "
+            + "TBLPROPERTIES ('%s' '%s')",
+        tableName,
+        TableProperties.WRITE_DISTRIBUTION_MODE,
+        TableProperties.WRITE_DISTRIBUTION_MODE_NONE);
+
+    sql(
+        "INSERT INTO TABLE %s VALUES (0, 'data-0', 
CAST('2017-11-22T09:20:44.294658+00:00' AS TIMESTAMP))",
+        tableName);
+    sql(
+        "INSERT INTO TABLE %s VALUES (1, 'data-1', 
CAST('2017-11-23T03:15:32.194356+00:00' AS TIMESTAMP))",
+        tableName);
+    // Test with invalid filter column col1
+    Assertions.assertThatThrownBy(
+            () ->
+                sql(
+                    "CALL %s.system.rewrite_data_files(table => '%s', where => 
'%s.system.years(c3) = 2017')",

Review Comment:
   Thanks for the good catch. I need to update to the UT since we will support 
the system function filters with #8560



##########
spark/v3.4/spark-extensions/src/test/java/org/apache/iceberg/spark/extensions/TestRewriteDataFilesProcedure.java:
##########
@@ -763,6 +764,35 @@ public void testDefaultSortOrder() {
     assertEquals("Data after compaction should not change", expectedRecords, 
actualRecords);
   }
 
+  @Test
+  public void testRewriteDataFilesWithSystemFunctions() {
+    Assumptions.assumeThat(catalogName).isNotEqualTo("spark_catalog");
+
+    sql(
+        "CREATE TABLE %s (c1 INT, c2 STRING, c3 TIMESTAMP) "
+            + "USING iceberg "
+            + "PARTITIONED BY (days(c3)) "
+            + "TBLPROPERTIES ('%s' '%s')",
+        tableName,
+        TableProperties.WRITE_DISTRIBUTION_MODE,
+        TableProperties.WRITE_DISTRIBUTION_MODE_NONE);
+
+    sql(
+        "INSERT INTO TABLE %s VALUES (0, 'data-0', 
CAST('2017-11-22T09:20:44.294658+00:00' AS TIMESTAMP))",
+        tableName);
+    sql(
+        "INSERT INTO TABLE %s VALUES (1, 'data-1', 
CAST('2017-11-23T03:15:32.194356+00:00' AS TIMESTAMP))",
+        tableName);
+    // Test with invalid filter column col1
+    Assertions.assertThatThrownBy(
+            () ->
+                sql(
+                    "CALL %s.system.rewrite_data_files(table => '%s', where => 
'%s.system.years(c3) = 2017')",

Review Comment:
   Thanks for the good catch. I need to update the UT since we will support the 
system function filters with #8560



-- 
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]

Reply via email to