File tree Expand file tree Collapse file tree 4 files changed +35
-9
lines changed
optimizer/src/simplify_expressions Expand file tree Collapse file tree 4 files changed +35
-9
lines changed Original file line number Diff line number Diff line change @@ -510,6 +510,15 @@ See [`sort_tpch.rs`](src/sort_tpch.rs) for more details.
510510./bench.sh run sort_tpch
511511```
512512
513+ ### TopK TPCH
514+
515+ In addition, topk_tpch is available from the bench.sh script:
516+
517+ ``` bash
518+ ./bench.sh run topk_tpch
519+ ```
520+
521+
513522## IMDB
514523
515524Run Join Order Benchmark (JOB) on IMDB dataset.
Original file line number Diff line number Diff line change @@ -236,6 +236,10 @@ main() {
236236 # same data as for tpch
237237 data_tpch " 1"
238238 ;;
239+ topk_tpch)
240+ # same data as for tpch
241+ data_tpch " 1"
242+ ;;
239243 * )
240244 echo " Error: unknown benchmark '$BENCHMARK ' for data generation"
241245 usage
@@ -361,6 +365,9 @@ main() {
361365 sort_tpch)
362366 run_sort_tpch
363367 ;;
368+ topk_tpch)
369+ run_topk_tpch
370+ ;;
364371 * )
365372 echo " Error: unknown benchmark '$BENCHMARK ' for run"
366373 usage
@@ -981,6 +988,16 @@ run_sort_tpch() {
981988 debug_run $CARGO_COMMAND --bin dfbench -- sort-tpch --iterations 5 --path " ${TPCH_DIR} " -o " ${RESULTS_FILE} "
982989}
983990
991+ # Runs the sort tpch integration benchmark with limit 100 (topk)
992+ run_topk_tpch () {
993+ TPCH_DIR=" ${DATA_DIR} /tpch_sf1"
994+ RESULTS_FILE=" ${RESULTS_DIR} /run_topk_tpch.json"
995+ echo " RESULTS_FILE: ${RESULTS_FILE} "
996+ echo " Running topk tpch benchmark..."
997+
998+ $CARGO_COMMAND --bin dfbench -- sort-tpch --iterations 5 --path " ${TPCH_DIR} " -o " ${RESULTS_FILE} " --limit 100
999+ }
1000+
9841001
9851002compare_benchmarks () {
9861003 BASE_RESULTS_DIR=" ${SCRIPT_DIR} /results"
Original file line number Diff line number Diff line change @@ -436,11 +436,11 @@ impl LogicalPlan {
436436 filters. apply_elements ( f)
437437 }
438438 LogicalPlan :: Unnest ( unnest) => {
439- let columns = unnest. exec_columns . clone ( ) ;
440-
441- let exprs = columns
439+ let exprs = unnest
440+ . exec_columns
442441 . iter ( )
443- . map ( |c| Expr :: Column ( c. clone ( ) ) )
442+ . cloned ( )
443+ . map ( Expr :: Column )
444444 . collect :: < Vec < _ > > ( ) ;
445445 exprs. apply_elements ( f)
446446 }
Original file line number Diff line number Diff line change @@ -39,10 +39,10 @@ impl TreeNodeRewriter for ShortenInListSimplifier {
3939 // if expr is a single column reference:
4040 // expr IN (A, B, ...) --> (expr = A) OR (expr = B) OR (expr = C)
4141 if let Expr :: InList ( InList {
42- expr,
43- list,
42+ ref expr,
43+ ref list,
4444 negated,
45- } ) = expr. clone ( )
45+ } ) = expr
4646 {
4747 if !list. is_empty ( )
4848 && (
@@ -57,7 +57,7 @@ impl TreeNodeRewriter for ShortenInListSimplifier {
5757 {
5858 let first_val = list[ 0 ] . clone ( ) ;
5959 if negated {
60- return Ok ( Transformed :: yes ( list. into_iter ( ) . skip ( 1 ) . fold (
60+ return Ok ( Transformed :: yes ( list. iter ( ) . skip ( 1 ) . cloned ( ) . fold (
6161 ( * expr. clone ( ) ) . not_eq ( first_val) ,
6262 |acc, y| {
6363 // Note that `A and B and C and D` is a left-deep tree structure
@@ -81,7 +81,7 @@ impl TreeNodeRewriter for ShortenInListSimplifier {
8181 } ,
8282 ) ) ) ;
8383 } else {
84- return Ok ( Transformed :: yes ( list. into_iter ( ) . skip ( 1 ) . fold (
84+ return Ok ( Transformed :: yes ( list. iter ( ) . skip ( 1 ) . cloned ( ) . fold (
8585 ( * expr. clone ( ) ) . eq ( first_val) ,
8686 |acc, y| {
8787 // Same reasoning as above
You can’t perform that action at this time.
0 commit comments