dongjoon-hyun commented on code in PR #60651:
URL: https://github.com/apache/spark/pull/60651#discussion_r4620849968


##########
sql/core/src/test/scala/org/apache/spark/sql/connector/MergeIntoTableSuiteBase.scala:
##########
@@ -2425,6 +2425,60 @@ abstract class MergeIntoTableSuiteBase extends 
RowLevelOperationSuiteBase
     }
   }
 
+  test("SPARK-61935: merge checks NOT NULL for a Scala UDF with a primitive 
input") {

Review Comment:
   Thank you. I added it to `UpdateTableSuiteBase` as you suggested. It fails 
without this fix and passes now in the four UPDATE suites.
   



##########
sql/core/src/test/scala/org/apache/spark/sql/UDFSuite.scala:
##########
@@ -1276,6 +1276,16 @@ class UDFSuite extends SharedSparkSession {
     checkAnswer(df, Seq(Row(2, 3), Row(null, null)))
   }
 
+  test("SPARK-61935: ScalaUDF null handling of a column made nullable by an 
outer join") {

Review Comment:
   Thank you. I added a test next to this one for Issues 4 and 5 and the 
`explode` example. It also checks that the `explode` output is nullable. It 
fails without this fix.
   



##########
docs/streaming/ss-migration-guide.md:
##########
@@ -38,6 +38,15 @@ Please refer [Migration Guide: SQL, Datasets and 
DataFrame](../sql-migration-gui
   To recover, write to a new table location with a new checkpoint location, or 
rewrite the
   committed files with the partition columns of the table.
 
+- Since Spark 4.4, a column derived from a typed Scala UDF with a primitive 
parameter is nullable
+  when the input of the parameter can be null, as the UDF returns NULL for a 
NULL input.
+  Previously, some of these columns, for example the output of a generator 
such as `explode` over
+  an array of the UDF results, were non-nullable. As a result, an existing 
query started before
+  Spark 4.3 that keeps such a column in its state, for example as a grouping 
key of a streaming
+  aggregation, fails to restart with `STATE_STORE_KEY_SCHEMA_NOT_COMPATIBLE`. 
To recover, use a new
+  checkpoint location, or set 
`spark.sql.streaming.stateStore.stateSchemaCheck` to `false`. Note
+  that the state of such a query can hold wrong keys, such as `-1` or `0`, for 
NULL inputs.

Review Comment:
   Thank you. I added your sentences with a different last one, as a new 
checkpoint location does not recompute the state when the source starts from 
the latest offsets. I also updated the PR description, which said that such 
queries are not affected.
   



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