sahnib commented on code in PR #45674: URL: https://github.com/apache/spark/pull/45674#discussion_r1547139448
########## sql/core/src/main/scala/org/apache/spark/sql/execution/streaming/StatefulProcessorHandleImpl.scala: ########## @@ -103,22 +113,29 @@ class StatefulProcessorHandleImpl( private var currState: StatefulProcessorHandleState = CREATED - private def verify(condition: => Boolean, msg: String): Unit = { - if (!condition) { - throw new IllegalStateException(msg) - } - } - def setHandleState(newState: StatefulProcessorHandleState): Unit = { currState = newState } def getHandleState: StatefulProcessorHandleState = currState - override def getValueState[T](stateName: String, valEncoder: Encoder[T]): ValueState[T] = { + override def getValueState[T]( + stateName: String, + valEncoder: Encoder[T]): ValueState[T] = { verifyStateVarOperations("get_value_state") - val resultState = new ValueStateImpl[T](store, stateName, keyEncoder, valEncoder) - resultState + + if (ttlMode == TTLMode.NoTTL()) { + new ValueStateImpl[T](store, stateName, keyEncoder, valEncoder) + } else { + val valueStateWithTTL = new ValueStateImplWithTTL[T](store, stateName, + keyEncoder, valEncoder, ttlMode, batchTimestampMs, eventTimeWatermarkMs) + + val ttlState = valueStateWithTTL.ttlState Review Comment: Maybe I am not following your question. We want to add the ttlState instead of the actual state variable state to `ttlStates`. -- 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: reviews-unsubscr...@spark.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org