This is an automated email from the ASF dual-hosted git repository. yiguolei pushed a commit to branch branch-1.2-lts in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-1.2-lts by this push: new 43d01c2ca9 [fix](jdbc) Added date type filtering pushed down to ClickHouse (#21709) 43d01c2ca9 is described below commit 43d01c2ca984dfdaec1605137947571031cd81c2 Author: zy-kkk <zhongy...@gmail.com> AuthorDate: Tue Jul 11 12:57:15 2023 +0800 [fix](jdbc) Added date type filtering pushed down to ClickHouse (#21709) * [fix](jdbc) Added date type filtering pushed down to ClickHouse * fix --- .../java/org/apache/doris/planner/OdbcScanNode.java | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/fe/fe-core/src/main/java/org/apache/doris/planner/OdbcScanNode.java b/fe/fe-core/src/main/java/org/apache/doris/planner/OdbcScanNode.java index 055269f68d..e22755d63e 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/planner/OdbcScanNode.java +++ b/fe/fe-core/src/main/java/org/apache/doris/planner/OdbcScanNode.java @@ -100,6 +100,24 @@ public class OdbcScanNode extends ScanNode { return filter; } } + if (tableType.equals(TOdbcTableType.CLICKHOUSE) && expr.contains(DateLiteral.class) + && (expr instanceof BinaryPredicate)) { + ArrayList<Expr> children = expr.getChildren(); + if (children.get(1).isConstant() && (children.get(1).getType().isDate()) || children + .get(1).getType().isDateV2()) { + String filter = children.get(0).toSql(); + filter += ((BinaryPredicate) expr).getOp().toString(); + filter += "date '" + children.get(1).getStringValue() + "'"; + return filter; + } + if (children.get(1).isConstant() && (children.get(1).getType().isDatetime() || children + .get(1).getType().isDatetimeV2())) { + String filter = children.get(0).toSql(); + filter += ((BinaryPredicate) expr).getOp().toString(); + filter += "timestamp '" + children.get(1).getStringValue() + "'"; + return filter; + } + } return expr.toMySql(); } --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org