This is an automated email from the ASF dual-hosted git repository.

lichaoyong pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-doris.git


The following commit(s) were added to refs/heads/master by this push:
     new 5976395  [BUG] Remove the deduplication of LEFT SEMI/ANTI JOIN with 
not equal predicate (#4417)
5976395 is described below

commit 5976395bb673806f0cb1ba05b99c043a7dbb9dee
Author: lichaoyong <[email protected]>
AuthorDate: Fri Aug 21 19:55:09 2020 +0800

    [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.
---
 be/src/exec/hash_join_node.cpp | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/be/src/exec/hash_join_node.cpp b/be/src/exec/hash_join_node.cpp
index dea793e..c120330 100644
--- a/be/src/exec/hash_join_node.cpp
+++ b/be/src/exec/hash_join_node.cpp
@@ -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();
 }
 


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to