{"record":{"id":"6a66581cf8d4c2c0","repo":"apache/iceberg","slug":"unknown-comparison-result-6a6658","errorCode":null,"errorMessage":"Unknown comparison result","messagePattern":"Unknown comparison result","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"flink/v2.3/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/v2.3/flink/src/main/java/org/apache/iceberg/flink/sink/dynamic/TableUpdater.java#L156-L192","documentation":"TableUpdater.findOrCreateSchema compares the target schema against existing table schemas and acts on the comparison result. If the comparison yields a result outside the expected set of SchemaUpdate outcomes, the default branch throws IllegalArgumentException('Unknown comparison result') as an internal invariant guard.","triggerScenarios":"An unexpected SchemaComparator/comparison result value returned during schema synchronization — typically only reachable if the comparison logic is extended without updating this switch.","commonSituations":"Internal invariant breach after library upgrades or custom comparator implementations; not normally triggered by user configuration.","solutions":["Report/inspect the comparison logic producing the unexpected result","Upgrade to a version where the switch is exhaustive over comparison results","If custom comparison code is involved, ensure it only returns recognized result values"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  tableUpdater.findOrCreateSchema(identifier, targetSchema);\n} catch (IllegalArgumentException e) {\n  LOG.error(\"Unexpected schema comparison result; check Iceberg version compatibility\", e);\n}","preventionTips":["Avoid custom schema-comparator implementations","Keep writer and catalog Iceberg versions aligned","Report unexpected comparison results upstream as bugs"],"tags":["flink","schema","invariant"],"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"}