neilramaswamy commented on code in PR #48985:
URL: https://github.com/apache/spark/pull/48985#discussion_r1860977707


##########
sql/core/src/main/scala/org/apache/spark/sql/execution/streaming/TransformWithStateExec.scala:
##########
@@ -533,6 +537,16 @@ case class TransformWithStateExec(
     }
   }
 
+  private def getDeserializers(): (InternalRow => Any, InternalRow => Any) = {
+    val getKeyObj =
+      ObjectOperator.deserializeRowToObject(keyDeserializer, 
groupingAttributes)
+
+    val getValueObj =
+      ObjectOperator.deserializeRowToObject(valueDeserializer, dataAttributes)
+
+    (getKeyObj, getValueObj)
+  }

Review Comment:
   Is there a reason why we have a lambda here instead of making `getKeyObj` 
and `getValueObj` `lazy val`s that we have in the constructor of the physical 
operator? I _think_ it's more canonical to do it that (like the `lazy val`s in 
`WatermarkSupport`).
   
   An added benefit to using lazy values is that you we don't need to duplicate 
code (or comments) between the `hasInitialState` and `!hasInitialState` 
branches.



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