prestodb/presto · error · IllegalArgumentException

Unsupported frame end type:

Error message

Unsupported frame end type: 

What it means

Same family as 2375 but for the frame end boundary: the switch on frameInfo.getEndType() only accepts UNBOUNDED_FOLLOWING, PRECEDING, CURRENT_ROW, and FOLLOWING; the default branch throws because UNBOUNDED_PRECEDING is not a valid frame end. Note the message text uses getStartType() — a message-content quirk in this code.

Source

Thrown at presto-main-base/src/main/java/com/facebook/presto/operator/window/WindowPartition.java:392

        int frameEnd;
        switch (frameInfo.getEndType()) {
            case UNBOUNDED_FOLLOWING:
                frameEnd = partitionEnd - partitionStart - 1;
                break;
            case CURRENT_ROW:
                frameEnd = peerGroupEnd - partitionStart - 1;
                break;
            case PRECEDING:
                // note: this is the only case where frameEnd might get out of partition bound
                frameEnd = getFrameEndPreceding(recentRange.getEnd(), frameInfo, endComparator);
                break;
            case FOLLOWING:
                frameEnd = getFrameEndFollowing(recentRange.getEnd(), frameInfo, endComparator);
                break;
            default:
                // end type cannot be UNBOUNDED_PRECEDING
                throw new IllegalArgumentException("Unsupported frame end type: " + frameInfo.getStartType());
        }

        return new Range(frameStart, frameEnd);
    }

    private int getFrameStartPreceding(int recent, FrameInfo frameInfo, PagesIndexComparator comparator)
    {
        int sortKeyChannel = frameInfo.getSortKeyChannelForStartComparison();
        Ordering ordering = frameInfo.getOrdering().get();

        // If the recent frame start points at a null, it means that we are now processing first non-null position.
        // For frame start "X PRECEDING", the frame starts at the first null for all null values, and it never includes nulls for non-null values.
        if (pagesIndex.isNull(frameInfo.getSortKeyChannel(), partitionStart + recent)) {
            return currentPosition - partitionStart;
        }

        return seek(
                comparator,

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Use only valid frame ends in OVER clauses: CURRENT ROW, <n> PRECEDING/FOLLOWING, or UNBOUNDED FOLLOWING.
  2. Validate FrameInfo endType in custom code before execution.
  3. File a bug with the plan if hit on stock build.
Defensive patterns

Strategy: validation

Validate before calling

-- valid frame ends only: CURRENT ROW, <n> PRECEDING/FOLLOWING, UNBOUNDED FOLLOWING
SELECT sum(x) OVER (ORDER BY t ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) FROM tab;

Prevention

When it happens

Trigger: A FrameInfo with endType UNBOUNDED_PRECEDING or unknown end type reaching getFrameRange — only via internal/planner bugs or hand-built FrameInfo.

Common situations: Internal bugs where frame analysis permits an invalid end type; custom window-operator construction.

Related errors


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