HeartSaVioR commented on code in PR #48853:
URL: https://github.com/apache/spark/pull/48853#discussion_r1857451509
##########
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:
It's actually already confusing to say key-value as "primary index", but I
also don't have a good term to represent it. At least it'd be less confusing if
we mention primary here, so good to rename what you've suggested.
--
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]