ganeshashree commented on code in PR #58407:
URL: https://github.com/apache/spark/pull/58407#discussion_r3894392687


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/codegen/GenerateUnsafeProjection.scala:
##########
@@ -122,11 +151,18 @@ object GenerateUnsafeProjection extends 
CodeGenerator[Seq[Expression], UnsafePro
       schemas: Seq[Schema],
       rowWriter: String,
       isTopLevel: Boolean = false): String = {
+    // A guarded nested field can set a null bit, so the mask is not static 
for such rows.
+    val hasGuardedNestedField =
+      inputs.zip(schemas).exists { case (input, Schema(dataType, nullable)) =>
+        (!nullable || input.isNull == FalseLiteral) &&
+          isNestedRowType(UserDefinedType.sqlType(dataType))

Review Comment:
   `isNestedRowType` already unwraps the UDT internally, so calling 
`UserDefinedType.sqlType` here too is redundant. Could just be 
`isNestedRowType(dataType)`.



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