Skip to content

Commit c8a771e

Browse files
committed
chore: fix e2e test
1 parent b548887 commit c8a771e

File tree

11 files changed

+56
-30
lines changed

11 files changed

+56
-30
lines changed

Cargo.lock

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/query/service/src/pipelines/processors/transforms/new_hash_join/hashtable/fixed_keys.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,13 @@ impl<T: HashtableKeyable + FixedKey> FixedKeyHashJoinHashTable<T> {
4141
}
4242
}
4343

44-
pub fn insert(&self, keys: DataBlock, chunk: usize, arena: &mut Vec<u8>) -> Result<()> {
44+
pub fn insert(
45+
&self,
46+
keys: DataBlock,
47+
chunk: usize,
48+
arena: &mut Vec<u8>,
49+
overwrite: bool,
50+
) -> Result<()> {
4551
let num_rows = keys.num_rows();
4652
let keys = ProjectedBlock::from(keys.columns());
4753
let keys_state = self.hash_method.build_keys_state(keys, num_rows)?;
@@ -69,7 +75,7 @@ impl<T: HashtableKeyable + FixedKey> FixedKeyHashJoinHashTable<T> {
6975
}
7076
}
7177

72-
self.hash_table.insert(*key, raw_entry_ptr);
78+
self.hash_table.insert(*key, raw_entry_ptr, overwrite);
7379
raw_entry_ptr = unsafe { raw_entry_ptr.add(1) };
7480
}
7581

src/query/service/src/pipelines/processors/transforms/new_hash_join/hashtable/serialize_keys.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,13 @@ impl SerializerHashJoinHashTable {
4545
}
4646
}
4747

48-
pub fn insert(&self, keys: DataBlock, chunk: usize, arena: &mut Vec<u8>) -> Result<()> {
48+
pub fn insert(
49+
&self,
50+
keys: DataBlock,
51+
chunk: usize,
52+
arena: &mut Vec<u8>,
53+
overwrite: bool,
54+
) -> Result<()> {
4955
let num_rows = keys.num_rows();
5056
let keys = ProjectedBlock::from(keys.columns());
5157
let keys_state = self.hash_method.build_keys_state(keys, num_rows)?;
@@ -94,7 +100,7 @@ impl SerializerHashJoinHashTable {
94100
string_local_space_ptr = string_local_space_ptr.add(key.len());
95101
}
96102

97-
self.hash_table.insert(key, raw_entry_ptr);
103+
self.hash_table.insert(key, raw_entry_ptr, overwrite);
98104
raw_entry_ptr = unsafe { raw_entry_ptr.add(1) };
99105
}
100106

src/query/service/src/pipelines/processors/transforms/new_hash_join/hashtable/single_binary_key.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,13 @@ impl SingleBinaryHashJoinHashTable {
4444
}
4545
}
4646

47-
pub fn insert(&self, keys: DataBlock, chunk: usize, arena: &mut Vec<u8>) -> Result<()> {
47+
pub fn insert(
48+
&self,
49+
keys: DataBlock,
50+
chunk: usize,
51+
arena: &mut Vec<u8>,
52+
overwrite: bool,
53+
) -> Result<()> {
4854
let num_rows = keys.num_rows();
4955
let keys = ProjectedBlock::from(keys.columns());
5056
let keys_state = self.hash_method.build_keys_state(keys, num_rows)?;
@@ -93,7 +99,7 @@ impl SingleBinaryHashJoinHashTable {
9399
string_local_space_ptr = string_local_space_ptr.add(key.len());
94100
}
95101

96-
self.hash_table.insert(key, raw_entry_ptr);
102+
self.hash_table.insert(key, raw_entry_ptr, overwrite);
97103
raw_entry_ptr = unsafe { raw_entry_ptr.add(1) };
98104
}
99105

src/query/service/src/pipelines/processors/transforms/new_hash_join/memory/basic.rs

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -239,17 +239,26 @@ impl BasicHashJoin {
239239

240240
fn build_hash_table(&self, keys: DataBlock, chunk_idx: usize) -> Result<()> {
241241
let mut arena = Vec::with_capacity(0);
242+
let is_overwrite = self.desc.join_type.is_any_join();
242243

243244
match self.state.hash_table.deref() {
244245
HashJoinHashTable::Null => (),
245-
HashJoinHashTable::Serializer(v) => v.insert(keys, chunk_idx, &mut arena)?,
246-
HashJoinHashTable::SingleBinary(v) => v.insert(keys, chunk_idx, &mut arena)?,
247-
HashJoinHashTable::KeysU8(v) => v.insert(keys, chunk_idx, &mut arena)?,
248-
HashJoinHashTable::KeysU16(v) => v.insert(keys, chunk_idx, &mut arena)?,
249-
HashJoinHashTable::KeysU32(v) => v.insert(keys, chunk_idx, &mut arena)?,
250-
HashJoinHashTable::KeysU64(v) => v.insert(keys, chunk_idx, &mut arena)?,
251-
HashJoinHashTable::KeysU128(v) => v.insert(keys, chunk_idx, &mut arena)?,
252-
HashJoinHashTable::KeysU256(v) => v.insert(keys, chunk_idx, &mut arena)?,
246+
HashJoinHashTable::Serializer(v) => {
247+
v.insert(keys, chunk_idx, &mut arena, is_overwrite)?
248+
}
249+
HashJoinHashTable::SingleBinary(v) => {
250+
v.insert(keys, chunk_idx, &mut arena, is_overwrite)?
251+
}
252+
HashJoinHashTable::KeysU8(v) => v.insert(keys, chunk_idx, &mut arena, is_overwrite)?,
253+
HashJoinHashTable::KeysU16(v) => v.insert(keys, chunk_idx, &mut arena, is_overwrite)?,
254+
HashJoinHashTable::KeysU32(v) => v.insert(keys, chunk_idx, &mut arena, is_overwrite)?,
255+
HashJoinHashTable::KeysU64(v) => v.insert(keys, chunk_idx, &mut arena, is_overwrite)?,
256+
HashJoinHashTable::KeysU128(v) => {
257+
v.insert(keys, chunk_idx, &mut arena, is_overwrite)?
258+
}
259+
HashJoinHashTable::KeysU256(v) => {
260+
v.insert(keys, chunk_idx, &mut arena, is_overwrite)?
261+
}
253262
};
254263

255264
if arena.capacity() != 0 {

src/query/service/tests/it/sql/planner/optimizer/data/results/tpcds/Q03_optimized.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@ Limit
1818
├── Exchange(Hash): keys: [dt.d_year (#6)]
1919
└── EvalScalar
2020
├── scalars: [dt.d_year (#6) AS (#6), store_sales.ss_ext_sales_price (#43) AS (#43), item.i_brand_id (#58) AS (#58), item.i_brand (#59) AS (#59), dt.d_date_sk (#0) AS (#74), store_sales.ss_sold_date_sk (#28) AS (#75), store_sales.ss_item_sk (#30) AS (#76), item.i_item_sk (#51) AS (#77), item.i_manufact_id (#64) AS (#78), dt.d_moy (#8) AS (#79)]
21-
└── Join(Inner(false))
21+
└── Join(Inner)
2222
├── build keys: [dt.d_date_sk (#0)]
2323
├── probe keys: [store_sales.ss_sold_date_sk (#28)]
2424
├── other filters: []
25-
├── Join(Inner(false))
25+
├── Join(Inner)
2626
│ ├── build keys: [item.i_item_sk (#51)]
2727
│ ├── probe keys: [store_sales.ss_item_sk (#30)]
2828
│ ├── other filters: []

src/query/service/tests/it/sql/planner/optimizer/data/results/tpcds/Q03_raw.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ Limit
1313
├── scalars: [dt.d_year (#6) AS (#6), store_sales.ss_ext_sales_price (#43) AS (#43), item.i_brand_id (#58) AS (#58), item.i_brand (#59) AS (#59)]
1414
└── Filter
1515
├── filters: [eq(dt.d_date_sk (#0), store_sales.ss_sold_date_sk (#28)), eq(store_sales.ss_item_sk (#30), item.i_item_sk (#51)), eq(item.i_manufact_id (#64), 128), eq(dt.d_moy (#8), 11)]
16-
└── Join(Cross(false))
16+
└── Join(Cross)
1717
├── build keys: []
1818
├── probe keys: []
1919
├── other filters: []
20-
├── Join(Cross(false))
20+
├── Join(Cross)
2121
│ ├── build keys: []
2222
│ ├── probe keys: []
2323
│ ├── other filters: []

src/query/sql/src/planner/optimizer/optimizers/operator/decorrelate/subquery_decorrelator.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ impl SubqueryDecorrelatorOptimizer {
276276
}
277277

278278
// todo: non_equi_conditions for other join_type
279-
if !matches!(join.join_type, JoinType::Inner)
279+
if !matches!(join.join_type, JoinType::Inner | JoinType::InnerAny)
280280
|| join
281281
.non_equi_conditions
282282
.iter()

tests/sqllogictests/suites/mode/standalone/explain/explain.test

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ EvalScalar
129129
├── scalars: [t1.a (#0) AS (#0), t1.b (#1) AS (#1), t2.a (#2) AS (#2), t2.b (#3) AS (#3)]
130130
└── Filter
131131
├── filters: [or(and(eq(t1.a (#0), t2.a (#2)), gt(t1.a (#0), 3)), eq(t1.a (#0), t2.a (#2)))]
132-
└── Join(Cross(false))
132+
└── Join(Cross)
133133
├── build keys: []
134134
├── probe keys: []
135135
├── other filters: []
@@ -149,7 +149,7 @@ explain raw select * from t1 inner join t2 on t1.a = t2.a and t1.b = t2.b and t1
149149
----
150150
EvalScalar
151151
├── scalars: [t1.a (#0) AS (#0), t1.b (#1) AS (#1), t2.a (#2) AS (#2), t2.b (#3) AS (#3)]
152-
└── Join(Inner(false))
152+
└── Join(Inner)
153153
├── build keys: [t2.a (#2), t2.b (#3)]
154154
├── probe keys: [t1.a (#0), t1.b (#1)]
155155
├── other filters: []
@@ -1109,7 +1109,7 @@ EXPLAIN optimized SELECT * FROM t1 LEFT OUTER JOIN t2 ON TRUE AND t1.i = t2.k AN
11091109
Sort
11101110
├── sort keys: [default.t1.i (#0) ASC NULLS LAST, default.t1.j (#1) ASC NULLS LAST]
11111111
├── limit: [NONE]
1112-
└── Join(Left(false))
1112+
└── Join(Left)
11131113
├── build keys: [t2.k (#2)]
11141114
├── probe keys: [t1.i (#0)]
11151115
├── other filters: []

tests/sqllogictests/suites/mode/standalone/explain/explain_verbose.test

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ query T
7575
explain(verbose, logical, optimized) select * from t, t t1, t t2, t t3, t t4
7676
where t.a = 1 and t1.a = 1 and t2.a = 1 and t3.a = 1 and t4.a = 1
7777
----
78-
Join(Cross(false))
78+
Join(Cross)
7979
├── build keys: []
8080
├── probe keys: []
8181
├── other filters: []
@@ -95,7 +95,7 @@ Join(Cross(false))
9595
│ ├── testdb.t.b (#5): { min: 1, max: 1000, ndv: 1, null count: 0 }
9696
│ ├── testdb.t.b (#7): { min: 1, max: 1000, ndv: 1, null count: 0 }
9797
│ └── testdb.t.b (#9): { min: 1, max: 1000, ndv: 1, null count: 0 }
98-
├── Join(Cross(false))
98+
├── Join(Cross)
9999
│ ├── build keys: []
100100
│ ├── probe keys: []
101101
│ ├── other filters: []
@@ -113,7 +113,7 @@ Join(Cross(false))
113113
│ │ ├── testdb.t.b (#3): { min: 1, max: 1000, ndv: 1, null count: 0 }
114114
│ │ ├── testdb.t.b (#5): { min: 1, max: 1000, ndv: 1, null count: 0 }
115115
│ │ └── testdb.t.b (#7): { min: 1, max: 1000, ndv: 1, null count: 0 }
116-
│ ├── Join(Cross(false))
116+
│ ├── Join(Cross)
117117
│ │ ├── build keys: []
118118
│ │ ├── probe keys: []
119119
│ │ ├── other filters: []
@@ -129,7 +129,7 @@ Join(Cross(false))
129129
│ │ │ ├── testdb.t.b (#1): { min: 1, max: 1000, ndv: 1, null count: 0 }
130130
│ │ │ ├── testdb.t.b (#3): { min: 1, max: 1000, ndv: 1, null count: 0 }
131131
│ │ │ └── testdb.t.b (#5): { min: 1, max: 1000, ndv: 1, null count: 0 }
132-
│ │ ├── Join(Cross(false))
132+
│ │ ├── Join(Cross)
133133
│ │ │ ├── build keys: []
134134
│ │ │ ├── probe keys: []
135135
│ │ │ ├── other filters: []
@@ -307,7 +307,7 @@ EvalScalar
307307
├── cardinality: 0.000
308308
├── precise cardinality: N/A
309309
├── statistics
310-
└── Join(Cross(false))
310+
└── Join(Cross)
311311
├── build keys: []
312312
├── probe keys: []
313313
├── other filters: []

0 commit comments

Comments
 (0)