seawinde commented on code in PR #64366:
URL: https://github.com/apache/doris/pull/64366#discussion_r3396935439


##########
fe/fe-core/src/main/java/org/apache/doris/mtmv/MTMVCache.java:
##########
@@ -105,7 +105,7 @@ public static MTMVCache from(String defSql,
             ConnectContext currentContext,
             boolean addSessionVarGuard) throws AnalysisException {
         StatementContext mvSqlStatementContext = new 
StatementContext(createCacheContext,
-                new OriginStatement(defSql, 0));
+                new OriginStatement(defSql, 0), 
currentContext.getStatementContext().getStatementStartTime());

Review Comment:
     这个风险不是这个 PR 新引入的,以前含 now() 的 MTMV 参与透明改写时,也可能因为 now() 
被折成常量而误命中(包含非确定函数的物化,不保证命中数据正确性)
   
     但这个 PR 会让这种误命中更容易发生。比如 MV 在 T1 refresh,里面存的是 T1 的时间;T2 查询 base 表时,如果刚好触发 
MTMVCache 懒加载,现在 MV 定义里的 now() 和查询里的 now() 都会用 T2 折成同一个常量,优化器就可能用 MV 改写。可是 MV 
里的真实数据还是 T1,所以结果可能不对。
   
   这不是这个 PR 的根因,但这个 PR 会放大已有风险,感觉应该不阻塞



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