prestodb/presto · error · IllegalArgumentException

Only bigint, integer and varchar blocks are supported

Error message

Only bigint, integer and varchar blocks are supported

What it means

ThriftIndexedTpchService.blockAsList() converts a Presto Block column into a Java list for the Thrift testing server, but only supports bigint, integer, and varchar block types. Any other type (e.g., double, date, arrays) reaches the else branch and throws IllegalArgumentException. This is a deliberate limitation of the in-memory TPCH test service, not the production Thrift connector.

Source

Thrown at presto-thrift-testing-server/src/main/java/com/facebook/presto/connector/thrift/server/ThriftIndexedTpchService.java:190

            for (int index = begin; index < end; index++) {
                if (nulls != null && nulls[index]) {
                    result.add(null);
                }
                else {
                    checkArgument(sizes != null, "block structure is incorrect");
                    if (sizes[index] == 0) {
                        result.add("");
                    }
                    else {
                        checkArgument(bytes != null);
                        result.add(new String(bytes, startOffset, sizes[index]));
                        startOffset += sizes[index];
                    }
                }
            }
        }
        else {
            throw new IllegalArgumentException("Only bigint, integer and varchar blocks are supported");
        }
        return result;
    }

    private static List<Integer> computeRemap(List<String> startSchema, List<String> endSchema)
    {
        ImmutableList.Builder<Integer> builder = ImmutableList.builder();
        for (String columnName : endSchema) {
            int index = startSchema.indexOf(columnName);
            checkArgument(index != -1, "Column name in end that is not in the start: %s", columnName);
            builder.add(index);
        }
        return builder.build();
    }
}

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Restrict test queries to bigint, integer, and varchar columns
  2. Extend blockAsList() with a case for the needed Type (and its read path) and add a test
  3. Switch the column to a supported type in the test schema
  4. Use a different connector/service if non-primitive types are required

Example fix

// before
} else {
    throw new IllegalArgumentException("Only bigint, integer and varchar blocks are supported");
}
// after
} else if (blockType == DOUBLE) {
    // handle double blocks
} else {
    throw new IllegalArgumentException("Only bigint, integer, double and varchar blocks are supported");
}
Defensive patterns

Strategy: validation

Validate before calling

Type type = block.getType();
if (!type.equals(BIGINT) && !type.equals(INTEGER) && !type.equals(VARCHAR)) {
    throw new IllegalArgumentException("unsupported type for thrift test server: " + type);
}

Type guard

boolean isSupportedBlockType(Type t) {
    return t.equals(BIGINT) || t.equals(INTEGER) || t.equals(VARCHAR);
}

Prevention

When it happens

Trigger: Querying the thrift testing server (ThriftIndexedTpchService) with a query that selects or indexes on a column whose block type is not bigint, integer, or varchar.

Common situations: Test queries adding non-supported column types to a TPCH table; new columns/types added to the test schema without extending blockAsList; framework changes passing differently-typed blocks.

Related errors


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