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


##########
sql/core/src/main/scala/org/apache/spark/sql/classic/StreamingQueryManager.scala:
##########
@@ -285,12 +285,15 @@ class StreamingQueryManager private[sql] (
       catalogTable)
 
     // Unsupported-operation checks run during this initial analysis, before 
the normal offset-log
-    // configuration restoration. Read the compatibility value early for 
existing queries that
-    // contain a streaming EXCEPT so that upgrading does not change whether 
the query is accepted.
+    // configuration restoration. Read compatibility values early when they 
affect analysis.
     def hasExceptWithStreamingLeft: Boolean = analyzedPlan.exists {
       case Except(left, _, _) if left.isStreaming => true
       case _ => false
     }
+    def hasStatefulJoin: Boolean = analyzedPlan.exists {

Review Comment:
   > [!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.
   
   **Minor (P2): Remove the join-specific initial-analysis restoration unless 
there is an analysis consumer.**
   
   The new `hasStatefulJoin` branch reads checkpoint offsets and clones a 
session before `executePlan(...).analyzed`. However, the retention flag's 
semantic consumer is now `ColumnPruning`; neither `Join.references` nor 
analyzer/unsupported-operation-checker behavior depends on it. I do not see a 
retention dependency at this analysis boundary anymore.
   
   Could we remove the join-specific branch and restoration, preserving the 
existing streaming-EXCEPT handling? Otherwise, please identify the analysis 
path and a regression that require it. This would keep the point fix from 
unnecessarily expanding into initial-analysis/session-management behavior.
   
   This is nonblocking simplification feedback, not a demonstrated correctness 
regression.
   



##########
sql/core/src/main/scala/org/apache/spark/sql/execution/streaming/runtime/MicroBatchExecution.scala:
##########
@@ -212,6 +212,15 @@ class MicroBatchExecution(
     assert(queryExecutionThread eq Thread.currentThread,
       "logicalPlan must be initialized in QueryExecutionThread " +
         s"but the current thread was ${Thread.currentThread}")
+    val streamConf = sparkSessionForStream.sessionState.conf
+    initialLatestOffsetSeq.foreach { case (_, offsets) =>

Review Comment:
   > [!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.
   
   **Minor (P2): Justify the additional early runtime restoration with a 
specific regression.**
   
   Restoring the stream session before source initialization is a defensible 
invariant. However, `StreamingV2ScanPushDown.startupConf` and 
`ExternalLookupJoinStartupCheck.startupConf` already restore pinned settings 
into their cloned configurations, and ordinary batches restore them through 
`OffsetSeqMetadata.setSessionConf`.
   
   I have not identified an ordinary missing-key checkpoint case where those 
existing paths are insufficient. One additional behavior here is forcing legacy 
`false` when an existing offset entry has **no metadata at all**, whereas the 
shared restorers operate when metadata exists. The added tests remove the 
config key, not the entire metadata object.
   
   If that is the intended reason for this block, could we document the 
applicable supported-checkpoint scenario and add that regression? Otherwise, 
consider removing the duplicate restoration. This is nonblocking 
clarification/simplification feedback, not a demonstrated correctness 
regression.
   



##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/Optimizer.scala:
##########
@@ -1514,8 +1514,32 @@ 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 = {
+    val retainJoinEventTime =

Review Comment:
   > [!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.
   
   **Nit (P3): Document that eligibility is part of the 
checkpoint-compatibility contract.**
   
   An excluded query can record the flag as `true` while retaining a 
legacy-shaped state row. Broadening the eligibility checks later under the same 
recorded value could therefore change that query's expected state schema on 
restart.
   
   Please add a short warning beside the gate that future scope expansion needs 
a compatibility-preserving migration or a separately pinned mode/version. This 
does not require additional compatibility machinery in this patch; it is a 
guardrail for follow-ups.
   



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