You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by zh...@apache.org on 2020/04/21 00:34:30 UTC

[incubator-doris] branch master updated: [Doris On ES] Pushdown some castexpr predicate to ES (#3351)

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

zhaoc 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 b60aabd  [Doris On ES] Pushdown some  castexpr predicate to ES (#3351)
b60aabd is described below

commit b60aabda1158b4e7088bf0a2dbef7c297d4ef2eb
Author: Yunfeng,Wu <wu...@baidu.com>
AuthorDate: Tue Apr 21 08:34:20 2020 +0800

    [Doris On ES] Pushdown some  castexpr predicate to ES (#3351)
    
    Process castexpr, such as: k (float) > 2.0, k(int) > 3.2, Doris On Es should ignore this doris native cast transformation for every row's col value, we push down this `cast semantic` to Elasticsearch.
    
    I believe in this `predicate` situation, would decrease the mount of data for transmission。
    
    k1 is float:
    
    ````
    k1 >= 5
    ````
    
    push-down filter:
    
    ```
    {"range":{"k1":{"gte":"5.000000"}}}
    ```
    k2 is int :
    
    ```
    k2 > 3.2
    ```
    
    push-down filter:
    
    ```
    {"range":{"k2":{"gte":"3.2"}}}
    ```
---
 be/src/exec/es/es_predicate.cpp | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/be/src/exec/es/es_predicate.cpp b/be/src/exec/es/es_predicate.cpp
index c8528c8..1906be1 100644
--- a/be/src/exec/es/es_predicate.cpp
+++ b/be/src/exec/es/es_predicate.cpp
@@ -230,14 +230,19 @@ Status EsPredicate::build_disjuncts_list(const Expr* conjunct) {
         // doris on es should ignore this doris native cast transformation, we push down this `cast` to elasticsearch
         // conjunct->get_child(0)->node_type() return CAST_EXPR
         // conjunct->get_child(1)->node_type()return FLOAT_LITERAL
-        // conjunct->op() return  EQ
-        if (TExprNodeType::SLOT_REF == conjunct->get_child(0)->node_type()) {
+        // the left child is literal and right child is SlotRef maybe not happend, but here we just process
+        // this situation regardless of the rewrite logic from the FE's Query Engine
+        if (TExprNodeType::SLOT_REF == conjunct->get_child(0)->node_type()
+            || TExprNodeType::CAST_EXPR == conjunct->get_child(0)->node_type()) {
             expr = conjunct->get_child(1);
-            slot_ref = (SlotRef*)(conjunct->get_child(0));
+            // process cast expr, such as:
+            // k (float) > 2.0, k(int) > 3.2
+            slot_ref = (SlotRef*)Expr::expr_without_cast(conjunct->get_child(0));
             op = conjunct->op();
-        } else if (TExprNodeType::SLOT_REF == conjunct->get_child(1)->node_type()) {
+        } else if (TExprNodeType::SLOT_REF == conjunct->get_child(1)->node_type()
+            || TExprNodeType::CAST_EXPR == conjunct->get_child(1)->node_type()) {
             expr = conjunct->get_child(0);
-            slot_ref = (SlotRef*)(conjunct->get_child(1));
+            slot_ref = (SlotRef*)Expr::expr_without_cast(conjunct->get_child(1));
             op = conjunct->op();
         } else {
             return Status::InternalError("build disjuncts failed: no SLOT_REF child");


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org