prestodb/presto · critical · PrestoException

GENERIC_INTERNAL_ERROR

GENERIC_INTERNAL_ERROR

Error message

CodePoints type cannot be serialized

What it means

CodePointsType does not support block serialization: its createBlockBuilder(expectedEntries, expectedBytesPerEntry) unconditionally throws GENERIC_INTERNAL_ERROR. CodePoints is an internal-only type (Java int[] underlying representation) and is not meant to cross the wire or be written to storage.

Source

Thrown at presto-main-base/src/main/java/com/facebook/presto/type/CodePointsType.java:40

import com.facebook.presto.spi.PrestoException;

import static com.facebook.presto.spi.StandardErrorCode.GENERIC_INTERNAL_ERROR;

public class CodePointsType
        extends AbstractPrimitiveType
{
    public static final CodePointsType CODE_POINTS = new CodePointsType();
    public static final String NAME = "CodePoints";

    protected CodePointsType()
    {
        super(new TypeSignature(NAME), int[].class);
    }

    @Override
    public BlockBuilder createBlockBuilder(BlockBuilderStatus blockBuilderStatus, int expectedEntries, int expectedBytesPerEntry)
    {
        throw new PrestoException(GENERIC_INTERNAL_ERROR, "CodePoints type cannot be serialized");
    }

    @Override
    public BlockBuilder createBlockBuilder(BlockBuilderStatus blockBuilderStatus, int expectedEntries)
    {
        throw new PrestoException(GENERIC_INTERNAL_ERROR, "CodePoints type cannot be serialized");
    }

    @Override
    public Object getObjectValue(SqlFunctionProperties properties, Block block, int position)
    {
        throw new UnsupportedOperationException();
    }

    @Override
    public void appendTo(Block block, int position, BlockBuilder blockBuilder)
    {
        throw new UnsupportedOperationException();

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Do not surface CodePoints-typed values in query output or connector schemas; convert to VARCHAR/BIGINT first.
  2. If hit inside the engine, treat as a bug and report with the query plan.
  3. Use the matching serde path expected for the type, or switch the column type to a serializable one.

Example fix

// before
outputTypes.add(CodePointsType.CODE_POINTS);
// after
outputTypes.add(VARCHAR); // materialize code points as text
Defensive patterns

Strategy: type-guard

Validate before calling

if (type instanceof CodePointsType) {
    throw new UnsupportedOperationException("CodePoints is not serializable; convert to VARCHAR first");
}

Type guard

boolean isSerializable(Type t) { return !(t instanceof CodePointsType); }

Try / catch

try { blockBuilder = type.createBlockBuilder(status, n); } catch (PrestoException e) { /* GENERIC_INTERNAL_ERROR: exclude non-serializable types from output schema */ }

Prevention

When it happens

Trigger: Any execution path that attempts to serialize a column of type CodePoints, e.g. writing results to a spill/storage format or exchanging them between stages.

Common situations: Custom connectors/functions that accidentally expose CodePoints columns, or engine-internal bugs where the type leaks into serializable output.

Related errors


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