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



##########
File path: 
spark/v3.2/spark/src/main/java/org/apache/iceberg/spark/procedures/RewriteDataFilesProcedure.java
##########
@@ -109,21 +106,20 @@ 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) {
-      ParserInterface sqlParser = spark().sessionState().sqlParser();
       try {
-        Expression expression = sqlParser.parseExpression(where);
-        return 
action.filter(SparkExpressionConverter.convertToIcebergExpression(expression));
-      } catch (ParseException e) {
+        return 
action.filter(SparkExpressionConverter.convertToIcebergExpression(
+            SparkExpressionConverter.collectResolvedSparkExpression(spark(), 
tableName, where)));

Review comment:
       ```suggestion
           Expression expression = 
SparkExpressionConverter.collectResolvedSparkExpression(spark(), tableName, 
where);
           return 
action.filter(SparkExpressionConverter.convertToIcebergExpression(expression));
   ```




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