huaxingao commented on code in PR #11439:
URL: https://github.com/apache/iceberg/pull/11439#discussion_r1830370555


##########
spark/v3.5/spark-extensions/src/test/java/org/apache/iceberg/spark/extensions/TestRewriteDataFilesProcedure.java:
##########
@@ -69,6 +69,60 @@ public void removeTable() {
     sql("DROP TABLE IF EXISTS %s", tableName(QUOTED_SPECIAL_CHARS_TABLE_NAME));
   }
 
+  @TestTemplate
+  public void testFailsByCaseSensitiveWhereSql() {
+    createTable();
+    insertData(10);
+    sql("set spark.sql.caseSensitive=true");
+    assertThatThrownBy(
+            () ->
+                sql(
+                    "CALL %s.system.rewrite_data_files(table=>'%s', where=>'C1 
> 0')",
+                    catalogName, tableIdent))
+        .isInstanceOf(IllegalArgumentException.class)
+        .hasMessage("Cannot parse predicates in where option: C1 > 0");
+  }
+
+  @TestTemplate
+  public void testSucceedByCaseInsensitiveWhereSql() {
+    createTable();
+    sql("set spark.sql.caseSensitive=false");
+    assertEquals(
+        "Should have done nothing but passed the schema validation, since no 
files are present",
+        ImmutableList.of(row(0, 0, 0L, 0)),
+        sql(
+            "CALL %s.system.rewrite_data_files(table=>'%s', where=>'C1 > 0')",

Review Comment:
   With `spark.sql.caseSensitive` set to false, the schema validation will 
always pass, with or without the changes in this PR.
   
   I think we want to add tests that will fail without the fix and pass with 
the fix.
   We can add a test with `insertData` and `spark.sql.caseSensitive=false`. I 
think that test will fail without the fix and pass with the fix.



-- 
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: issues-unsubscr...@iceberg.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org
For additional commands, e-mail: issues-h...@iceberg.apache.org

Reply via email to