Add case-heavy LEFT JOIN benchmark and debug timing/logging for PushDownFilter hot paths#20664
Draft
kosiew wants to merge 4 commits intoapache:mainfrom
Draft
Add case-heavy LEFT JOIN benchmark and debug timing/logging for PushDownFilter hot paths#20664kosiew wants to merge 4 commits intoapache:mainfrom
kosiew wants to merge 4 commits intoapache:mainfrom
Conversation
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.
Which issue does this PR close?
Rationale for this change
The
PushDownFilteroptimizer rule shows a severe planner-time performance pathology in thesql_planner_extendedbenchmark, where profiling indicates it dominates total planning CPU time and repeatedly recomputes expression types.This PR adds a deterministic, CASE-heavy LEFT JOIN benchmark to reliably reproduce the worst-case behavior and introduces lightweight debug-only timing + counters inside
push_down_filterto make it easier to pinpoint expensive sub-sections (e.g. predicate simplification and join predicate inference) during profiling.What changes are included in this PR?
Benchmark: add a deterministic CASE-heavy LEFT JOIN workload
Adds
build_case_heavy_left_join_queryand helpers to construct a CASE-nested predicate chain over aLEFT JOIN.Adds a new benchmark
logical_plan_optimize_case_heavy_left_jointo stress planning/optimization time.Adds an A/B benchmark group
push_down_filter_case_heavy_left_join_abthat sweeps predicate counts and CASE depth, comparing:push_down_filterenabledpush_down_filterremovedOptimizer instrumentation (debug-only)
Adds a small
with_debug_timinghelper gated bylog_enabled!(Debug)to record microsecond timings for specific sections.Instruments and logs:
infer_join_predicatessimplify_predicateson_filters, inferred join predicatesAre these changes tested?
No new unit/integration tests were added because this PR is focused on benchmarking and debug-only instrumentation rather than changing optimizer semantics.
Coverage is provided by:
sql_planner_extendedbenchmarkpush_down_filter) produce optimized plans without errorsRUST_LOG=debugto confirm timing sections and counters emit as expectedAre there any user-facing changes?
RUST_LOGenables Debug for the relevant modules).LLM-generated code disclosure
This PR includes LLM-generated code and comments. All LLM-generated content has been manually reviewed and tested.