huaxingao commented on a change in pull request #3757:
URL: https://github.com/apache/iceberg/pull/3757#discussion_r769918521



##########
File path: 
spark/v3.2/spark/src/main/java/org/apache/iceberg/spark/procedures/RewriteDataFilesProcedure.java
##########
@@ -109,19 +110,23 @@ public StructType outputType() {
       }
 
       String where = args.isNullAt(4) ? null : args.getString(4);
-      action = checkAndApplyFilter(action, where);
+      action = checkAndApplyFilter(action, where, table.name());
 
       RewriteDataFiles.Result result = action.execute();
 
       return toOutputRows(result);
     });
   }
 
-  private RewriteDataFiles checkAndApplyFilter(RewriteDataFiles action, String 
where) {
+  private RewriteDataFiles checkAndApplyFilter(RewriteDataFiles action, String 
where, String tableName) {
     if (where != null) {
+      // Add a dummy prefix linking to the table to collect the resolved spark 
expression from analyzed plan.
+      String prefix = String.format("SELECT count(*) from %s where ", 
tableName);

Review comment:
       I think there is no need to have an aggregate function here.  A simple 
query `SELECT 1 from %s where` is sufficient.




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