neilramaswamy commented on code in PR #48985:
URL: https://github.com/apache/spark/pull/48985#discussion_r1861163880
##########
sql/core/src/main/scala/org/apache/spark/sql/execution/streaming/TransformWithStateExec.scala:
##########
@@ -83,6 +83,23 @@ case class TransformWithStateExec(
// dummy value schema, the real schema will get during state variable init
time
private val DUMMY_VALUE_ROW_SCHEMA = new StructType().add("value",
BinaryType)
+ // We need to just initialize key and value deserializer once per partition.
+ // The deserializers need to be lazily created on the executor since they
+ // are not serializable.
+ // TODO we can further optimize this to be done once per query.
+ // Currently, the deserializers are created once per partition per batch.
+ // We can improve this by creating the deserializers once per query run.
+ // To do this, we need adjust certain APIs in CodeGenerator to allow
+ // us to generate the code and compile it separately. We can
+ // generate the java code on the driver side and compile it on the executor
side.
+ // Note that we only need to compile it once on the executor side since
there is a cache
+ // that allows us to reuse the compiled code.
Review Comment:
I would prefer if comments like this about potential future optimization are
kept inside of a JIRA ticket and just mention the ticket in the comment. To me,
it's a bit distracting to have to read about codegen implementation details
when trying to understand this streaming code.
I will let Jungtaek have the final say, and this does not block my approval.
--
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]