github-actions[bot] commented on code in PR #67809:
URL: https://github.com/apache/doris/pull/67809#discussion_r4037179043


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/info/CreateTableInfo.java:
##########
@@ -1140,24 +1141,27 @@ private void generatedColumnCheck(ConnectContext ctx) {
             if (!info.isPresent()) {
                 continue;
             }
-            Expression parsedExpression = info.get().getExpression();
-            checkParsedExpressionInGeneratedColumn(parsedExpression);
-            Expression boundSlotExpression = 
SlotReplacer.INSTANCE.replace(parsedExpression, columnToSlotReference);
-            Scope scope = new Scope(slots);
-            ExpressionAnalyzer analyzer = new ExpressionAnalyzer(null, scope, 
cascadesContext, false, false);
-            Expression expr;
-            try {
-                expr = analyzer.analyze(boundSlotExpression, new 
ExpressionRewriteContext(cascadesContext));
-            } catch (AnalysisException e) {
-                throw new AnalysisException("In generated column '" + 
column.getName() + "', "
-                        + Utils.convertFirstChar(e.getMessage()));
-            }
-            checkExpressionInGeneratedColumn(expr, column, 
nameToColumnDefinition);
-            TypeCoercionUtils.checkCanCastTo(expr.getDataType(), 
column.getType());
-            ExpressionToExpr translator = new ExpressionToExpr(i, 
translateMap);
-            Expr e = expr.accept(translator, planTranslatorContext);
-            info.get().setExpr(e);
-            exprAndNames.add(new ExprAndName(e.clone(), column.getName()));
+            try (AutoCloseSessionVariable autoClose = new 
AutoCloseSessionVariable(ctx,

Review Comment:
   [P1] Validate reconstructed Decimal256 types independently of the caller
   
   This scope starts only inside `generatedColumnCheck`, after `validate()` has 
already called `ColumnDefinition.validate` for every copied column. A source 
created with `enable_decimal256=true`, for example `(k INT, g DECIMAL(40,0) AS 
(k))`, is rendered and parsed successfully as `decimal(40,0) AS (NULL)`; 
however, with the caller setting disabled, `type.validateDataType()` rejects 
that declared Decimal256 type before execution reaches this saved-session 
scope. This is distinct from the existing raw-expression lexer thread because 
the placeholder parse succeeds and the failure occurs later during schema 
validation. Please make validation of reconstructed catalog types independent 
of the caller, including recursively nested types, and add an opposite-setting 
case with declared precision above 38.



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

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