{"record":{"id":"f7712fe57682fb82","repo":"apache/beam","slug":"unable-to-get-logical-type-identifier","errorCode":null,"errorMessage":"Unable to get logical type ${identifier}","messagePattern":"Unable to get logical type (.+?)","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"sdks/java/extensions/sql/src/main/java/org/apache/beam/sdk/extensions/sql/impl/rel/BeamCalcRel.java","lineNumber":631,"sourceCode":"                    \"getLogicalTypeValue\",\n                    fieldName,\n                    Expressions.constant(LocalDateTime.class)),\n                LocalDateTime.class);\n          } else if (org.apache.beam.sdk.schemas.logicaltypes.Timestamp.IDENTIFIER.equals(\n              identifier)) {\n            return Expressions.convert_(\n                Expressions.call(\n                    expression,\n                    \"getLogicalTypeValue\",\n                    fieldName,\n                    Expressions.constant(java.time.Instant.class)),\n                java.time.Instant.class);\n          } else if (FixedPrecisionNumeric.IDENTIFIER.equals(identifier)) {\n            return Expressions.call(expression, \"getDecimal\", fieldName);\n          } else if (logicalType instanceof PassThroughLogicalType) {\n            return getBeamField(list, expression, fieldName, logicalType.getBaseType());\n          } else {\n            throw new UnsupportedOperationException(\"Unable to get logical type \" + identifier);\n          }\n        default:\n          throw new UnsupportedOperationException(\"Unable to get \" + fieldType.getTypeName());\n      }\n    }\n\n    // Value conversion: Beam => Calcite\n    private static Expression toCalciteValue(\n        Expression value, FieldType fieldType, boolean useByteString) {\n      switch (fieldType.getTypeName()) {\n        case BYTE:\n          return Expressions.convert_(value, Byte.class);\n        case INT16:\n          return Expressions.convert_(value, Short.class);\n        case INT32:\n          return Expressions.convert_(value, Integer.class);\n        case INT64:\n          return Expressions.convert_(value, Long.class);","sourceCodeStart":613,"sourceCodeEnd":649,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/extensions/sql/src/main/java/org/apache/beam/sdk/extensions/sql/impl/rel/BeamCalcRel.java#L613-L649","documentation":"When generating the Java expression to read a Beam Row field for Calcite, getBeamField handles recognized logical type identifiers; an unrecognized identifier that is also not a PassThroughLogicalType triggers this UnsupportedOperationException. The codegen path cannot produce a getter for that logical type.","triggerScenarios":"A queried field's Schema.FieldType has a logical type whose identifier is not in the supported list (e.g. a custom LogicalType identifier) when BeamCalcRel compiles the Calc expression.","commonSituations":"Custom user logical types used in SQL-queried schemas; logical types introduced in newer Beam SDK versions but the SQL extension at runtime is older; mismatch between schema registration and SQL support.","solutions":["Make the custom logical type implement PassThroughLogicalType with a supported base type","Change the field to a supported primitive/logical type before the SQL stage","Check the identifier against BeamCalcRel's supported list and upgrade Beam if support was added upstream","Bypass SQL for that column (project it out before the query, re-add after)"],"exampleFix":"// before\nnew LogicalType<>(\"my.ns:custom\", ...);\n// after\nnew PassThroughLogicalType<>(\"my.ns:custom\", FieldType.STRING, ..., ...); // or use FieldType.STRING","handlingStrategy":"type-guard","validationCode":"boolean codegenSupports(Schema.FieldType f) {\n  var lt = f.getLogicalType();\n  return lt == null || lt instanceof PassThroughLogicalType;\n}","typeGuard":"boolean isPassThrough(Schema.FieldType f) {\n  return f.getLogicalType() instanceof org.apache.beam.sdk.schemas.logicaltypes.PassThroughLogicalType;\n}","tryCatchPattern":"try {\n  rows.apply(SqlTransform.query(sql));\n} catch (UnsupportedOperationException e) {\n  if (e.getMessage().startsWith(\"Unable to get logical type\")) {\n    // convert field to supported type and re-plan\n  }\n}","preventionTips":["Keep logical types in SQL-facing schemas limited to built-in/pass-through ones","Add schema compatibility tests before SQL stages","Project out unsupported columns upstream","Track Beam release notes for logical-type support additions"],"tags":["java","apache-beam","sql","logical-type","codegen"],"backgroundTag":"type-mismatch","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"}