Skip to content

Apache DataFusion SQL Query Engine

bench: add hj queries for partitioned joins on dense and sparse integer keys (#27090)

Adrian Garcia Badaracco70f2ed01b839
diff --git a/benchmarks/src/hj.rs b/benchmarks/src/hj.rs
index 2afd8ce3b8..2410e9d975 100644
--- a/benchmarks/src/hj.rs
+++ b/benchmarks/src/hj.rs
@@ -505,6 +505,32 @@ const HASH_QUERIES: &[HashJoinQuery] = &[
probe_size: "240K_multi_key_count",
isolate_partitioned_join: true,
},
+ // Q26: Partitioned join on dense integer keys
+ // Build Side: orders of the first 40K customers (~270K rows, ~27K distinct
+ // dense keys, ~10 rows per key) | Probe Side: orders (15M rows), ~2.7% hit
+ // rate. The probe keys are not sorted, so statistics prune nothing.
+ HashJoinQuery {
+ sql: r###"SELECT count(*)
+ FROM (SELECT o_custkey as k FROM orders WHERE o_custkey <= 40000) b
+ JOIN (SELECT o_custkey as k FROM orders) p ON b.k = p.k"###,
+ density: 1.0,
+ prob_hit: 0.027,
+ build_size: "270K_dense_keys",
+ probe_size: "15M",
+ isolate_partitioned_join: true,
+ },
+ // Q27: Q26 with sparse integer keys: a similar build size and hit rate,
+ // with keys 37 apart.
+ HashJoinQuery {
+ sql: r###"SELECT count(*)
+ FROM (SELECT o_custkey as k FROM orders WHERE o_custkey % 37 = 0) b
+ JOIN (SELECT o_custkey as k FROM orders) p ON b.k = p.k"###,
+ density: 0.027,
+ prob_hit: 0.027,
+ build_size: "270K_sparse_keys",
+ probe_size: "15M",
+ isolate_partitioned_join: true,
+ },
];
impl RunOpt {
@@ -532,7 +558,7 @@ impl RunOpt {
let ctx = SessionContext::new_with_config_rt(config, rt);
if let Some(path) = &self.path {
- for table in &["lineitem", "supplier", "nation", "customer"] {
+ for table in &["lineitem", "orders", "supplier", "nation", "customer"] {
let table_path = path.join(table);
if !table_path.exists() {
return exec_err!(