GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix: Handle proto-to-Python conversion for HTTP transport · feast-dev/feast@e617b78

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • sdk/python/feast/infra/online_stores
    • remote.py
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎sdk/python/feast/infra/online_stores/remote.py‎

Copy file name to clipboardExpand all lines: sdk/python/feast/infra/online_stores/remote.py
+29-2Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,32 @@ class RemoteOnlineStore(OnlineStore):
7070
remote online store implementation wrapper to communicate with feast online server.
7171
"""
7272

73+
@staticmethod
74+
def _proto_value_to_transport_value(proto_value: ValueProto) -> Any:
75+
"""
76+
Convert a proto Value to a JSON-serializable Python value suitable for
77+
HTTP transport. Unlike ``feast_value_type_to_python_type``, this keeps
78+
``json_val`` as a raw string so the receiving server can reconstruct a
79+
DataFrame whose column types match the original (string for JSON, dict
80+
for Map/Struct). Parsing JSON strings into dicts would cause PyArrow to
81+
infer a struct column on the server, which can crash with complex nested
82+
types (lists inside dicts).
83+
"""
84+
val_attr = proto_value.WhichOneof("val")
85+
if val_attr is None:
86+
return None
87+
88+
# Keep JSON values as raw strings for correct DataFrame reconstruction.
89+
# Parsing them into dicts causes PyArrow to infer struct columns on the
90+
# server whose nested lists round-trip as numpy arrays, breaking
91+
# json.dumps during proto conversion.
92+
if val_attr == "json_val":
93+
return getattr(proto_value, val_attr)
94+
if val_attr == "json_list_val":
95+
return list(getattr(proto_value, val_attr).val)
96+
97+
return feast_value_type_to_python_type(proto_value)
98+
7399
def online_write_batch(
74100
self,
75101
config: RepoConfig,
@@ -97,10 +123,11 @@ def online_write_batch(
97123
feast_value_type_to_python_type(entity_value_proto)
98124
)
99125

100-
# Populate feature values
126+
# Populate feature values – use transport-safe conversion that
127+
# preserves JSON strings instead of parsing them into dicts.
101128
for feature_name, feature_value_proto in feature_values_proto.items():
102129
columnar_data[feature_name].append(
103-
feast_value_type_to_python_type(feature_value_proto)
130+
self._proto_value_to_transport_value(feature_value_proto)
104131
)
105132

106133
# Populate timestamps

0 commit comments

Comments
0 (0)
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.