neilramaswamy commented on code in PR #48853:
URL: https://github.com/apache/spark/pull/48853#discussion_r1857186997
##########
sql/core/src/main/scala/org/apache/spark/sql/execution/streaming/MapStateImplWithTTL.scala:
##########
@@ -102,15 +98,12 @@ class MapStateImplWithTTL[K, V](
StateStoreErrors.requireNonNullStateValue(key, stateName)
StateStoreErrors.requireNonNullStateValue(value, stateName)
- val encodedGroupingKey = stateTypesEncoder.encodeGroupingKey()
- val encodedUserKey = stateTypesEncoder.encodeUserKey(key)
-
- val encodedValue = stateTypesEncoder.encodeValue(value, ttlExpirationMs)
val encodedCompositeKey = stateTypesEncoder.encodeCompositeKey(key)
- store.put(encodedCompositeKey, encodedValue, stateName)
- TWSMetricsUtils.incrementMetric(metrics, "numUpdatedStateRows")
+ val ttlExpirationMs = StateTTL
+ .calculateExpirationTimeForDuration(ttlConfig.ttlDuration,
batchTimestampMs)
+ val encodedValue = stateTypesEncoder.encodeValue(value, ttlExpirationMs)
- upsertTTLForStateKey(ttlExpirationMs, encodedGroupingKey, encodedUserKey)
+ updateIndices(encodedCompositeKey, encodedValue, ttlExpirationMs)
Review Comment:
Good point, not really a nit :)
How about `updatePrimaryAndSecondaryIndices`, to make it clear that it is
doing both?
--
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]