ljz2051 commented on code in PR #24739:
URL: https://github.com/apache/flink/pull/24739#discussion_r1584444208


##########
flink-state-backends/flink-statebackend-forst/src/main/java/org/apache/flink/state/forst/ForStValueState.java:
##########
@@ -95,4 +100,32 @@ public V deserializeValue(byte[] valueBytes) throws 
IOException {
         inputView.setBuffer(valueBytes);
         return getValueSerializer().deserialize(inputView);
     }
+
+    @SuppressWarnings("unchecked")
+    @Override
+    public ForStDBGetRequest<ContextKey<K>, V> buildDBGetRequest(
+            StateRequest<?, ?, ?> stateRequest) {
+        Preconditions.checkArgument(stateRequest.getRequestType() == 
StateRequestType.VALUE_GET);
+        ContextKey<K> contextKey =
+                new ContextKey<>((RecordContext<K>) 
stateRequest.getRecordContext());
+        return ForStDBGetRequest.of(
+                contextKey, this, (InternalStateFuture<V>) 
stateRequest.getFuture());
+    }
+
+    @SuppressWarnings("unchecked")
+    @Override
+    public ForStDBPutRequest<ContextKey<K>, V> buildDBPutRequest(
+            StateRequest<?, ?, ?> stateRequest) {
+        Preconditions.checkArgument(
+                stateRequest.getRequestType() == StateRequestType.VALUE_UPDATE
+                        || stateRequest.getRequestType() == 
StateRequestType.CLEAR);
+        ContextKey<K> contextKey =
+                new ContextKey<>((RecordContext<K>) 
stateRequest.getRecordContext());
+        V value =
+                (stateRequest.getRequestType() == StateRequestType.CLEAR)
+                        ? null  // "Delete(key)" is equivalent to "Put(key, 
null)"
+                        : (V) stateRequest.getPayload();

Review Comment:
   The `payload` in `StateRequest` represents the input of this request.  The 
payload content for VALUE_PUT stateRequest is the `value` (see 
`InternalValueState#asyncUpdate`).
   
   Sorry for the misleading.  In pr-24681, the cached serialized key in 
`RecordContext` has been renamed to `extra`.
   



-- 
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: issues-unsubscr...@flink.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to