{"record":{"id":"dc4fd951c132a77a","repo":"apache/beam","slug":"unable-to-get-typename","errorCode":null,"errorMessage":"Unable to get ${typeName}","messagePattern":"Unable to get (.+?)","errorType":"exception","errorClass":"java.lang.UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"sdks/java/extensions/sql/src/main/java/org/apache/beam/sdk/extensions/sql/impl/rel/BeamCalcRel.java","lineNumber":634,"sourceCode":"                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);\n        case DECIMAL:\n          return Expressions.convert_(value, BigDecimal.class);\n        case FLOAT:","sourceCodeStart":616,"sourceCodeEnd":652,"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#L616-L652","documentation":"Default branch of the codegen getter: when a field's TypeName has no expression mapping in getBeamField, UnsupportedOperationException 'Unable to get <typeName>' is thrown while compiling the Calc operator. It means Beam SQL cannot generate accessor code for that schema type.","triggerScenarios":"The input schema contains a field type with a TypeName the SQL bridge has no case for (e.g. certain ROW/nested or exotic types) when the query planner builds code to read that column.","commonSituations":"Querying PCollections with complex nested schemas; types surfaced from Avro/Proto inference; older Beam versions where newer schema TypeNames lack SQL support.","solutions":["Flatten or remove the unsupported field from the schema before the SQL transform","Project only supported columns before running the query","Convert the field to a supported representation (e.g. JSON string) upstream","Upgrade Apache Beam for broader type coverage in the SQL extension"],"exampleFix":"// before\nSchema schema = Schema.builder().addField(\"complex\", unsupportedFieldType).build();\n// after\nSchema schema = Schema.builder().addStringField(\"complexAsJson\").build(); // serialize before SQL","handlingStrategy":"type-guard","validationCode":"boolean typeNameSupported(Schema.FieldType f) {\n  switch (f.getTypeName()) {\n    case BYTE: case INT16: case INT32: case INT64: case FLOAT: case DOUBLE:\n    case BOOLEAN: case STRING: case DATETIME: return true;\n    default: return f.isCollectionType() || f.isMapType();\n  }\n}","typeGuard":"boolean isSimpleField(Schema.FieldType f) {\n  return !f.getTypeName().isNestedType() && f.getLogicalType() == null;\n}","tryCatchPattern":"try {\n  rows.apply(SqlTransform.query(sql));\n} catch (UnsupportedOperationException e) {\n  if (e.getMessage().startsWith(\"Unable to get \")) {\n    // serialize/flatten the field and retry the query\n  }\n}","preventionTips":["Restrict SQL input schemas to flat, primitive-typed fields","Serialize nested/exotic types to JSON strings before SQL","Test the full query against real inferred schemas in CI","Upgrade Beam to get broader TypeName coverage"],"tags":["java","apache-beam","sql","schema","codegen"],"backgroundTag":"unsupported-operation","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"}