siying commented on code in PR #60068:
URL: https://github.com/apache/spark/pull/60068#discussion_r4637282586


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/Optimizer.scala:
##########
@@ -1514,8 +1514,14 @@ object PushProjectionThroughUnion extends 
Rule[LogicalPlan] {
  */
 object ColumnPruning extends Rule[LogicalPlan] {
 
-  def apply(plan: LogicalPlan): LogicalPlan = removeProjectBeforeFilter(
-    plan.transformWithPruning(AlwaysProcess.fn, ruleId) {
+  def apply(plan: LogicalPlan): LogicalPlan = {
+    // Multiple stateful joins can emit buffered rows behind their output 
watermark. Retaining
+    // an event-time column at a downstream join would incorrectly classify 
such rows as late.
+    val preserveJoinEventTime =

Review Comment:
   I’m keeping the plan-wide gate for this patch. A per-join gate would cover 
independent union branches and would require checking how watermark propagation 
behaves after optimizer rewrites across those branches. Once this behavior 
ships, expanding eligibility will also require a separately pinned mode or 
state migration. With the current gate, a second stateful operator falls back 
to legacy pruning. The join-plus-aggregation and chained-join tests cover that 
boundary.



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