apache/iceberg · error · UnsupportedOperationException
Unsupported base type for decimal: {primitive.getPrimitiveTy
Error message
Unsupported base type for decimal: {primitive.getPrimitiveTypeName()} What it means
In SparkParquetReaders.primitive, decimal columns must be backed by FLBA (fixed_len_byte_array), INT64, or INT32 Parquet storage. If the underlying physical type of a decimal logical type is anything else, this UnsupportedOperationException is thrown because no decimal reader exists for that base type.
Source
Thrown at spark/v4.1/spark/src/main/java/org/apache/iceberg/spark/data/SparkParquetReaders.java:270
case DATE:
case INT_64:
return new UnboxedReader<>(desc);
case TIMESTAMP_MICROS:
case TIMESTAMP_MILLIS:
return ParquetValueReaders.timestamps(desc);
case DECIMAL:
DecimalLogicalTypeAnnotation decimal =
(DecimalLogicalTypeAnnotation) primitive.getLogicalTypeAnnotation();
switch (primitive.getPrimitiveTypeName()) {
case BINARY:
case FIXED_LEN_BYTE_ARRAY:
return new BinaryDecimalReader(desc, decimal.getScale());
case INT64:
return new LongDecimalReader(desc, decimal.getPrecision(), decimal.getScale());
case INT32:
return new IntegerDecimalReader(desc, decimal.getPrecision(), decimal.getScale());
default:
throw new UnsupportedOperationException(
"Unsupported base type for decimal: " + primitive.getPrimitiveTypeName());
}
case BSON:
return new ParquetValueReaders.ByteArrayReader(desc);
default:
throw new UnsupportedOperationException(
"Unsupported logical type: " + primitive.getOriginalType());
}
}
switch (primitive.getPrimitiveTypeName()) {
case FIXED_LEN_BYTE_ARRAY:
case BINARY:
if (expected != null && expected.typeId() == TypeID.UUID) {
return new UUIDReader(desc);
}
return new ParquetValueReaders.ByteArrayReader(desc);
case INT32:View on GitHub (pinned to 86d9c8fc54)
Solutions
- Rewrite the source Parquet files with a writer that uses FLBA/INT64/INT32 storage for decimals (e.g. rewrite_data_files).
- Verify the file's decimal encoding with parquet-tools and, if BINARY, convert the column (e.g. via Spark cast) before reading through Iceberg.
- Upgrade Iceberg — newer versions may add support for more decimal physical representations.
Defensive patterns
Strategy: validation
Validate before calling
// inspect physical encoding before reading // parquet-tools schema file.parquet | grep -B1 DECIMAL
Try / catch
try {
icebergTable.newScan().planFiles();
} catch (UnsupportedOperationException e) {
if (e.getMessage().contains("Unsupported base type for decimal")) {
// fall back to non-Iceberg read or rewrite the files
}
} Prevention
- Write Parquet with standard writers that store decimals as FLBA/INT64/INT32
- Check foreign files with parquet-tools before registering them with Iceberg
- Keep Iceberg upgraded to the latest patch release
When it happens
Trigger: Reading a Parquet file whose column has the DECIMAL logical type but a physical primitive type other than FIXED_LEN_BYTE_ARRAY, INT64, or INT32 (e.g. BINARY-backed decimal from some writers).
Common situations: Reading Parquet files produced by non-Iceberg writers (Hive, Impala, third-party tools) that store decimals in unusual physical encodings; mixed-writer tables.
Understand the failure class
Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.
Related errors
- Unsupported base type for decimal:
- Unsupported base type for decimal: ${primitive.getPrimitiveT
- Unsupported base type for decimal: ${primitiveTypeName}
- Unsupported base type for decimal: ${desc.getPrimitiveType()
- Unsupported base type for decimal: %s
AI-assisted analysis of apache/iceberg@86d9c8fc54 (2026-09-12).
Data as JSON: /api/errors/3f0915b7d4c4e887.
Report an issue: GitHub.