yujun777 commented on code in PR #70289:
URL: https://github.com/apache/doris/pull/70289#discussion_r4664657734


##########
fe/fe-core/src/main/java/org/apache/doris/mtmv/MTMVPlanUtil.java:
##########
@@ -567,8 +565,9 @@ public static MTMVAnalyzeQueryInfo analyzeQueryWithSql(MTMV 
mtmv, ConnectContext
         
mtmvPartitionDefinition.setPartitionType(mvPartitionInfo.getPartitionType());
         Expr expr = mvPartitionInfo.getExpr();
         if (expr != null) {
+            // The stored expression references base-table columns; reanalysis 
starts from MV output columns.
             mtmvPartitionDefinition.setFunctionCallExpression(new 
NereidsParser().parseExpression(
-                    expr.accept(ExprToSqlVisitor.INSTANCE, 
ToSqlParams.WITH_TABLE)));
+                    
MTMVPartitionExprFactory.getExprService(expr).toSql(mvPartitionInfo)));

Review Comment:
   Follow-up b6f1950b4a6 also handles both accepted DATE_TRUNC argument orders. 
Matching, unit extraction and merged-result construction now use the function's 
semantic date-argument index, so date_trunc('day', dt) does not leave an 
unmergeable nested truncation during reanalysis. Added actual 
MV/VARCHAR-widening cases for DAY, WEEK and QUARTER, plus all inner/outer 
argument-order combinations and mixed-unit guards. All 117 focused FE tests and 
reactor Checkstyle validation pass.
   



-- 
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