{"record":{"id":"6287afc0b82096ae","repo":"apache/beam","slug":"unsupported-operands-for-expression-call","errorCode":null,"errorMessage":"Unsupported operands for expression: {call}","messagePattern":"Unsupported operands for expression: (.+?)","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"sdks/java/io/iceberg/src/main/java/org/apache/beam/sdk/io/iceberg/FilterUtils.java","lineNumber":333,"sourceCode":"      Schema schema) {\n    SqlNode left = getLeftChild(call);\n    SqlNode right = getRightChild(call);\n    if (left instanceof SqlIdentifier && right instanceof SqlLiteral) {\n      String caseInsensitiveName = getFieldName((SqlIdentifier) left);\n      Types.NestedField field = schema.caseInsensitiveFindField(caseInsensitiveName);\n      String name = schema.findColumnName(field.fieldId());\n      TypeID type = field.type().typeId();\n      Object value = convertLiteral((SqlLiteral) right, name, type);\n      return convertLR.apply(name, value);\n    } else if (left instanceof SqlLiteral && right instanceof SqlIdentifier) {\n      String caseInsensitiveName = getFieldName((SqlIdentifier) right);\n      Types.NestedField field = schema.caseInsensitiveFindField(caseInsensitiveName);\n      String name = schema.findColumnName(field.fieldId());\n      TypeID type = field.type().typeId();\n      Object value = convertLiteral((SqlLiteral) left, name, type);\n      return convertRL.apply(name, value);\n    } else {\n      throw new IllegalArgumentException(\"Unsupported operands for expression: \" + call);\n    }\n  }\n\n  private static Object convertLiteral(SqlLiteral literal, String field, TypeID type) {\n    SqlTypeName typeName = literal.getTypeName();\n    switch (type) {\n      case BOOLEAN:\n        return literal.getValueAs(Boolean.class);\n      case INTEGER:\n        return literal.getValueAs(Integer.class);\n      case LONG:\n        return literal.getValueAs(Long.class);\n      case FLOAT:\n        return literal.getValueAs(Float.class);\n      case DOUBLE:\n        return literal.getValueAs(Double.class);\n      case DECIMAL:\n        return literal.getValueAs(BigDecimal.class);","sourceCodeStart":315,"sourceCodeEnd":351,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/io/iceberg/src/main/java/org/apache/beam/sdk/io/iceberg/FilterUtils.java#L315-L351","documentation":"convertFieldAndLiteral handles predicates whose operands are a field identifier and a literal (in either order). If both operands are neither a field-name-plus-literal combination (e.g., literal-literal, identifier-identifier, or nested calls), it throws this IllegalArgumentException.","triggerScenarios":"Calling FilterUtils.convert with a predicate like \"1 = 1\", \"a = b\", or any expression where the operands of a comparison are not (SqlIdentifier, SqlLiteral) or (SqlLiteral, SqlIdentifier).","commonSituations":"Tautological filters such as \"1=1\" auto-generated by query builders; comparing two columns (join-style predicates) in pushdown filters; literals written as identifiers by mistake (unquoted column names intended as strings).","solutions":["Rewrite the predicate so one side is a column name and the other is a literal, e.g. \"col = 'value'\".","Quote intended string literals with single quotes so they parse as SqlLiteral, not identifiers.","Remove tautological or column-to-column comparisons from pushdown filters."],"exampleFix":"// before\nExpression e = FilterUtils.convert(\"1 = 1\", schema);\n// after\nExpression e = FilterUtils.convert(\"id = 1\", schema);","handlingStrategy":"validation","validationCode":"// ensure each predicate is of form column <op> literal, e.g.\ncheckArgument(fieldNames.size() >= 1 && literalCount == 1, \"Predicate must compare one column to one literal\");","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Reject column-to-column comparisons and tautologies (1=1) in pushdown filters.","Quote string literals with single quotes so they parse as literals, not identifiers.","Keep predicates simple: one field, one literal each."],"tags":["java","sql","operands","apache-beam","iceberg"],"backgroundTag":"invalid-argument-value","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}