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


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/info/MTMVPartitionDefinition.java:
##########
@@ -81,10 +84,17 @@ public MTMVPartitionInfo 
analyzeAndTransferToMTMVPartitionInfo(NereidsPlanner pl
         if (this.partitionType == MTMVPartitionType.EXPR) {
             if (functionCallExpression instanceof UnboundFunction && 
PARTITION_BY_FUNCTION_NAME
                     .equalsIgnoreCase(((UnboundFunction) 
functionCallExpression).getName())) {
-                partitionColName = functionCallExpression.getArgument(0) 
instanceof UnboundSlot

Review Comment:
   This changes `partitionCol` from the MV output column to the inner base 
slot. That breaks the raw nested form you are trying to support: with 
`PARTITION BY (date_trunc(date_add(k2, INTERVAL 3 HOUR), 'day')) AS SELECT 
date_trunc(date_add(k2, INTERVAL 3 HOUR), 'day') AS day_alias ...`, 
`partitionCol` becomes `k2`, but downstream code still looks up 
`mvPartitionInfo.getPartitionCol()` in the MV query output / generated MV 
schema (`MaterializedViewUtils.getRelatedTableInfos()` and 
`CreateMTMVInfo.getPartitionColumn()`). So this path now fails unless the 
select list also exposes `k2`.



##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/info/MTMVPartitionDefinition.java:
##########
@@ -125,6 +135,9 @@ private void fillPctInfos(NereidsPlanner planner, String 
partitionColName,
             Optional<Expression> partitionExpression = 
tableColumnInfo.getPartitionExpression();

Review Comment:
   Skipping the lineage-derived `partitionExpression` here regresses the 
alias-based hour-offset path. For `PARTITION BY (date_trunc(day_alias, 'day')) 
AS SELECT date_trunc(date_add(k2, INTERVAL 3 HOUR), 'day') AS day_alias ...`, 
`mtmvPartitionInfo.expr` now stays as `date_trunc(day_alias, 'day')` instead of 
the base-table expression `date_trunc(date_add(k2, INTERVAL 3 HOUR), 'day')`. 
Downstream logic like 
`UpdateMvByPartitionCommand.getInverseHourOffsetForBaseFilter()` and the 
`MTMVPartitionExprFactory` branch for `TimestampArithmeticExpr` only recognize 
the latter shape, so refresh / union-compensation silently lose the hour offset 
after this change.



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