eugenegujing commented on code in PR #8958:
URL: https://github.com/apache/texera/pull/8958#discussion_r4532411697


##########
amber/src/main/python/core/models/state.py:
##########
@@ -107,7 +111,13 @@ def _from_json_value(value: Any) -> Any:
     if isinstance(value, list):
         return [_from_json_value(inner) for inner in value]
     if isinstance(value, dict):
-        if value.get(_TYPE_MARKER) == _BYTES_TYPE:
+        marker_keys = {_TYPE_MARKER, _PAYLOAD_MARKER}
+        if set(value) == marker_keys and value.get(_TYPE_MARKER) == 
_BYTES_TYPE:
             return base64.b64decode(value[_PAYLOAD_MARKER])
+        if set(value) == marker_keys and value.get(_TYPE_MARKER) == _DICT_TYPE:
+            return {
+                key: _from_json_value(inner)
+                for key, inner in value[_PAYLOAD_MARKER].items()
+            }

Review Comment:
   The Python round trip looks right, and `test_state.py` passes for me locally.
   
   One gap here: State sent between workers goes through the JVM 
(`PythonProxyServer` calls `State.fromTuple`, `PythonProxyClient` calls 
`toTuple`), and `State.scala` isn't changed here. It doesn't unwrap the new 
`dict` envelope and still treats any map with `__texera_type__: "bytes"` as 
bytes. So for the second test case, `owner` would still be dropped once the 
state crosses the JVM.
   
   Could `State.scala` get the same escape/exact-match logic, plus a 
`StateSpec` case for it? Or is that planned as a follow-up?



-- 
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]

Reply via email to