prestodb/presto · error · PrestoException

NOT_SUPPORTED

NOT_SUPPORTED

Error message

Could not read unscaled value into a short decimal from column 

What it means

FixedLenByteArrayShortDecimalPlainValuesDecoder stores fixed-length BINARY decimals as short decimals; a short decimal must fit in 8 bytes, so values longer than 8 bytes must be sign-extension padding. checkBytesFitInShortDecimal checks that all high bytes equal the sign bit; if any middle byte differs from the expected sign-extension byte, the value does not fit a short decimal and a PrestoException (NOT_SUPPORTED) is thrown naming the column descriptor.

Source

Thrown at presto-parquet/src/main/java/com/facebook/presto/parquet/batchreader/decoders/plain/FixedLenByteArrayShortDecimalPlainValuesDecoder.java:73

        int extraBytesLength = typeLength - Long.BYTES;
        byte[] inputBytes = input.getByteArray();
        int inputBytesOffset = input.getByteArrayOffset();
        for (int i = offset; i < offset + length; i++) {
            checkBytesFitInShortDecimal(inputBytes, inputBytesOffset, extraBytesLength, columnDescriptor);
            values[i] = getShortDecimalValue(inputBytes, inputBytesOffset + extraBytesLength, Long.BYTES);
            inputBytesOffset += typeLength;
        }
        input.skip(length * typeLength);
    }

    public static void checkBytesFitInShortDecimal(byte[] bytes, int offset, int length, ColumnDescriptor descriptor)
    {
        int endOffset = offset + length;
        // Equivalent to expectedValue = bytes[endOffset] < 0 ? -1 : 0
        byte expectedValue = (byte) (bytes[endOffset] >> 7);
        for (int i = offset; i < endOffset; i++) {
            if (bytes[i] != expectedValue) {
                throw new PrestoException(NOT_SUPPORTED, "Could not read unscaled value into a short decimal from column " + descriptor);
            }
        }
    }

    @Override
    public void skip(int length)
    {
        checkArgument(length >= 0, "invalid length %s", length);
        input.skip(length * typeLength);
    }

    @Override
    public long getRetainedSizeInBytes()
    {
        return INSTANCE_SIZE;
    }
}

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Confirm the column's DECIMAL precision in the Parquet schema; if > 18, read it as a long decimal
  2. Re-map the column type in the connector/table definition so wide decimals use the long-decimal decoder
  3. Rewrite the file with precision <= 18 after verifying values fit in 64 bits
  4. If the value truly overflows 64 bits, the short-decimal representation is impossible — change the target type, not the file

Example fix

// before: reading DECIMAL(25,0) FLBA column through the short-decimal decoder
// after: declare/read the column as DECIMAL(25,0) so the long-decimal path is used
//   CREATE TABLE t (col DECIMAL(25,0));
Defensive patterns

Strategy: validation

Validate before calling

// If the FLBA length > 8, values must be sign-extended small decimals; verify declared precision:
// prec <= 18 required for the short-decimal path
// parquet-tools schema file.parquet | grep DECIMAL

Type guard

boolean flbaFitsShortDecimal(int fixedLenBytes) { return fixedLenBytes <= 8; }

Try / catch

try {
    decoder.readNext(length);
} catch (PrestoException e) {
    if (e.getErrorCode() == NOT_SUPPORTED && e.getMessage().contains("Could not read unscaled value into a short decimal")) {
        // re-read column with long-decimal decoder
    }
    throw e;
}

Prevention

When it happens

Trigger: readNext() -> checkBytesFitInShortDecimal on a fixed-length byte array longer than 8 bytes where bytes[0..endOffset) are not all equal to the sign-extension value, i.e. the unscaled decimal magnitude exceeds 64 bits.

Common situations: DECIMAL(19+) fixed-length columns read as short decimal; a genuinely large unscaled value (e.g. 10^20) stored in a file whose schema claims short precision; schema drift between file annotation and table definition.

Understand the failure class

Background: Presto NOT_SUPPORTED error: what "not supported" means and how to fix it — this error's family across 3 libraries.

Related errors


AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04). Data as JSON: /api/errors/75091c2fe3c10f8e. Report an issue: GitHub.