spark-test commented on code in PR #60707:
URL: https://github.com/apache/spark/pull/60707#discussion_r4639386474


##########
sql/core/src/test/scala/org/apache/spark/sql/streaming/StreamingStatefulOperatorNullabilityDriftSuite.scala:
##########
@@ -35,7 +35,8 @@ import org.apache.spark.sql.types.{ArrayType, DataType, 
MapType, StructType}
  * Driver: `PropagateEmptyRelation` drops empty `Union` branches without a 
streaming
  * guard, so the surviving branch's per-column nullability becomes the Union's
  * nullability and propagates into a stateful operator above -- across 
microbatches or
- * restarts.
+ * restarts. New checkpoints keep the branches (SPARK-62057), so the Union 
scenarios write

Review Comment:
   **Nit (P3):** The comments in this file no longer match the code, so a 
reader can misjudge when the suite's Union branches drop:
   
   - Lines 35-36 still say `PropagateEmptyRelation` drops empty `Union` 
branches without a streaming guard, but `canPruneUnionChildren` 
(PropagateEmptyRelation.scala:74-75) now keeps the children of every streaming 
Union unless 
`spark.sql.optimizer.propagateEmptyRelationCanPruneStreamingUnionChildren` is 
true.
   - Lines 38-39 say the Union scenarios write their checkpoints with pruning 
on, but the `flatMapGroupsWithState` and `transformWithState` scenarios (lines 
368 and 410) do not set the conf; only the scenarios that run through 
`runUnionBranchDropRestart` and the tests at lines 262 and 289 do.
   - Line 82 says checkpoints of earlier versions record that 
`PropagateEmptyRelation` drops empty Union branches, but their offset logs have 
no entry for the conf. They are restored with it set to true by the default for 
a missing entry (OffsetSeq.scala:280), as the new test in OffsetSeqLogSuite 
asserts.
   
   To fix all three, say that the branches are dropped only with the conf set 
to true, which checkpoints written before SPARK-62057 get because their offset 
logs lack the entry; name the scenarios that set it rather than all Union 
scenarios; and say in the `withUnionBranchDrop` comment that such checkpoints 
have no entry and are restored with pruning on. No test needs to change.
   
   **Verification:**
   - **Inspection:** Every statement in the nullability drift suite's header 
and in the withUnionBranchDrop comment matches the code: the branch drop is 
described as happening only with the pruning conf set to true; each scenario 
the header says writes its checkpoints with pruning on does set the conf, which 
excludes the flatMapGroupsWithState and transformWithState scenarios; and 
checkpoints written before SPARK-62057 are described as having no entry for the 
conf and being restored with pruning on.



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