{"record":{"id":"38dfd715087363c7","repo":"apache/beam","slug":"unsupported-change-type","errorCode":null,"errorMessage":"Unsupported change type: ","messagePattern":"Unsupported change type: ","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"sdks/java/io/delta/src/main/java/org/apache/beam/sdk/io/delta/DeltaCDCSourceDoFn.java","lineNumber":272,"sourceCode":"      builder.addValue(value);\n    }\n    return builder.build();\n  }\n\n  private static ValueKind getValueKind(String changeType) {\n    // Maps Delta CDC change types to Beam's ValueKind enum.\n    // https://docs.delta.io/delta-change-data-feed/#what-is-the-schema-for-the-change-data-feed\n    switch (changeType) {\n      case \"insert\":\n        return ValueKind.INSERT;\n      case \"delete\":\n        return ValueKind.DELETE;\n      case \"update_preimage\":\n        return ValueKind.UPDATE_BEFORE;\n      case \"update_postimage\":\n        return ValueKind.UPDATE_AFTER;\n      default:\n        throw new IllegalArgumentException(\"Unsupported change type: \" + changeType);\n    }\n  }\n\n  private static StructType appendCDFColumns(StructType schema) {\n    return schema\n        .add(DeltaIO.CHANGE_TYPE_COLUMN, StringType.STRING, true)\n        .add(DeltaIO.COMMIT_VERSION_COLUMN, LongType.LONG, true)\n        .add(DeltaIO.COMMIT_TIMESTAMP_COLUMN, TimestampType.TIMESTAMP, true);\n  }\n\n  private ColumnarBatch appendConstantCDFColumns(\n      Engine engine, ColumnarBatch batch, long version, long timestamp) {\n    StructType schemaForEval = batch.getSchema();\n\n    ExpressionEvaluator changeTypeGenerator =\n        wrapEngineException(\n            () ->\n                engine","sourceCodeStart":254,"sourceCodeEnd":290,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/io/delta/src/main/java/org/apache/beam/sdk/io/delta/DeltaCDCSourceDoFn.java#L254-L290","documentation":"DeltaCDCSourceDoFn.getValueKind maps the _change_type string to a Beam ValueKind (INSERT/DELETE/UPDATE_BEFORE/UPDATE_AFTER). Any value outside the Delta CDF enum (insert, delete, update_preimage, update_postimage) hits the default branch and throws IllegalArgumentException.","triggerScenarios":"A row's _change_type contains an unexpected string — a newer Delta writer version emitting new change types, a hand-edited/corrupted _change_type value, or case differences from custom writes.","commonSituations":"Upgrading Delta writers that introduce change types this Beam connector doesn't know; writing CDF metadata columns manually with wrong casing; data corrupted by a non-Delta writer touching the table.","solutions":["Upgrade the Beam delta-io connector to a version that supports the change type your Delta writer emits.","Inspect the offending _change_type values in the table (SELECT DISTINCT _change_type ...) to see what unexpected value exists.","Normalize the value (lowercase/trim) at the writer side if custom code produces CDF metadata.","As a stopgap, add a case for the new change type or pre-filter such rows in a prior transform."],"exampleFix":"// before\nswitch (changeType) {\n  case \"insert\": ... case \"delete\": ... // missing newer types\n  default: throw new IllegalArgumentException(\"Unsupported change type: \" + changeType);\n}\n// after\n// upgrade the connector, or normalize:\nString ct = changeType == null ? null : changeType.trim().toLowerCase();\nswitch (ct) { /* existing cases plus any new Delta change types */ }","handlingStrategy":"type-guard","validationCode":"java.util.Set<String> KNOWN = java.util.Set.of(\"insert\",\"delete\",\"update_preimage\",\"update_postimage\");\n// before reading: SELECT DISTINCT _change_type FROM table_changes(...) and check all values are in KNOWN","typeGuard":"static boolean isKnownChangeType(String changeType) {\n  return changeType != null && java.util.Set.of(\"insert\",\"delete\",\"update_preimage\",\"update_postimage\").contains(changeType.trim().toLowerCase());\n}","tryCatchPattern":"try { /* process CDC rows */ } catch (IllegalArgumentException e) { if (e.getMessage().startsWith(\"Unsupported change type:\")) { logOffendingRowsAndUpgradeConnector(); } else { throw e; } }","preventionTips":["Keep the Beam connector version in sync with the Delta writer version used to produce the table.","Never let custom writers fabricate _change_type values.","Profile distinct _change_type values before deploying a CDC pipeline."],"tags":["java","delta-lake","cdc","enum","unsupported-value"],"backgroundTag":"invalid-enum-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"}