apache/druid · error · RE

Unknown 'DECIMAL' type supplied to primitive conversion

Error message

Unknown 'DECIMAL' type supplied to primitive conversion: %s (this should never happen)

What it means

Internal exhaustiveness error in ParquetGroupConverter.convertPrimitiveField's DECIMAL branch: the parquet primitive type of a decimal column was something other than INT32, INT64, BINARY, or FIXED_LEN_BYTE_ARRAY, which parquet schema rules should make impossible — hence 'this should never happen'. It signals an unexpected/corrupt schema or a parquet-library version mismatch.

Solutions

  1. Inspect the parquet schema of the offending file to confirm the decimal's physical type.
  2. Upgrade/align the parquet-extensions and parquet-mr library versions.
  3. Exclude the malformed file or re-write it with a standard decimal physical type.
Defensive patterns

Strategy: type-guard

When it happens

Trigger: Thrown at extensions-core/parquet-extensions/src/main/java/org/apache/druid/data/input/parquet/simple/ParquetGroupConverter.java:441 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of apache/druid@9b90983fd2 (2026-09-07). Data as JSON: /api/errors/249b6413d039aa69. Report an issue: GitHub.

Appendix: source

Thrown at extensions-core/parquet-extensions/src/main/java/org/apache/druid/data/input/parquet/simple/ParquetGroupConverter.java:441

                the unscaled value should be used.
           */
            int precision = pt.asPrimitiveType().getDecimalMetadata().getPrecision();
            int scale = pt.asPrimitiveType().getDecimalMetadata().getScale();
            switch (pt.getPrimitiveTypeName()) {
              case INT32:
                // The primitive returned from Group is an unscaledValue.
                // We need to do unscaledValue * 10^(-scale) to convert back to decimal
                return new BigDecimal(g.getInteger(fieldIndex, index)).movePointLeft(scale);
              case INT64:
                // The primitive returned from Group is an unscaledValue.
                // We need to do unscaledValue * 10^(-scale) to convert back to decimal
                return new BigDecimal(g.getLong(fieldIndex, index)).movePointLeft(scale);
              case FIXED_LEN_BYTE_ARRAY:
              case BINARY:
                Binary value = g.getBinary(fieldIndex, index);
                return convertBinaryToDecimal(value, precision, scale);
              default:
                throw new RE(
                    "Unknown 'DECIMAL' type supplied to primitive conversion: %s (this should never happen)",
                    pt.getPrimitiveTypeName()
                );
            }
          case UTF8:
          case ENUM:
          case JSON:
            return g.getString(fieldIndex, index);
          case LIST:
          case MAP:
          case MAP_KEY_VALUE:
          case BSON:
          default:
            throw new RE(
                "Non-primitive supplied to primitive conversion: %s (this should never happen)",
                ot.name()
            );
        }

View on GitHub (pinned to 9b90983fd2)