prestodb/presto · error · IllegalArgumentException

isNull length is less than positionCount

Error message

isNull length is less than positionCount

What it means

validateConstructorArguments checks that the valueIsNull boolean array (after arrayOffset) covers positionCount entries; a shorter array cannot describe nullness for every position, so construction is rejected.

Source

Thrown at presto-common/src/main/java/com/facebook/presto/common/block/ArrayBlock.java:86

     */
    static ArrayBlock createArrayBlockInternal(int arrayOffset, int positionCount, @Nullable boolean[] valueIsNull, int[] offsets, Block values)
    {
        validateConstructorArguments(arrayOffset, positionCount, valueIsNull, offsets, values);
        return new ArrayBlock(arrayOffset, positionCount, valueIsNull, offsets, values);
    }

    private static void validateConstructorArguments(int arrayOffset, int positionCount, @Nullable boolean[] valueIsNull, int[] offsets, Block values)
    {
        if (arrayOffset < 0) {
            throw new IllegalArgumentException("arrayOffset is negative");
        }

        if (positionCount < 0) {
            throw new IllegalArgumentException("positionCount is negative");
        }

        if (valueIsNull != null && valueIsNull.length - arrayOffset < positionCount) {
            throw new IllegalArgumentException("isNull length is less than positionCount");
        }

        requireNonNull(offsets, "offsets is null");
        if (offsets.length - arrayOffset < positionCount + 1) {
            throw new IllegalArgumentException("offsets length is less than positionCount");
        }

        requireNonNull(values, "values is null");
    }

    /**
     * Use createArrayBlockInternal or fromElementBlock instead of this method.  The caller of this method is assumed to have
     * validated the arguments with validateConstructorArguments.
     */
    private ArrayBlock(int arrayOffset, int positionCount, @Nullable boolean[] valueIsNull, int[] offsets, Block values)
    {
        // caller must check arguments with validateConstructorArguments
        this.arrayOffset = arrayOffset;

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Ensure the valueIsNull array is sized at least arrayOffset + positionCount
  2. Fix the producer that sized the null mask incorrectly
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at presto-common/src/main/java/com/facebook/presto/common/block/ArrayBlock.java:86 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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