prestodb/presto · error · PinotException
PINOT_QUERY_GENERATOR_FAILURE
PINOT_QUERY_GENERATOR_FAILURE
Error message
Limit not supported: Limit is not being pushed down
What it means
checkForValidLimit converts the plan's LIMIT into an int for the generated Pinot query. A limit of 0, negative, or above Integer.MAX_VALUE cannot be represented as a valid Pinot LIMIT clause, so the context throws PINOT_QUERY_GENERATOR_FAILURE indicating the limit is not being pushed down.
Source
Thrown at presto-pinot-toolkit/src/main/java/com/facebook/presto/pinot/query/PinotQueryGeneratorContext.java:210
{
checkSupported(!newOutputs.isEmpty(), "Missing output expression in Pinot query context");
return new PinotQueryGeneratorContext(
newSelections,
newOutputs,
from,
filter,
aggregations,
groupByColumns,
topNColumnInformationMap,
limit,
variablesInAggregation,
hiddenColumnSet);
}
private static int checkForValidLimit(long limit)
{
if (limit <= 0 || limit > Integer.MAX_VALUE) {
throw new PinotException(PINOT_QUERY_GENERATOR_FAILURE, Optional.empty(), "Limit " + limit + " not supported: Limit is not being pushed down");
}
return toIntExact(limit);
}
/**
* Apply limit to current context and return the updated context. Throws error for invalid operations.
*/
public PinotQueryGeneratorContext withLimit(long limit)
{
int intLimit = checkForValidLimit(limit);
checkSupported(!hasLimit(), "Limit already exists. Pinot doesn't support limit on top of another limit");
return new PinotQueryGeneratorContext(
selections,
outputs,
from,
filter,
aggregations,
groupByColumns,View on GitHub (pinned to 55bb57d202)
Solutions
- Replace the invalid LIMIT with a positive value <= 2147483647 (e.g. LIMIT 1000000).
- For 'fetch everything' semantics, omit the LIMIT and configure pinot.limit-large-for-segment / broker limits appropriately.
- If LIMIT 0 is intentional (metadata probe), run it against a different connector or handle it client-side without Pinot pushdown.
Example fix
// before SELECT * FROM events LIMIT 0; // after SELECT * FROM events LIMIT 1; // or a real positive limit
Defensive patterns
Strategy: validation
Validate before calling
long limit = requestedLimit;
if (limit <= 0 || limit > Integer.MAX_VALUE) {
throw new IllegalArgumentException("Limit not pushable to Pinot: " + limit);
} Prevention
- Never emit LIMIT 0 or negative limits toward Pinot tables.
- Cap programmatic limits at 2147483647; use a sane default like 10000.
- Use configured large-limit properties for 'fetch everything' semantics instead of giant LIMITs.
When it happens
Trigger: A LIMIT pushdown is attempted with limit <= 0 or limit > 2147483647, e.g. LIMIT 0 queries emitted by optimizers/BI tools, or huge limits like LIMIT 100000000000 used as 'fetch everything'.
Common situations: BI tools issuing LIMIT 0 for schema probes; ORM-generated queries with sentinel limits; queries using an enormous LIMIT to mean 'no limit' against a Pinot table.
Related errors
- INVALID_FUNCTION_ARGUMENT
- CLICKHOUSE_QUERY_GENERATOR_FAILURE
- DRUID_QUERY_GENERATOR_FAILURE
- PINOT_UNSUPPORTED_EXPRESSION
- PINOT_UNSUPPORTED_EXPRESSION
AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04).
Data as JSON: /api/errors/9fa22ed45c776108.
Report an issue: GitHub.