anishshri-db commented on code in PR #48401:
URL: https://github.com/apache/spark/pull/48401#discussion_r1815773940


##########
sql/core/src/main/scala/org/apache/spark/sql/execution/streaming/StatefulProcessorHandleImpl.scala:
##########
@@ -139,11 +140,27 @@ class StatefulProcessorHandleImpl(
       stateName: String,
       valEncoder: Encoder[T]): ValueState[T] = {
     verifyStateVarOperations("get_value_state", CREATED)
-    val resultState = new ValueStateImpl[T](store, stateName, keyEncoder, 
valEncoder, metrics)
+    val resultState = new ValueStateImpl[T](
+      store, stateName, keyEncoder, valEncoder, schemas(stateName).avroSerde, 
metrics)
     TWSMetricsUtils.incrementMetric(metrics, "numValueStateVars")
     resultState
   }
 
+  // This method is for unit-testing ValueState, as the avroSerde will not be
+  // populated unless the handle is created through the TransformWithStateExec 
operator
+
+  private[sql] def getValueStateWithAvro[T](
+      stateName: String,
+      valEncoder: Encoder[T],
+      useAvro: Boolean): ValueState[T] = {
+    verifyStateVarOperations("get_value_state", CREATED)
+    val avroSerde = if (useAvro) new 
StateStoreColumnFamilySchemaUtils(true).getValueStateSchema[T](

Review Comment:
   nit: same here



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