{"record":{"id":"6b63a41a38cff270","repo":"apache/iceberg","slug":"unknown-comparison-result","errorCode":null,"errorMessage":"Unknown comparison result","messagePattern":"Unknown comparison result","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"flink/v1.20/flink/src/main/java/org/apache/iceberg/flink/sink/dynamic/TableUpdater.java","lineNumber":174,"sourceCode":"            TableMetadataCache.ResolvedSchemaInfo comparisonAfterMigration =\n                cache.schema(identifier, schema);\n            Schema newSchema = comparisonAfterMigration.resolvedTableSchema();\n            LOG.info(\"Table {} schema updated from {} to {}\", identifier, tableSchema, newSchema);\n            return comparisonAfterMigration;\n          } catch (CommitFailedException e) {\n            cache.invalidate(identifier);\n            TableMetadataCache.ResolvedSchemaInfo newSchema = cache.schema(identifier, schema);\n            if (newSchema.compareResult() != CompareSchemasVisitor.Result.SCHEMA_UPDATE_NEEDED) {\n              LOG.debug(\"Table {} schema updated concurrently to {}\", identifier, schema);\n              return newSchema;\n            } else {\n              LOG.error(\n                  \"Schema update failed for {} from {} to {}\", identifier, tableSchema, schema, e);\n              throw e;\n            }\n          }\n        default:\n          throw new IllegalArgumentException(\"Unknown comparison result\");\n      }\n    }\n  }\n\n  private PartitionSpec findOrCreateSpec(TableIdentifier identifier, PartitionSpec targetSpec) {\n    PartitionSpec currentSpec = cache.spec(identifier, targetSpec);\n    if (currentSpec != null) {\n      return currentSpec;\n    }\n\n    Table table = catalog.loadTable(identifier);\n    currentSpec = table.spec();\n\n    PartitionSpecEvolution.PartitionSpecChanges result =\n        PartitionSpecEvolution.evolve(currentSpec, targetSpec);\n    if (result.isEmpty()) {\n      LOG.info(\"Returning equivalent existing spec {} for {}\", currentSpec, targetSpec);\n      return currentSpec;","sourceCodeStart":156,"sourceCodeEnd":192,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/flink/v1.20/flink/src/main/java/org/apache/iceberg/flink/sink/dynamic/TableUpdater.java#L156-L192","documentation":"TableUpdater.findOrCreateSchema compares the table's current schema with the target schema and switches on the comparison result (equal / evolved / incompatible). The default branch is reached only when the comparison helper returns an unexpected value, so this IllegalArgumentException signals an internal invariant violation rather than user error.","triggerScenarios":"The schema-comparison logic in TableUpdater returns a value outside the enumerated cases (equal, needs-update) during findOrCreateSchema, called from newSchemaInfo while syncing a DataStream schema to the Iceberg table schema.","commonSituations":"Practically unreachable for users; would appear after an internal code change to the comparison helper or cache behavior, or concurrent schema updates racing with the updater so an unexpected branch result is produced.","solutions":["Report this as a bug to the Iceberg project with the full stack trace and table schema details","Retry the job; if the cause was a transient concurrent schema update, re-running against the committed schema may succeed","Check the Iceberg version for known fixes in TableUpdater schema-comparison handling and upgrade","Capture the current table schema and the DataStream schema being applied to help reproduce and diagnose"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  updater.newSchemaInfo(identifier, schema);\n} catch (IllegalArgumentException e) {\n  if (e.getMessage().contains(\"Unknown comparison result\")) {\n    // log full context, retry with fresh table metadata or report bug\n  }\n  throw e;\n}","preventionTips":["Avoid concurrent schema updates to the same table while the dynamic sink is running","Use one connector version consistently across the job","Report internal-invariant failures to the Iceberg project with stack traces"],"tags":["flink","iceberg","internal","schema"],"backgroundTag":"internal-invariant-violation","analyzedSha":"86d9c8fc543e7c56c9f624eb725f76c9baff9570","analyzedAt":"2026-09-12T00:46:39.097Z","contentChangedAt":"2026-09-12T00:46:39.097Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}