fix(sql): limited subqueries within a union not skipping rows correctly#6395
fix(sql): limited subqueries within a union not skipping rows correctly#6395bluestreak01 merged 3 commits intomasterfrom
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the WalkthroughThis PR fixes incorrect LIMIT result handling when negative LIMIT values are used within subqueries and UNION operations. A state management issue in LimitRecordCursorFactory is addressed by resetting skipToRows to -1 after row skipping, and a corresponding test validates the fix. Changes
Sequence DiagramsequenceDiagram
participant Cursor as LimitRecordCursor
participant SkipRows as skipRows()
Cursor->>SkipRows: skipRows(skippedRows)
Note over SkipRows: May modify skipToRows<br/>during execution
SkipRows-->>Cursor: Returns control
rect rgb(240, 248, 255)
Note over Cursor: FIX: Reset state
Cursor->>Cursor: skipToRows = -1
end
Note over Cursor: State preserved for<br/>negative limit handling
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes
Areas requiring attention:
Suggested reviewers
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
core/src/main/java/io/questdb/griffin/engine/LimitRecordCursorFactory.java
Show resolved
Hide resolved
|
@CodeRabbit review |
✅ Actions performedReview triggered.
|
[PR Coverage check]😍 pass : 1 / 1 (100.00%) file detail
|
Fixes #6381
There are some conditions within the
Limitfactory that interplay strangely. In need of a second pair of eyes 👀