fix(sql): not to ignore outer limit if a subquery has a filter and another limit#6533
Merged
bluestreak01 merged 3 commits intomasterfrom Dec 16, 2025
Merged
fix(sql): not to ignore outer limit if a subquery has a filter and another limit#6533bluestreak01 merged 3 commits intomasterfrom
bluestreak01 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 ✨ Finishing touches🧪 Generate unit tests (beta)
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 |
bluestreak01
approved these changes
Dec 15, 2025
Contributor
Author
[PR Coverage check]😍 pass : 8 / 9 (88.89%) file detail
|
mtopolnik
pushed a commit
that referenced
this pull request
Dec 16, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
If a query has multiple LIMIT clauses and one of them is in a subquery, the outer LIMIT is ignored.
For example, the below query returns 4 rows instead of 2:
This change fixes the problem.
It was tracked by the model if the limit has been implemented by a factory already.
It used a boolean, which did not allow for tracking multiple LIMIT clauses.
It is not the best choice to track this on the model anyway.
The LIMIT clause is represented by a node expression, which is copied to multiple places on the model tree.
It is better to track this on the node itself, and this way each LIMIT is tracked by the node which represents it in the model tree.
Also removed the
followedLimitAdvice()method fromRecordCursorFactory, it served the exact same purpose asimplementsLimit().required by https://github.com/questdb/questdb-enterprise/pull/828