{"record":{"id":"97ce29c13ad3dacf","repo":"apache/beam","slug":"data-generator-requires-a-defined-sql-type-beam-type-s-on","errorCode":null,"errorMessage":"Data generator requires a defined SQL type. Beam type '%s' on field '%s' is not supported.","messagePattern":"Data generator requires a defined SQL type\\. Beam type '(.+?)' on field '(.+?)' is not supported\\.","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"sdks/java/extensions/sql/src/main/java/org/apache/beam/sdk/extensions/sql/meta/provider/datagen/DataGeneratorRowFn.java","lineNumber":108,"sourceCode":"    FieldGenerator valueGenerator = createValueGeneratorForField(field);\n    double nullRate = properties.path(\"fields.\" + fieldName + \".null-rate\").asDouble(0.0);\n\n    if (nullRate > 0) {\n      return (index) ->\n          ThreadLocalRandom.current().nextDouble() < nullRate\n              ? null\n              : valueGenerator.generate(index);\n    }\n    return valueGenerator;\n  }\n\n  private FieldGenerator createValueGeneratorForField(Schema.Field field) {\n    String fieldName = field.getName();\n    String kind = properties.path(\"fields.\" + fieldName + \".kind\").asText(\"random\");\n\n    final SqlTypeName sqlTypeName = CalciteUtils.toSqlTypeName(field.getType());\n    if (sqlTypeName == null) {\n      throw new UnsupportedOperationException(\n          \"Data generator requires a defined SQL type. Beam type '\"\n              + field.getType().getTypeName()\n              + \"' on field '\"\n              + field.getName()\n              + \"' is not supported.\");\n    }\n\n    if (\"sequence\".equalsIgnoreCase(kind)) {\n      if (!SqlTypeName.INT_TYPES.contains(sqlTypeName)) {\n        throw new IllegalArgumentException(\n            String.format(\n                \"The 'sequence' generator for integers only supports integer types, but field '%s' is of type '%s'.\",\n                field.getName(), sqlTypeName));\n      }\n\n      JsonNode startNode = properties.path(\"fields.\" + fieldName + \".start\");\n      JsonNode endNode = properties.path(\"fields.\" + fieldName + \".end\");\n","sourceCodeStart":90,"sourceCodeEnd":126,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/extensions/sql/src/main/java/org/apache/beam/sdk/extensions/sql/meta/provider/datagen/DataGeneratorRowFn.java#L90-L126","documentation":"Data generators produce values based on the field's SQL type (Calcite SqlTypeName). If CalciteUtils.toSqlTypeName cannot map the Beam field type to a SQL type, generation is impossible and an UnsupportedOperationException is thrown when the field generator is created.","triggerScenarios":"Declaring a datagen table schema field with a Beam type that has no SQL equivalent (e.g. an exotic logical or nested/logical type) so toSqlTypeName returns null during createValueGeneratorForField.","commonSituations":"Using custom logical types in the DDL; schema defined programmatically with a type the SQL type mapping doesn't cover; Beam version where a type mapping is missing.","solutions":["Change the field to a supported SQL type (INT, BIGINT, DOUBLE, VARCHAR, TIMESTAMP, etc.).","Remove the unsupported field from the datagen table schema.","Upgrade Beam if the type was recently added and mapping support landed later."],"exampleFix":"// before\nSchema.Field.of(\"payload\", Schema.FieldType.logicalType(null))\n// after\nSchema.Field.of(\"payload\", Schema.FieldType.string)","handlingStrategy":"validation","validationCode":"for (Schema.Field f : schema.getFields()) {\n  if (CalciteUtils.toSqlTypeName(f.getType()) == null) {\n    throw new IllegalArgumentException(\"Unsupported datagen field type: \" + f.getName());\n  }\n}","typeGuard":"boolean hasSqlType(Schema.Field f) {\n  try { return CalciteUtils.toSqlTypeName(f.getType()) != null; } catch (Exception e) { return false; }\n}","tryCatchPattern":"try { createTable(...); } catch (UnsupportedOperationException e) { /* replace unsupported field type */ }","preventionTips":["Restrict datagen schemas to scalar SQL types.","Avoid custom logical types in datagen tables."],"tags":["beam-sql","datagen","unsupported-type"],"backgroundTag":"unsupported-config-value","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-20T03:17:13.778Z"}