[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:
lichaoyong
2020-08-21 19:55:09 +08:00
committed by GitHub
parent 76a04de6c4
commit 5976395bb6

View File

@ -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();
}