{"record":{"id":"31a97fa983944709","repo":"apache/iceberg","slug":"unsupported-type-primitive-31a97f","errorCode":null,"errorMessage":"Unsupported type: ${primitive}","messagePattern":"Unsupported type: (.+?)","errorType":"exception","errorClass":"java.lang.UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"spark/v3.5/spark/src/main/java/org/apache/iceberg/spark/data/SparkParquetReaders.java","lineNumber":279,"sourceCode":"          } else {\n            return new UnboxedReader<>(desc);\n          }\n        case FLOAT:\n          if (expected != null && expected.typeId() == TypeID.DOUBLE) {\n            return new FloatAsDoubleReader(desc);\n          } else {\n            return new UnboxedReader<>(desc);\n          }\n        case BOOLEAN:\n        case INT64:\n        case DOUBLE:\n          return new UnboxedReader<>(desc);\n        case INT96:\n          // Impala & Spark used to write timestamps as INT96 without a logical type. For backwards\n          // compatibility we try to read INT96 as timestamps.\n          return ParquetValueReaders.int96Timestamps(desc);\n        default:\n          throw new UnsupportedOperationException(\"Unsupported type: \" + primitive);\n      }\n    }\n\n    protected MessageType type() {\n      return type;\n    }\n  }\n\n  private static class BinaryDecimalReader extends PrimitiveReader<Decimal> {\n    private final int scale;\n\n    BinaryDecimalReader(ColumnDescriptor desc, int scale) {\n      super(desc);\n      this.scale = scale;\n    }\n\n    @Override\n    public Decimal read(Decimal ignored) {","sourceCodeStart":261,"sourceCodeEnd":297,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/spark/v3.5/spark/src/main/java/org/apache/iceberg/spark/data/SparkParquetReaders.java#L261-L297","documentation":"The Iceberg Spark Parquet reader throws this when it encounters a physical Parquet primitive type it does not know how to read. All standard types (BOOLEAN, INT32, INT64, FLOAT, DOUBLE, BINARY, FIXED_LEN_BYTE_ARRAY) plus the legacy INT96 timestamp format are handled; the default branch fires for any remaining/unusual type value, often meaning a corrupted or nonstandard schema.","triggerScenarios":"A Spark query reads Parquet data whose schema contains a primitive type outside the reader's exhaustive switch — realistically only possible with a corrupted/forward-incompatible file or an exotic future Parquet type added to the parquet-mckel enumeration but not yet mapped by Iceberg.","commonSituations":"Files produced by a newer Parquet library introducing a new primitive type not yet supported by the Iceberg version in use; corrupted metadata; custom parquet-mckel builds.","solutions":["Upgrade Iceberg (and its bundled parquet-mckel) to a version supporting the new primitive type","Inspect the file schema with parquet-tools to identify the offending column and rewrite the file with standard types","Confirm the file is not corrupted by re-downloading or re-exporting the data","If a new type must be read immediately, convert it to a supported type in a pre-processing job"],"exampleFix":"// before: reading a file with an unmapped primitive type with an old Iceberg build\nspark.read.format(\"iceberg\").load(\"db.table\") // throws\n// after: upgrade the Iceberg runtime\n// build.gradle: implementation 'org.apache.iceberg:iceberg-spark-runtime-3.5_2.13:<newer-version>'","handlingStrategy":"try-catch","validationCode":"// Inspect file schema before the query\n// parquet-tools schema file.parquet\n// Fail fast on nonstandard primitive types (anything beyond BOOLEAN..FIXED_LEN_BYTE_ARRAY, INT96)","typeGuard":null,"tryCatchPattern":"try {\n  spark.read.format(\"iceberg\").load(\"db.table\").collect();\n} catch (UnsupportedOperationException e) {\n  if (e.getMessage().startsWith(\"Unsupported type:\")) {\n    // fall back to a non-vectorized/converted read path or repair the files\n  } else throw e;\n}","preventionTips":["Keep the Iceberg runtime current relative to the parquet-mckel version producing files","Validate external Parquet files' schemas before registering them","Monitor for files written by unusual tools and re-export them with standard types"],"tags":["parquet","spark","unsupported-type","reader"],"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"}