diff --git a/.gitignore b/.gitignore index 2bad81975ba0..43df135ef201 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,14 @@ # is an input to 'maven-assembly-plugin' that generates source distribution. # This is typically in files named 'src.xml' throughout this repository. +# Ignore IDE files +.agent/ +.codex/ +.trae/ +.cursor/ +.windsurf/ +.claude/ + # Ignore any offline repositories the user may have created. **/offline-repository/**/* diff --git a/sdks/java/io/iceberg/src/main/java/org/apache/beam/sdk/io/iceberg/FilterUtils.java b/sdks/java/io/iceberg/src/main/java/org/apache/beam/sdk/io/iceberg/FilterUtils.java index fd008701c548..855fcf7d1e19 100644 --- a/sdks/java/io/iceberg/src/main/java/org/apache/beam/sdk/io/iceberg/FilterUtils.java +++ b/sdks/java/io/iceberg/src/main/java/org/apache/beam/sdk/io/iceberg/FilterUtils.java @@ -66,8 +66,6 @@ /** * Utilities that convert between a SQL filter expression and an Iceberg {@link Expression}. Uses * Apache Calcite semantics. - * - *
Note: Only supports top-level fields (i.e. cannot reference nested fields).
*/
@Internal
public class FilterUtils {
@@ -112,7 +110,7 @@ static Set Note: This utility currently supports only top-level fields within the filter expression.
- * Nested field references are not supported.
*/
static Expression convert(@Nullable String filter, Schema schema) {
if (filter == null) {
@@ -154,7 +149,7 @@ static Expression convert(@Nullable String filter, Schema schema) {
private static Expression convert(SqlNode expression, Schema schema) throws SqlParseException {
if (expression instanceof SqlIdentifier) {
- String fieldName = ((SqlIdentifier) expression).getSimple();
+ String fieldName = getFieldName((SqlIdentifier) expression);
Types.NestedField field = schema.caseInsensitiveFindField(fieldName);
if (field.type().equals(Types.BooleanType.get())) {
return Expressions.equal(field.name(), true);
@@ -242,7 +237,14 @@ private static String getOnlyChildName(SqlBasicCall call) {
SqlNode ref = call.operand(0);
Preconditions.checkState(
ref instanceof SqlIdentifier, "Expected operand '%s' to be a reference.", ref);
- return ((SqlIdentifier) ref).getSimple();
+ return getFieldName((SqlIdentifier) ref);
+ }
+
+ private static String getFieldName(SqlIdentifier identifier) {
+ if (identifier.isSimple()) {
+ return identifier.getSimple();
+ }
+ return String.join(".", identifier.names);
}
private static SqlNode getLeftChild(SqlBasicCall call) {
@@ -285,9 +287,9 @@ private static Expression convertFieldInLiteral(Operation op, SqlBasicCall call,
checkArgument(
value instanceof SqlNodeList,
"Expected right hand side to be a list but got " + value.getClass());
- String caseInsensitiveName = ((SqlIdentifier) term).getSimple();
+ String caseInsensitiveName = getFieldName((SqlIdentifier) term);
Types.NestedField field = schema.caseInsensitiveFindField(caseInsensitiveName);
- String name = field.name();
+ String name = schema.findColumnName(field.fieldId());
TypeID type = field.type().typeId();
List