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


##########
sql/core/src/main/scala/org/apache/spark/sql/execution/streaming/StatefulProcessorHandleImpl.scala:
##########
@@ -153,7 +170,31 @@ class StatefulProcessorHandleImpl(
 
     assert(batchTimestampMs.isDefined)
     val valueStateWithTTL = new ValueStateImplWithTTL[T](store, stateName,
-      keyEncoder, valEncoder, ttlConfig, batchTimestampMs.get, metrics)
+      keyEncoder, valEncoder, ttlConfig, batchTimestampMs.get,
+      schemas(stateName).avroSerde, metrics)
+    ttlStates.add(valueStateWithTTL)
+    TWSMetricsUtils.incrementMetric(metrics, "numValueStateWithTTLVars")
+
+    valueStateWithTTL
+  }
+
+  // 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],
+      ttlConfig: TTLConfig,
+      useAvro: Boolean): ValueState[T] = {
+    verifyStateVarOperations("get_value_state", CREATED)
+    validateTTLConfig(ttlConfig, stateName)
+
+    assert(batchTimestampMs.isDefined)
+    val avroSerde = if (useAvro) new 
StateStoreColumnFamilySchemaUtils(true).getValueStateSchema[T](

Review Comment:
   lets just use the parentheses model
   
   ```
   if (useAvro) {
   
   } else {
   
   }
   ```



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