{"record":{"id":"85751ceb7b6d4635","repo":"apache/iceberg","slug":"unknown-field-ordinal-85751c","errorCode":null,"errorMessage":"Unknown field ordinal: ","messagePattern":"Unknown field ordinal: ","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"core/src/main/java/org/apache/iceberg/GenericPartitionFieldSummary.java","lineNumber":162,"sourceCode":"\n  @Override\n  public Object get(int i) {\n    int pos = i;\n    // if the schema was projected, map the incoming ordinal to the expected one\n    if (fromProjectionPos != null) {\n      pos = fromProjectionPos[i];\n    }\n    switch (pos) {\n      case 0:\n        return containsNull;\n      case 1:\n        return containsNaN;\n      case 2:\n        return lowerBound();\n      case 3:\n        return upperBound();\n      default:\n        throw new UnsupportedOperationException(\"Unknown field ordinal: \" + pos);\n    }\n  }\n\n  @Override\n  @SuppressWarnings(\"unchecked\")\n  public <T> void set(int i, T value) {\n    int pos = i;\n    // if the schema was projected, map the incoming ordinal to the expected one\n    if (fromProjectionPos != null) {\n      pos = fromProjectionPos[i];\n    }\n    switch (pos) {\n      case 0:\n        this.containsNull = (Boolean) value;\n        return;\n      case 1:\n        this.containsNaN = (Boolean) value;\n        return;","sourceCodeStart":144,"sourceCodeEnd":180,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/core/src/main/java/org/apache/iceberg/GenericPartitionFieldSummary.java#L144-L180","documentation":"GenericPartitionFieldSummary.get supports ordinals 0-3 (containsNull, containsNaN, lowerBound, upperBound) and throws UnsupportedOperationException('Unknown field ordinal: ' + pos) otherwise. Like the other StructLike implementations, a foreign ordinal means the caller's positional access does not match the partition-field-summary struct schema.","triggerScenarios":"Calling get(pos) with pos outside 0..3, usually from a projection whose field count exceeds the summary struct (stale/foreign schema) or custom code hardcoding positions after schema changes.","commonSituations":"Partition statistics readers whose projected schema includes extra fields; version skew between writer and reader of partition stats files; hand-written positional accessors in analytics tooling.","solutions":["Access summary fields only through positions resolved from the summary struct type rather than hardcoded indices.","Align the projection used for reading partition stats with the four supported summary fields.","Upgrade Iceberg if the stats files contain a newer summary layout with additional fields."],"exampleFix":"// before\nObject v = summary.get(5);\n// after\nint pos = summaryType.fields().indexOf(summaryType.field(\"lower_bound\"));\nObject v = summary.get(pos);","handlingStrategy":"type-guard","validationCode":"if (pos < 0 || pos > 3) throw new IllegalArgumentException(\"Summary ordinal out of range: \" + pos);","typeGuard":"boolean isValidSummaryOrdinal(int pos) { return pos >= 0 && pos <= 3; }","tryCatchPattern":"try {\n  Object v = summary.get(pos);\n} catch (UnsupportedOperationException e) {\n  if (e.getMessage().startsWith(\"Unknown field ordinal\")) {\n    // resolve the position from the summary struct type before accessing\n  } else throw e;\n}","preventionTips":["Look up ordinals via summary struct type field names instead of literals.","Restrict projections for partition stats summaries to the 4 supported fields.","Upgrade Iceberg when consuming stats files with newer summary layouts."],"tags":["partition-stats","ordinal","unsupported-operation"],"backgroundTag":"unsupported-operation","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"}