prestodb/presto · error · PrestoException
GENERIC_INTERNAL_ERROR
GENERIC_INTERNAL_ERROR
Error message
RegExp type cannot be serialized
What it means
JoniRegexpType represents compiled regular expressions used internally by LIKE and regexp functions. Compiled regex objects have no serializable block representation, so createBlockBuilder always throws GENERIC_INTERNAL_ERROR with 'RegExp type cannot be serialized'. Reaching this means the engine attempted to materialize or store a REGEXP-typed value, which is unsupported.
Source
Thrown at presto-main-base/src/main/java/com/facebook/presto/type/JoniRegexpType.java:53
super(new TypeSignature(NAME), Regex.class);
}
@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();
}
@Override
public BlockBuilder createBlockBuilder(BlockBuilderStatus blockBuilderStatus, int expectedEntries, int expectedBytesPerEntry)
{
throw new PrestoException(GENERIC_INTERNAL_ERROR, "RegExp type cannot be serialized");
}
@Override
public BlockBuilder createBlockBuilder(BlockBuilderStatus blockBuilderStatus, int expectedEntries)
{
throw new PrestoException(GENERIC_INTERNAL_ERROR, "RegExp type cannot be serialized");
}
}
View on GitHub (pinned to 55bb57d202)
Solutions
- Do not select or store REGEXP-typed values; use them only as arguments to like/regexp functions
- Cast or restructure the query so the regexp is created inline (e.g. inside like()) instead of materialized
- If a plugin function returns REGEXP, change it to return VARCHAR
Example fix
// before
SELECT like('abc', REGEXP_LIKE_PATTERN('a.*')) -- trying to materialize a regexp value
// after
SELECT like('abc', 'a.*') -- pattern supplied inline as varchar Defensive patterns
Strategy: validation
Validate before calling
// Do not surface REGEXP-typed expressions in output/storage positions // SQL guard: check the expression type before selecting // DESCRIBE SELECT <expr>; -- must not show regexp in output columns
Try / catch
try {
return blockBuilderCreation(type);
} catch (PrestoException e) {
// GENERIC_INTERNAL_ERROR: opaque type (regexp/jsonpath) cannot be materialized
// rewrite query to keep the value inline in function arguments
throw e;
} Prevention
- Never SELECT, GROUP BY, or store REGEXP-typed values
- Create regexp patterns inline within like()/regexp functions
- Have custom functions return VARCHAR, not REGEXP
When it happens
Trigger: Any execution path that calls createBlockBuilder on JoniRegexpType, e.g. attempting to output, store, group by, or serialize a REGEXP value (a value of the internal regexp type) in a result set or exchange.
Common situations: Queries that try to SELECT a regexp constant or pass regexp values through connectors/JDBC; custom functions returning REGEXP; engine/plugin code that wrongly treats REGEXP as a storable type.
Related errors
- GENERIC_INTERNAL_ERROR
- GENERIC_INTERNAL_ERROR
- GENERIC_INTERNAL_ERROR
- GENERIC_INTERNAL_ERROR
- INVALID_FUNCTION_ARGUMENT
AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04).
Data as JSON: /api/errors/7f3a8ef45f671caf.
Report an issue: GitHub.