From 0d5048f453eff878174fe390d16612f44bb106b1 Mon Sep 17 00:00:00 2001 From: kileys Date: Tue, 7 Sep 2021 19:13:32 +0000 Subject: [PATCH 1/2] Multimap user state proto changes --- .../src/main/proto/beam_fn_api.proto | 59 ++++++++++++++++++- 1 file changed, 58 insertions(+), 1 deletion(-) diff --git a/model/fn-execution/src/main/proto/beam_fn_api.proto b/model/fn-execution/src/main/proto/beam_fn_api.proto index d532f53e938d..ea2ed45fa3d9 100644 --- a/model/fn-execution/src/main/proto/beam_fn_api.proto +++ b/model/fn-execution/src/main/proto/beam_fn_api.proto @@ -709,6 +709,15 @@ message StateKey { bytes window = 3; } + // Represents a request for an unordered set of values associated with a + // specified user key and window for a PTransform. See + // https://s.apache.org/beam-fn-state-api-and-bundle-processing for further + // details. + // + // The response data stream will be a concatenation of all V's associated + // with the specified user key and window. + // See https://s.apache.org/beam-fn-api-send-and-receive-data for further + // details. message BagUserState { // (Required) The id of the PTransform containing user state. string transform_id = 1; @@ -721,6 +730,53 @@ message StateKey { bytes key = 4; } + // Represents a request for the keys of a multimap associated with a specified + // user key and window for a PTransform. See + // https://s.apache.org/beam-fn-state-api-and-bundle-processing for further + // details. + // + // Can only be used to perform StateGetRequests and StateClearRequests on the + // user state. + // + // The response data stream will be a concatenation of all K's associated + // with the specified user key and window. + // See https://s.apache.org/beam-fn-api-send-and-receive-data for further + // details. + message MultimapKeysUserState { + // (Required) The id of the PTransform containing user state. + string transform_id = 1; + // (Required) The id of the user state. + string user_state_id = 2; + // (Required) The window encoded in a nested context. + bytes window = 3; + // (Required) The key of the currently executing element encoded in a + // nested context. + bytes key = 4; + } + + // Represents a request for the values of the lookup key associated with a + // specified user key and window for a PTransform. See + // https://s.apache.org/beam-fn-state-api-and-bundle-processing for further + // details. + // + // The response data stream will be a concatenation of all V's associated + // with the specified user key, map key and window. + // See https://s.apache.org/beam-fn-api-send-and-receive-data for further + // details. + message MultimapUserState { + // (Required) The id of the PTransform containing user state. + string transform_id = 1; + // (Required) The id of the user state. + string user_state_id = 2; + // (Required) The window encoded in a nested context. + bytes window = 3; + // (Required) The key of the currently executing element encoded in a + // nested context. + bytes key = 4; + // (Required) The encoded lookup key for the map encoded in a nested context. + bytes map_key = 5; + } + // (Required) One of the following state keys must be set. oneof type { Runner runner = 1; @@ -728,7 +784,8 @@ message StateKey { BagUserState bag_user_state = 3; IterableSideInput iterable_side_input = 4; MultimapKeysSideInput multimap_keys_side_input = 5; - // TODO: represent a state key for user map state + MultimapKeysUserState multimap_keys_user_state = 6; + MultimapUserState multimap_user_state = 7; } } From dec0cbb0a732543194ee09047a1fa60ecca0ba04 Mon Sep 17 00:00:00 2001 From: kileys Date: Wed, 8 Sep 2021 10:59:39 -0700 Subject: [PATCH 2/2] Apply suggestions from code review Co-authored-by: Lukasz Cwik --- model/fn-execution/src/main/proto/beam_fn_api.proto | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/model/fn-execution/src/main/proto/beam_fn_api.proto b/model/fn-execution/src/main/proto/beam_fn_api.proto index ea2ed45fa3d9..95693e37180c 100644 --- a/model/fn-execution/src/main/proto/beam_fn_api.proto +++ b/model/fn-execution/src/main/proto/beam_fn_api.proto @@ -754,13 +754,13 @@ message StateKey { bytes key = 4; } - // Represents a request for the values of the lookup key associated with a + // Represents a request for the values of the map key associated with a // specified user key and window for a PTransform. See // https://s.apache.org/beam-fn-state-api-and-bundle-processing for further // details. // // The response data stream will be a concatenation of all V's associated - // with the specified user key, map key and window. + // with the specified map key, user key, and window. // See https://s.apache.org/beam-fn-api-send-and-receive-data for further // details. message MultimapUserState { @@ -773,7 +773,7 @@ message StateKey { // (Required) The key of the currently executing element encoded in a // nested context. bytes key = 4; - // (Required) The encoded lookup key for the map encoded in a nested context. + // (Required) The map key encoded in a nested context. bytes map_key = 5; }