kangkaisen commented on a change in pull request #3667:
URL: https://github.com/apache/incubator-doris/pull/3667#discussion_r429650040



##########
File path: fe/src/main/java/org/apache/doris/analysis/AnalyticExpr.java
##########
@@ -567,20 +567,19 @@ private void standardize(Analyzer analyzer) throws 
AnalysisException {
                 Preconditions.checkState(getFnCall().getChildren().size() == 
3);
             }
 
-            Type type = getFnCall().getChildren().get(2).getType();
-
-            try {
-                
getFnCall().uncheckedCastChild(getFnCall().getChildren().get(0).getType(), 2);
-            }  catch (Exception e) {
-                LOG.warn("" , e);
-                throw new AnalysisException("Convert type error in offset 
fn(defalut value); old_type="
-                                            + 
getFnCall().getChildren().get(2).getType() + " new_type="
-                                            + 
getFnCall().getChildren().get(0).getType()) ;
-            }
-
-            if (getFnCall().getChildren().get(2) instanceof CastExpr) {
-                throw new AnalysisException("Type = " + type + " can't not 
convert to "
-                                            + 
getFnCall().getChildren().get(0).getType());
+            Expr defaultExpr = getFnCall().getChildren().get(2);
+            Type SlotType = getFnCall().getChildren().get(0).getType();
+
+            if (! ((defaultExpr instanceof LiteralExpr)
+                    && (defaultExpr.getType().matchesType(SlotType))) ) {
+                try {
+                    
getFnCall().uncheckedCastChild(getFnCall().getChildren().get(0).getType(), 2);
+                } catch (Exception e) {
+                    LOG.warn("", e);

Review comment:
       Please add more info.




----------------------------------------------------------------
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:
us...@infra.apache.org



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

Reply via email to