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


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/load/NereidsStreamLoadPlanner.java:
##########
@@ -320,20 +321,22 @@ public TPipelineFragmentParams plan(TUniqueId loadId, int 
fragmentInstanceIdInde
         queryOptions.setNewVersionUnixTimestamp(true);
         queryOptions.setNewVersionPercentile(true);
         params.setQueryOptions(queryOptions);
+        params.setQueryGlobals(createQueryGlobals());
+        params.setTableName(destTable.getName());
+        params.setIsMowTable(destTable.getEnableUniqueKeyMergeOnWrite());
+        return params;
+    }
+
+    TQueryGlobals createQueryGlobals() {
         TQueryGlobals queryGlobals = new TQueryGlobals();
         
queryGlobals.setNowString(TimeUtils.getDatetimeFormatWithTimeZone().format(LocalDateTime.now()));

Review Comment:
   This pins BE load execution to `taskInfo.getStatementStartTime()`, but the 
planning side still uses fresh statement contexts when deciding load 
partitions. `NereidsLoadPlanInfoCollector.collectLoadPlanInfo()` creates 
`CascadesContext.initContext(new StatementContext(), ...)`, and 
`getAllPartitionIds()` creates another fresh `StatementContext()` before 
calling `PartitionPruner.prune()`. That pruner folds constants through 
`PartitionPruneExpressionExtractor` -> `FoldConstantRuleOnFE`, so a load 
predicate such as `where dt = date(now())` can be pruned with the collector's 
fresh instant while the BE post-filter/sink expressions evaluate `now()` from 
the task instant set here. If planning crosses a day or partition boundary, FE 
can send only the partition for one instant while BE evaluates rows for 
another, causing valid rows to be dropped or rejected. Please pass the same 
`taskInfo.getStatementStartTime()` into the collector/pruner contexts, or reuse 
the statement context installed at
  the start of planning, before using it for `TQueryGlobals`.



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