lintingbin commented on code in PR #3426:
URL: https://github.com/apache/amoro/pull/3426#discussion_r1983006847
##########
amoro-format-iceberg/src/main/java/org/apache/amoro/utils/ExpressionUtil.java:
##########
@@ -79,4 +108,169 @@ public static Expression convertPartitionDataToDataFilter(
}
return filter;
}
+
+ /**
+ * Convert SQL filter to Iceberg {@link Expression}.
+ *
+ * @param sqlFilter the SQL filter
+ * @param tableColumns the list of table columns
+ * @return the Iceberg {@link Expression}
+ */
+ public static Expression convertSqlFilterToIcebergExpression(
+ String sqlFilter, List<Types.NestedField> tableColumns) {
+ if (sqlFilter == null) {
+ return Expressions.alwaysTrue();
+ }
+
+ try {
+ Select statement = (Select) CCJSqlParserUtil.parse("SELECT * FROM dummy
WHERE " + sqlFilter);
Review Comment:
"SELECT * FROM dummy" is just to enable the CCJSqlParserUtil.parse method to
perform normal SQL syntax parsing. If there is only a WHERE condition, the
syntax parsing cannot pass.
--
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]