Dandandan opened a new pull request, #27633:
URL: https://github.com/apache/datafusion/pull/27633

   ## Which issue does this PR close?
   
   Related to apache/datafusion#20686.
   
   ## Rationale for this change
   
   An inner equality join can constrain integer scan keys before execution by 
using exact statistics already available to the planner.
   
   ## What changes are included in this PR?
   
   Intersect exact key bounds through inner equijoins and add static filters on 
eligible inputs. Keep the original join conditions. Require a projected domain 
width reduction of at least one quarter. The earlier #20686 initialized a 
runtime build-side filter. This draft also follows equalities across nested 
joins and can restrict either input during planning.
   
   ## What is the testing strategy for this PR?
   
   Compare the original TPC-H and TPC-DS SF1 queries. Inspect the new 
predicates and compare result multisets on all five TPC-DS queries that 
admitted a filter. Include Q64 as a regression control.
   
   Independent release builds from `04b910869` on macOS arm64, using DuckDB 
1.4.1 SF1 Parquet data, upstream query files and ten target partitions. For 
each arm, five fresh processes ran the original query seven times each. Values 
are median warm SQL times in milliseconds, excluding the first execution of 
each process. Each independently built patch also completed all 22 TPC-H and 99 
TPC-DS queries with baseline row counts.
   
   | Query | Baseline ms | Candidate ms | Change |
   | --- | ---: | ---: | ---: |
   | TPC-DS Q2 | 36.70 | 30.20 | -17.7% |
   | TPC-DS Q58 | 32.20 | 31.70 | -1.6% |
   | TPC-DS Q59 | 50.80 | 43.90 | -13.6% |
   | TPC-DS Q64 | 186.60 | 173.80 | -6.9% |
   | TPC-DS Q83 | 18.20 | 16.90 | -7.1% |
   | TPC-H Q18 | 77.20 | 90.10 | +16.7% |
   
   The rule admitted filters on the five TPC-DS queries shown. No TPC-H query 
admitted a filter on this dataset. Q18 timing varied: a second run alternating 
arm order across ten processes per arm gave 118.43 ms baseline and 111.75 ms 
with the patch. TPC-H does not establish a performance benefit here.
   
   Reproduce a query from the benchmarks directory with:
   
   ```sh
   dfbench tpcds -p "$TPCDS_PARQUET" -Q ../datafusion/core/tests/tpc-ds -q 2 -n 
10 -i 7
   dfbench tpch -p "$TPCH_DATA" -f parquet -q 18 -n 10 -i 7
   ```
   
   ## Are there any user-facing changes?
   
   Eligible physical plans include additional integer predicates.
   
   Implementation and benchmark preparation were AI-assisted.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to