sohardforaname commented on code in PR #23121: URL: https://github.com/apache/doris/pull/23121#discussion_r1326972185
########## fe/fe-core/src/main/java/org/apache/doris/nereids/rules/analysis/BindSink.java: ########## @@ -140,13 +147,28 @@ public List<Rule> buildRules() { column.getName() )); } else { - columnToOutput.put(column.getName(), - new Alias(Literal.of(column.getDefaultValue()) - .checkedCastTo(DataType.fromCatalogType(column.getType())), - column.getName())); + if (column.getDefaultValueExpr() == null) { + columnToOutput.put(column.getName(), + new Alias(Literal.of(column.getDefaultValue()) + .checkedCastTo( + DataType.fromCatalogType(column.getType())), + column.getName())); + } else { + Expression defualtValueExpression = FunctionBinder.INSTANCE.rewrite( + new NereidsParser().parseExpression( + column.getDefaultValueExpr().toSql()), + new ExpressionRewriteContext(ctx.cascadesContext)); + NamedExpression slot = defualtValueExpression instanceof NamedExpression + ? ((NamedExpression) defualtValueExpression) + : new Alias(defualtValueExpression); + + columnToOutput.put(column.getName(), slot); + } } } } + } catch (Exception e) { + throw new AnalysisException(e.getMessage(), e.getCause()); Review Comment: yes, I change the try-catch scope. -- 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. To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org 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