-
Notifications
You must be signed in to change notification settings - Fork 279
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cherry pick stats related fix to 1.2-dev #17052
Merged
Merged
Conversation
This file contains 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
fix some little bug of stats Approved by: @zhangxu19830126, @triump2020, @ouyuanning
fix stats for runtime filter in some cases ___ ### **PR Type** Bug fix ___ ### **Description** - Added calls to `recalcStatsByRuntimeFilter` in various functions to ensure stats are recalculated after applying runtime filters. - Refactored `recalcStatsByRuntimeFilter` to use `builder` for selectivity calculation instead of passing `runtimeFilterSel`. - Adjusted stats recalculation logic for scan and join nodes in `recalcStatsByRuntimeFilter`. ___ ### **Changes walkthrough** 📝 <table><thead><tr><th></th><th align="left">Relevant files</th></tr></thead><tbody><tr><td><strong>Bug fix </strong></td><td><table> <tr> <td> <details> <summary><strong>apply_indices.go</strong><dd><code>Add stats recalculation for runtime filter in applyIndicesForJoins</code></dd></summary> <hr> pkg/sql/plan/apply_indices.go <li>Added call to <code>recalcStatsByRuntimeFilter</code> after appending runtime <br>filter to <code>RuntimeFilterBuildList</code>.<br> </details> </td> <td><a href="https://github.com/matrixorigin/matrixone/pull/16491/files#diff-b92e434ebc0c08092943a8c5a8abaed315f3e5722db3ffde4e3fbbb878d325b2">+1/-0</a> </td> </tr> <tr> <td> <details> <summary><strong>build_constraint_util.go</strong><dd><code>Add stats recalculation for runtime filter in build constraint utility</code></dd></summary> <hr> pkg/sql/plan/build_constraint_util.go <li>Added call to <code>recalcStatsByRuntimeFilter</code> in <code>appendPrimaryConstrantPlan</code> <br>function.<br> </details> </td> <td><a href="https://github.com/matrixorigin/matrixone/pull/16491/files#diff-6eb56175b52eb3302f1d9ae1cde88ced82c25bb8dd90562238cc8d9757adb76b">+2/-0</a> </td> </tr> <tr> <td> <details> <summary><strong>build_dml_util.go</strong><dd><code>Add stats recalculation for runtime filter in DML utility</code></dd></summary> <hr> pkg/sql/plan/build_dml_util.go <li>Added call to <code>recalcStatsByRuntimeFilter</code> in <code>appendDeleteIndexTablePlan</code> <br>function.<br> </details> </td> <td><a href="https://github.com/matrixorigin/matrixone/pull/16491/files#diff-095fb233d51021791cb24454839b013236680bbc6bbc22e0d2f6741ac8fe7dff">+1/-0</a> </td> </tr> <tr> <td> <details> <summary><strong>runtime_filter.go</strong><dd><code>Update stats recalculation method calls in runtime filter</code></dd></summary> <hr> pkg/sql/plan/runtime_filter.go <li>Modified calls to <code>recalcStatsByRuntimeFilter</code> to use <code>builder</code> instead of <br><code>runtimeFilterSel</code>.<br> </details> </td> <td><a href="https://github.com/matrixorigin/matrixone/pull/16491/files#diff-597fe1a4b6c932d815482502c1ae60c5f8c69921e00b27dba2f5e4ea5b25b54b">+2/-3</a> </td> </tr> <tr> <td> <details> <summary><strong>stats.go</strong><dd><code>Refactor stats recalculation logic in stats utility</code> </dd></summary> <hr> pkg/sql/plan/stats.go <li>Refactored <code>recalcStatsByRuntimeFilter</code> to use <code>builder</code> for selectivity <br>calculation.<br> <li> Adjusted stats recalculation logic for scan and join nodes.<br> </details> </td> <td><a href="https://github.com/matrixorigin/matrixone/pull/16491/files#diff-3b3d55fa9884dcf8980f90043a05b26a04d0153ae89fcf032cec998752c0cafa">+11/-7</a> </td> </tr> </table></td></tr></tr></tbody></table> ___ > 💡 **PR-Agent usage**: >Comment `/help` on the PR to get a list of all available PR-Agent tools and their descriptions Approved by: @ouyuanning
由于索引表总是将主键序列化进去,导致ndv很高,索引表的过滤度估计严重错误,会导致优化器错判tp/ap语句 现在改成利用原始过滤条件的过滤度去计算prefix_eq函数的过滤度 Approved by: @aunjgr
badboynt1
requested review from
XuPeng-SH,
triump2020,
ouyuanning,
aunjgr,
qingxinhome and
zhangxu19830126
as code owners
June 21, 2024 01:50
ouyuanning
approved these changes
Jun 21, 2024
zhangxu19830126
approved these changes
Jun 21, 2024
triump2020
approved these changes
Jun 21, 2024
sukki37
approved these changes
Jun 21, 2024
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.
What type of PR is this?
Which issue(s) this PR fixes:
issue #16846
What this PR does / why we need it:
cherry pick stats related fix to 1.2-dev