Skip to content

Commit e7f9ca7

Browse files
Include partition columns in primary key (#226)
1 parent dd8ed23 commit e7f9ca7

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

  • crates/data-generation/src/dataset

crates/data-generation/src/dataset/tpch.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -424,11 +424,13 @@ impl Dataset for TpchDataset {
424424
}
425425

426426
fn primary_key(&self, table: &str) -> Vec<String> {
427+
// Partition columns must be included in the primary key for correct
428+
// on-conflict behavior in distributed (scheduler+executor) mode.
427429
match table {
428430
"region" => vec!["r_regionkey".to_string()],
429-
"nation" => vec!["n_nationkey".to_string()],
430-
"supplier" => vec!["s_suppkey".to_string()],
431-
"customer" => vec!["c_custkey".to_string()],
431+
"nation" => vec!["n_nationkey".to_string(), "n_regionkey".to_string()],
432+
"supplier" => vec!["s_suppkey".to_string(), "s_nationkey".to_string()],
433+
"customer" => vec!["c_custkey".to_string(), "c_nationkey".to_string()],
432434
"part" => vec!["p_partkey".to_string()],
433435
"partsupp" => vec!["ps_partkey".to_string(), "ps_suppkey".to_string()],
434436
"orders" => vec!["o_orderkey".to_string()],

0 commit comments

Comments
 (0)