You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by GitBox <gi...@apache.org> on 2020/10/21 07:41:49 UTC

[GitHub] [incubator-doris] xinghuayu007 commented on a change in pull request #4756: [FEATURE]Check date type to avoid scan all partitions

xinghuayu007 commented on a change in pull request #4756:
URL: https://github.com/apache/incubator-doris/pull/4756#discussion_r509056923



##########
File path: fe/fe-core/src/main/java/org/apache/doris/rewrite/ExprRewriter.java
##########
@@ -55,6 +58,12 @@ public Expr rewrite(Expr expr, Analyzer analyzer) throws AnalysisException {
                 rewrittenExpr = applyRuleRepeatedly(rewrittenExpr, rule, analyzer);
             }
         } while (oldNumChanges != numChanges_);
+        if (expr instanceof BinaryPredicate) {
+            Expr valueExpr = ((BinaryPredicate) expr).getBinding();
+            if(valueExpr != null && valueExpr.getType() == Type.DATETIME && valueExpr instanceof CastExpr) {
+                throw new AnalysisException("invalid date type :" + valueExpr.toSql());

Review comment:
       > I think throwing a exception is not the best solution of this problem, may be rewrite the binary expr `day = '2020-10-32'` to something like contant expr BoolLiteral[false] in where statement is better. We should discuss it first.
   
   ok,I will modify it;




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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