ahmedabu98 commented on code in PR #35230:
URL: https://github.com/apache/beam/pull/35230#discussion_r2140483411
##########
sdks/java/io/iceberg/src/main/java/org/apache/beam/sdk/io/iceberg/FilterUtils.java:
##########
@@ -72,6 +74,56 @@ class FilterUtils {
.put(SqlKind.OR, Operation.OR)
.build();
+ /**
+ * Parses a SQL filter expression string and returns a set of all field
names referenced within
+ * it.
+ */
+ static Set<String> getReferencedFieldNames(@Nullable String filter) {
+ if (filter == null || filter.trim().isEmpty()) {
+ return new HashSet<>();
+ }
+
+ SqlParser parser = SqlParser.create(filter);
+ try {
+ SqlNode expression = parser.parseExpression();
+ Set<String> fieldNames = new HashSet<>();
+ extractFieldNames(expression, fieldNames);
+ System.out.println("xxx fields in filter: " + fieldNames);
Review Comment:
Done
--
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]