From 0bfdc5362e32243e15f612a8be2d070bee22ddb2 Mon Sep 17 00:00:00 2001 From: Jianliang Qi Date: Fri, 23 Aug 2024 16:14:17 +0800 Subject: [PATCH] [fix](ES Catalog)Only push down literal expr in binary predicate --- .../external/elasticsearch/QueryBuilders.java | 21 ++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/fe/fe-core/src/main/java/org/apache/doris/external/elasticsearch/QueryBuilders.java b/fe/fe-core/src/main/java/org/apache/doris/external/elasticsearch/QueryBuilders.java index 0205aba1287279d..024ba4a8c8ef40f 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/external/elasticsearch/QueryBuilders.java +++ b/fe/fe-core/src/main/java/org/apache/doris/external/elasticsearch/QueryBuilders.java @@ -31,6 +31,7 @@ import org.apache.doris.analysis.LargeIntLiteral; import org.apache.doris.analysis.LikePredicate; import org.apache.doris.analysis.LikePredicate.Operator; +import org.apache.doris.analysis.LiteralExpr; import org.apache.doris.analysis.SlotRef; import org.apache.doris.catalog.EsResource; import org.apache.doris.thrift.TExprOpcode; @@ -127,9 +128,9 @@ public static QueryBuilder toEsDsl(Expr expr) { .build()); } - private static QueryBuilder parseBinaryPredicate(Expr expr, TExprOpcode opCode, String column, + private static QueryBuilder parseBinaryPredicate(LiteralExpr expr, TExprOpcode opCode, String column, boolean needDateCompat) { - Object value = toDorisLiteral(expr.getChild(1)); + Object value = toDorisLiteral(expr); if (needDateCompat) { value = compatDefaultDate(value); } @@ -266,7 +267,21 @@ public static QueryBuilder toEsDsl(Expr expr, List notPushDownList, Map