cloud-fan commented on a change in pull request #35139:
URL: https://github.com/apache/spark/pull/35139#discussion_r786182479



##########
File path: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/encoders/RowEncoder.scala
##########
@@ -77,6 +77,28 @@ object RowEncoder {
       ClassTag(cls))
   }
 
+  /**
+   * Returns an ExpressionEncoder allowing null top-level rows.
+   * @param exprEnc an ExpressionEncoder[Row].
+   * @return an ExpressionEncoder[Row] whom deserializer supports null values.
+   *
+   * @see SPARK-37829
+   */
+  private[sql] def nullSafe(exprEnc: ExpressionEncoder[Row]): 
ExpressionEncoder[Row] = {
+    val newDeserializerInput = GetColumnByOrdinal(0, 
exprEnc.objSerializer.dataType)
+    val newDeserializer: Expression = if (exprEnc.objSerializer.nullable) {

Review comment:
       Sorry the code here is a bit confusing. We check 
`exprEnc.objSerializer.nullable` and then we construct 
`IsNull(newDeserializerInput)`? What's their connection?




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