Skip to content

Commit 4718fa9

Browse files
Merge branch 'main' into aa/string_builder_char
2 parents 15f810c + 6cfdd59 commit 4718fa9

File tree

4 files changed

+35
-9
lines changed

4 files changed

+35
-9
lines changed

benchmarks/README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff 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

515524
Run Join Order Benchmark (JOB) on IMDB dataset.

benchmarks/bench.sh

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff 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

9851002
compare_benchmarks() {
9861003
BASE_RESULTS_DIR="${SCRIPT_DIR}/results"

datafusion/expr/src/logical_plan/tree_node.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff 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
}

datafusion/optimizer/src/simplify_expressions/inlist_simplifier.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff 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

0 commit comments

Comments
 (0)