HeartSaVioR commented on code in PR #48985:
URL: https://github.com/apache/spark/pull/48985#discussion_r1861288638
##########
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:
+1 to @neilramaswamy
@jerrypeng Could you please file a new JIRA ticket and just leave a JIRA
ticket like `TODO (SPARK-XXXXX): optimize further to do this in query level` in
the code comment rather than describing the thing? Honestly, it sounds to be
less priority for me and mostly revisited only when we observe performance
issue.
--
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]