prestodb/presto · error · PrestoException
NOT_SUPPORTED
NOT_SUPPORTED
Error message
Offset support is not enabled
What it means
OFFSET clauses are gated behind a feature flag. When the optimizer rule ImplementOffset fires on an OffsetNode but the session has offset-clause support disabled, it throws NOT_SUPPORTED instead of planning the offset.
Source
Thrown at presto-main-base/src/main/java/com/facebook/presto/sql/planner/iterative/rule/ImplementOffset.java:82
private final StandardFunctionResolution functionResolution;
public ImplementOffset(FunctionAndTypeManager functionAndTypeManager)
{
requireNonNull(functionAndTypeManager, "functionAndTypeManager is null");
this.functionResolution = new FunctionResolution(functionAndTypeManager.getFunctionAndTypeResolver());
}
@Override
public Pattern<OffsetNode> getPattern()
{
return PATTERN;
}
@Override
public Result apply(OffsetNode parent, Captures captures, Context context)
{
if (!isOffsetClauseEnabled(context.getSession())) {
throw new PrestoException(NOT_SUPPORTED, "Offset support is not enabled");
}
VariableReferenceExpression rowNumberSymbol = context.getVariableAllocator().newVariable("row_number", BIGINT);
RowNumberNode rowNumberNode = new RowNumberNode(
parent.getSourceLocation(),
context.getIdAllocator().getNextId(),
parent.getSource(),
ImmutableList.of(),
rowNumberSymbol,
Optional.empty(),
false,
Optional.empty());
FilterNode filterNode = new FilterNode(
parent.getSourceLocation(),
context.getIdAllocator().getNextId(),
rowNumberNode,View on GitHub (pinned to 55bb57d202)
Solutions
- Enable the feature: SET SESSION offset_clause_enabled = true
- Add offset-clause-enabled=true to the coordinator's config.properties
- Rewrite the query using ROW_NUMBER() over an ordered subquery and filter row_number > offset
Example fix
// before SELECT * FROM t LIMIT 10 OFFSET 20; // after SELECT * FROM ( SELECT *, ROW_NUMBER() OVER () AS rn FROM t ) WHERE rn > 20 LIMIT 10;
Defensive patterns
Strategy: try-catch
Validate before calling
// check session property before issuing OFFSET query SHOW SESSION LIKE 'offset_clause_enabled';
Type guard
null
Try / catch
try {
return query("SELECT * FROM t LIMIT 10 OFFSET 20");
} catch (PrestoException e) {
if (e.getErrorCode() == NOT_SUPPORTED.toErrorCode()) {
return query("SELECT * FROM (SELECT *, ROW_NUMBER() OVER () rn FROM t) WHERE rn > 20 LIMIT 10");
}
throw e;
} Prevention
- Enable offset-clause-enabled=true in cluster config before using OFFSET
- Avoid OFFSET in queries meant to run on clusters with feature flags off
- Prefer keyset pagination over OFFSET for deep pagination anyway
When it happens
Trigger: Executing a query with OFFSET (e.g. LIMIT 10 OFFSET 5) while the 'offset-clause-enabled' session property or config is false.
Common situations: Running OFFSET queries on a deployment where the feature flag was never enabled; upgrading Presto but not enabling the experimental flag; copy-pasting queries from a cluster where the flag is on.
Understand the failure class
Background: Presto NOT_SUPPORTED error: what "not supported" means and how to fix it — this error's family across 3 libraries.
Related errors
AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04).
Data as JSON: /api/errors/6204f3e689bdcbae.
Report an issue: GitHub.