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, but supporting those plans takes more than changing 
the count. We would need to verify watermark propagation after optimizer 
rewrites and pin the wider eligibility rule or migrate existing state. With the 
current gate, a second stateful operator falls back to legacy pruning. The 
join-plus-aggregation and chained-join tests cover that boundary.
   
   ---
   <!-- GITHUB_MCP_FOOTER: This attribution is automatically appended by GitHub 
MCP. -->
   _This comment was generated with [GitHub MCP](http://go/mcps)._



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