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



##########
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 expr `day = '2020-10-32'` to something like contant expr `1 
= 0` in where statement is better. We should discuss it first.




----------------------------------------------------------------
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:
[email protected]



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

Reply via email to