{"record":{"id":"22ff8bd41631e06f","repo":"apache/iceberg","slug":"unknown-comparison-result-22ff8b","errorCode":null,"errorMessage":"Unknown comparison result","messagePattern":"Unknown comparison result","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"flink/v2.1/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.1/flink/src/main/java/org/apache/iceberg/flink/sink/dynamic/TableUpdater.java#L156-L192","documentation":"In TableUpdater.findOrCreateSchema, after comparing the current table schema against the target schema, a switch on the comparison result has a default branch indicating an impossible outcome of the internal comparison logic. Reaching it means the internal comparison produced an unexpected value — a defensive invariant check, not user input validation.","triggerScenarios":"Internal bug or unexpected schema comparison state while evolving a schema via newSchemaInfo; virtually impossible to trigger from user code except through a race where the table schema changes concurrently and the comparison result enumeration is extended without updating the switch.","commonSituations":"Hitting it during concurrent schema evolution races in Flink writing jobs that auto-evolve schemas; typically indicates a connector bug to report.","solutions":["Retry the write/job; transient concurrent-modification races may resolve on retry.","File a bug against the Iceberg Flink connector with the stack trace.","Upgrade to the latest connector version where the comparison switch may be fixed."],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  schema = tableUpdater.findOrCreateSchema(identifier, schema);\n} catch (IllegalArgumentException e) {\n  if (e.getMessage().equals(\"Unknown comparison result\")) {\n    // transient internal race — retry once, then report\n  } else throw e;\n}","preventionTips":["Avoid multiple writers concurrently evolving the same table schema.","Keep the connector up to date; report occurrences as bugs.","Serialize schema evolution through a single coordinator job when possible."],"tags":["flink","schema","internal"],"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"}