[BUG] Remove the deduplication of LEFT SEMI/ANTI JOIN with not equal predicate (#4417)
```
SELECT *
FROM
(SELECT cs_order_number,
cs_warehouse_sk
FROM catalog_sales
WHERE cs_order_number = 125005
AND cs_warehouse_sk = 4) cs1
LEFT SEMI JOIN
(SELECT cs_order_number,
cs_warehouse_sk
FROM catalog_sales
WHERE cs_order_number = 125005) cs2
ON cs1.cs_order_number = cs2.cs_order_number
AND cs1.cs_warehouse_sk <> cs2.cs_warehouse_sk;
```
The above query has an equal predicate and a not equal predicate.
If there exists not equal preidcate, the build table should be remained
as it is. So the deduplication should be removed.
This commit is contained in:
@ -75,6 +75,12 @@ Status HashJoinNode::init(const TPlanNode& tnode, RuntimeState* state) {
|
||||
Expr::create_expr_trees(_pool, tnode.hash_join_node.other_join_conjuncts,
|
||||
&_other_join_conjunct_ctxs));
|
||||
|
||||
if (!_other_join_conjunct_ctxs.empty()) {
|
||||
// If LEFT SEMI JOIN/LEFT ANTI JOIN with not equal predicate,
|
||||
// build table should not be deduplicated.
|
||||
_build_unique = false;
|
||||
}
|
||||
|
||||
return Status::OK();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user