Repository navigation
Fix #5114: preserve head/TopK semantics for sort-expression pushdown - #5135
Conversation
📝 WalkthroughSummary by CodeRabbit
WalkthroughAdds an early-return in SortExprIndexScanRule to skip pushdown when the Sort is an instance of Changes
Sequence Diagram(s)mermaid Note: rectangles use default styling; interactions focus on primary components and decision branch. Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested labels
Suggested reviewers
🚥 Pre-merge checks | ✅ 3 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
No actionable comments were generated in the recent review. 🎉 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 |
|
@songkant-aws Please take a look. |
|
@penghuo LGTM. Approved with non-blocking nitty comment. |
Signed-off-by: Peng Huo <[email protected]>
Signed-off-by: Peng Huo <[email protected]>
Signed-off-by: Peng Huo <[email protected]>
Signed-off-by: Peng Huo <[email protected]>
* Struct return array value instead of string Signed-off-by: Heng Qian <[email protected]> * Support filter in GraphLookup Signed-off-by: Heng Qian <[email protected]> * Fix IT Signed-off-by: Heng Qian <[email protected]> * Add experimental tag in doc Signed-off-by: Heng Qian <[email protected]> * Increment version to 3.6.0-SNAPSHOT (#5115) Signed-off-by: opensearch-ci-bot <[email protected]> Co-authored-by: opensearch-ci-bot <[email protected]> * Fix fallback error handling to show original Calcite error (#5133) * Fix fallback error handling to show original Calcite error When Calcite falls back to V2 and V2 also fails, now correctly returns the original Calcite error instead of V2's generic "only supported when calcite enabled" message, improving error clarity for users. Fixes #5060. Co-Authored-By: Claude <[email protected]> Signed-off-by: Simeon Widdis <[email protected]> * coderabbit: preserve exception types Signed-off-by: Simeon Widdis <[email protected]> * Refactoring for coderabbit: consistent handling of calcite and legacy calcite errors Signed-off-by: Simeon Widdis <[email protected]> * Update explain error handling to match non-explain Signed-off-by: Simeon Widdis <[email protected]> * Minor tweaks: commenting & eval order Signed-off-by: Simeon Widdis <[email protected]> * Add a yaml test Signed-off-by: Simeon Widdis <[email protected]> --------- Signed-off-by: Simeon Widdis <[email protected]> Co-authored-by: Claude <[email protected]> * Add auto-extract mode for `spath` command (#5140) * Add auto extraction mode in spath command Signed-off-by: Chen Dai <[email protected]> * Change json_extract_all to return map<string,string> and fix null perserve issue Signed-off-by: Chen Dai <[email protected]> * Refactor all unit test and integration tests Signed-off-by: Chen Dai <[email protected]> * Refactor json_extract_all and fix stringify issue Signed-off-by: Chen Dai <[email protected]> * Fix broken IT and doctest Signed-off-by: Chen Dai <[email protected]> * Address PR comments Signed-off-by: Chen Dai <[email protected]> * Mark auto extract mode as experimental Signed-off-by: Chen Dai <[email protected]> --------- Signed-off-by: Chen Dai <[email protected]> * Add nomv command (#5130) * Add nomv command + parser/AST/calcite wiring + tests + docs Signed-off-by: Srikanth Padakanti <[email protected]> # Conflicts: # core/src/main/java/org/opensearch/sql/ast/analysis/FieldResolutionVisitor.java # integ-test/src/test/java/org/opensearch/sql/security/CalciteCrossClusterSearchIT.java # ppl/src/main/antlr/OpenSearchPPLParser.g4 # ppl/src/test/java/org/opensearch/sql/ppl/parser/FieldResolutionVisitorTest.java * Address coderrabbit suggestions. Signed-off-by: Srikanth Padakanti <[email protected]> * Correct the no_push_down yaml expected result Signed-off-by: Srikanth Padakanti <[email protected]> * Fix Windows CI: Override verifyPPLToSparkSQL to preserve ARRAY_JOIN '\n' delimiter Signed-off-by: Srikanth Padakanti <[email protected]> * Fix Windows CI: Override verifyPPLToSparkSQL to preserve ARRAY_JOIN '\n' delimiter Signed-off-by: Srikanth Padakanti <[email protected]> * Fix Windows CI: Override verifyPPLToSparkSQL to preserve ARRAY_JOIN '\n' delimiter Signed-off-by: Srikanth Padakanti <[email protected]> * Address code review comments Signed-off-by: Srikanth Padakanti <[email protected]> --------- Signed-off-by: Srikanth Padakanti <[email protected]> Co-authored-by: Srikanth Padakanti <[email protected]> * Fix #5114: preserve head/TopK semantics for sort-expression pushdown (#5135) * Fix bug 5114 Signed-off-by: Peng Huo <[email protected]> * Update Signed-off-by: Peng Huo <[email protected]> * Address comments Signed-off-by: Peng Huo <[email protected]> * Fix spotless import ordering for EnumerableLimitSort Signed-off-by: Peng Huo <[email protected]> --------- Signed-off-by: Peng Huo <[email protected]> * Fix path navigation on map columns for `spath` command (#5149) * Fix path navigation bug in qualified name resolver and add spath tests Signed-off-by: Chen Dai <[email protected]> * Add spath UT and IT with other commands Signed-off-by: Chen Dai <[email protected]> * Move aliasing logic from resolver to project item expansion Signed-off-by: Chen Dai <[email protected]> * Update javadoc and readme Signed-off-by: Chen Dai <[email protected]> --------- Signed-off-by: Chen Dai <[email protected]> * Make sql plugin aware of FIPS build param (-Pcrypto.standard=FIPS-140-3) (#5155) * Make sql plugin aware of FIPS build param (-Pcrypto.standard=FIPS-140-3) Signed-off-by: Craig Perkins <[email protected]> * Update build script to include FIPS-140-3 option Added FIPS-140-3 standard option to Gradle commands. Signed-off-by: Peter Zhu <[email protected]> --------- Signed-off-by: Craig Perkins <[email protected]> Signed-off-by: Peter Zhu <[email protected]> Co-authored-by: Peter Zhu <[email protected]> * [Maintenance] Fix bc-fips jar hell by marking dependency as compileOnly (#5158) * [maintenance] Fix bc-fips jar hell by marking dependency as compileOnly Signed-off-by: Jialiang Liang <[email protected]> * add fix for tests Signed-off-by: Jialiang Liang <[email protected]> --------- Signed-off-by: Jialiang Liang <[email protected]> * [Feature] PPL Command: MvExpand (#5144) * MvExpand new PR - After resolving the merge issues Signed-off-by: Srikanth Padakanti <[email protected]> # Conflicts: # core/src/main/java/org/opensearch/sql/analysis/Analyzer.java # core/src/main/java/org/opensearch/sql/ast/AbstractNodeVisitor.java # core/src/main/java/org/opensearch/sql/calcite/CalciteRelNodeVisitor.java # docs/category.json # docs/user/ppl/index.md # integ-test/src/test/java/org/opensearch/sql/calcite/CalciteNoPushdownIT.java # integ-test/src/test/java/org/opensearch/sql/calcite/remote/CalciteExplainIT.java # integ-test/src/test/java/org/opensearch/sql/ppl/NewAddedCommandsIT.java # integ-test/src/test/java/org/opensearch/sql/security/CalciteCrossClusterSearchIT.java # ppl/src/main/antlr/OpenSearchPPLParser.g4 # ppl/src/main/java/org/opensearch/sql/ppl/parser/AstBuilder.java # ppl/src/main/java/org/opensearch/sql/ppl/utils/PPLQueryDataAnonymizer.java # ppl/src/test/java/org/opensearch/sql/ppl/utils/PPLQueryDataAnonymizerTest.java * Address coderrabbit comments Signed-off-by: Srikanth Padakanti <[email protected]> * Address coderrabbit comments Signed-off-by: Srikanth Padakanti <[email protected]> * merge main to my branch Signed-off-by: Srikanth Padakanti <[email protected]> * Address corerabbit suggestions Signed-off-by: Srikanth Padakanti <[email protected]> * Address corerabbit suggestions Signed-off-by: Srikanth Padakanti <[email protected]> * ci: trigger Signed-off-by: Srikanth Padakanti <[email protected]> * ci: trigger Signed-off-by: Srikanth Padakanti <[email protected]> * Address corerabbit suggestions Signed-off-by: Srikanth Padakanti <[email protected]> * ci: trigger Signed-off-by: Srikanth Padakanti <[email protected]> * Address comments. Signed-off-by: Srikanth Padakanti <[email protected]> * Change the exception from illegalarg to SyntaxCheckException Signed-off-by: Srikanth Padakanti <[email protected]> * change the exception message for consistency Signed-off-by: Srikanth Padakanti <[email protected]> * ci: rerun Signed-off-by: Srikanth Padakanti <[email protected]> --------- Signed-off-by: Srikanth Padakanti <[email protected]> Co-authored-by: Srikanth Padakanti <[email protected]> * bump antlr version to 4.13.2 (#5159) * Address comments Signed-off-by: Heng Qian <[email protected]> --------- Signed-off-by: Heng Qian <[email protected]> Signed-off-by: opensearch-ci-bot <[email protected]> Signed-off-by: Simeon Widdis <[email protected]> Signed-off-by: Chen Dai <[email protected]> Signed-off-by: Srikanth Padakanti <[email protected]> Signed-off-by: Peng Huo <[email protected]> Signed-off-by: Craig Perkins <[email protected]> Signed-off-by: Peter Zhu <[email protected]> Signed-off-by: Jialiang Liang <[email protected]> Co-authored-by: opensearch-trigger-bot[bot] <98922864+opensearch-trigger-bot[bot]@users.noreply.github.com> Co-authored-by: opensearch-ci-bot <[email protected]> Co-authored-by: Simeon Widdis <[email protected]> Co-authored-by: Claude <[email protected]> Co-authored-by: Chen Dai <[email protected]> Co-authored-by: Srikanth Padakanti <[email protected]> Co-authored-by: Srikanth Padakanti <[email protected]> Co-authored-by: Peng Huo <[email protected]> Co-authored-by: Craig Perkins <[email protected]> Co-authored-by: Peter Zhu <[email protected]> Co-authored-by: Jialiang Liang <[email protected]> Co-authored-by: Eric Wei <[email protected]>
Description
Fix issue #5114 where
headcould be lost on sort-expression plans, returning more rows than requested (for example:source=... | eval a = rand() | sort a | fields id | head 5).The fix updates
SortExprIndexScanRuleto avoid rewritingCalciteEnumerableTopKpaths that carry fetch semantics, and keeps limit pushdown on the logical scan path only when limit/offset are available. This preserves TopK semantics while still allowing safe sort-expression pushdown.Related Issues
#5114
Check List
--signoffor-s.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.