Skip to content

Comments

Introduce LimitK optimization in TopK scenario when using window function.#17208

Open
Sh-Zh-7 wants to merge 4 commits intomasterfrom
perf/szh/window_func_limit_k_optimize
Open

Introduce LimitK optimization in TopK scenario when using window function.#17208
Sh-Zh-7 wants to merge 4 commits intomasterfrom
perf/szh/window_func_limit_k_optimize

Conversation

@Sh-Zh-7
Copy link
Contributor

@Sh-Zh-7 Sh-Zh-7 commented Feb 20, 2026

This PR optimize TopKRankingOperator into LimitKRankingOperator when user use PARTITION BY deivce ORDER BY time or PARTITION BY device ORDER BY time DESC.

Meanwhile, this PR also fix bugs when SortElimination.visitStreamSort eliminate sort when isOrderByAllIdsAndTime=true rather than checking sort order is consistent with scan order.

@codecov
Copy link

codecov bot commented Feb 20, 2026

Codecov Report

❌ Patch coverage is 61.17647% with 99 lines in your changes missing coverage. Please review.
✅ Project coverage is 39.54%. Comparing base (7e0837b) to head (c43e87a).

Files with missing lines Patch % Lines
...lan/relational/planner/node/LimitKRankingNode.java 40.81% 29 Missing ⚠️
...eryengine/plan/planner/TableOperatorGenerator.java 0.00% 25 Missing ⚠️
...operator/process/window/LimitKRankingOperator.java 84.81% 12 Missing ⚠️
...ngine/plan/planner/plan/node/PlanGraphPrinter.java 0.00% 11 Missing ⚠️
...ational/planner/optimizations/SortElimination.java 76.19% 5 Missing ⚠️
...relational/planner/optimizations/SymbolMapper.java 0.00% 5 Missing ⚠️
...planner/optimizations/UnaliasSymbolReferences.java 0.00% 5 Missing ⚠️
...e/plan/relational/planner/iterative/rule/Util.java 72.72% 3 Missing ⚠️
...nner/distribute/TableDistributedPlanGenerator.java 90.00% 2 Missing ⚠️
...eryengine/plan/planner/plan/node/PlanNodeType.java 50.00% 1 Missing ⚠️
... and 1 more
Additional details and impacted files
@@             Coverage Diff              @@
##             master   #17208      +/-   ##
============================================
+ Coverage     39.51%   39.54%   +0.03%     
  Complexity      282      282              
============================================
  Files          5101     5103       +2     
  Lines        341895   342133     +238     
  Branches      43525    43562      +37     
============================================
+ Hits         135085   135297     +212     
- Misses       206810   206836      +26     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@sonarqubecloud
Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
C Reliability Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant