HeartSaVioR commented on PR #60068:
URL: https://github.com/apache/spark/pull/60068#issuecomment-6787674055

   > [!NOTE]
   > **DISCLAIMER:** This comment was written by an LLM: GPT-6.1 Sol 
(`gpt-6-1-sol`, xhigh effort), running as an SP2K agent on behalf of 
@HeartSaVioR.
   
   @siying Thanks for exploring the schema-preserving approach. Keeping the 
full input for late filtering, then projecting to the stored row layout before 
probing/buffering, looks like a viable direction. A targeted compatibility 
workaround is expected here; being a point fix is not itself a problem.
   
   My concern is whether the workaround is contained enough to avoid new 
failures or schema changes outside the case being fixed. In the current 
revision (`ca7aa4d3`), the tricky part is the logical annotation rule rather 
than the execution-side projection:
   
   1. **The scope is wider than columns newly retained by this fix.** 
`AnnotateStreamingJoinStateValueAttributes` walks the whole plan and considers 
every stateful equi-join. It can remove any watermarked attribute that its 
downstream-requirement calculation considers unnecessary. That does not 
distinguish a column newly retained for late filtering from one already present 
in the old stored schema. Limiting this to watermark columns is useful, but 
does not by itself make unaffected queries unchanged.
   
   2. **Processing dependencies and stored-column requirements are conflated.** 
Consider `A.join(B, "key").join(C, "key").select("key")`, with streaming A 
containing `(key, tA watermark)`, B containing only `key`, and C containing 
`(key, tC watermark)`. The downstream join's new implicit reference keeps `tA` 
in an intermediate Project. However, the annotation rule propagates 
join-condition references, not that implicit processing dependency, and can 
make the upstream physical join drop `tA` while the Project still requests it. 
This appears to leave a missing-input/binding failure. Simply retaining `tA` in 
upstream state also needs a compatibility check against the pre-fix layout; 
fixing propagation alone is not enough.
   
   3. **Downstream usage does not establish the old checkpoint schema.** For 
example, with 
`spark.sql.optimizer.excludedRules=org.apache.spark.sql.catalyst.optimizer.ColumnPruning`
 unchanged across an upgrade, the old join can already store the unused 
timestamp. The new annotation rule is non-excludable and can still remove it, 
changing the state schema and preventing restart. So the current 
schema-preservation argument does not cover this configuration.
   
   These are source-level findings; I have not run local reproductions.
   
   Before treating this as a schema-preserving fix, I would like a clear 
separation between processing dependencies and stored columns, a justified 
source for the pre-fix stored layout rather than downstream usage alone, and 
regressions for chained joins and excluded ColumnPruning, including exact 
schema/restart checks for cases that should remain unchanged.
   
   A deliberately narrower first patch is reasonable if covering these cases 
makes the approach too complex. Unsupported cases would need to keep the entire 
old planning behavior, not merely skip compaction after the input has already 
been widened; that also means explicitly leaving the original late-filtering 
issue unresolved there. I do not think this needs a general framework, but the 
boundary between "fix this case" and "leave other queries unchanged" needs to 
be explicit and tested.


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