Pewarta Proxy

📋 Server Request & Proxy Logs

Loading active proxy settings...
Developed by Khairul Adha (adhexa.id)
Mengambil log server...

⚙️ Pengaturan Proxy Target

Skip to content

Commit bd8f618

Browse files
fix: Return raw bytes to match proto_json.patch() behavior
Signed-off-by: abhijeet-dhumal <abhijeetdhumal652@gmail.com>
1 parent 9859bad commit bd8f618

2 files changed

Lines changed: 7 additions & 7 deletions

File tree

‎sdk/python/feast/feature_server_utils.py‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
Values are serialized as native Python types (not wrapped dicts).
55
"""
66

7-
import base64
87
from datetime import datetime, timezone
98
from typing import Any, Dict, Optional
109

@@ -52,12 +51,14 @@ def convert_response_to_dict(response: GetOnlineFeaturesResponse) -> Dict[str, A
5251

5352

5453
def _value_to_native(v: Value) -> Optional[Any]:
55-
"""Convert a Value proto to native Python type (matches proto_json.patch() format)."""
54+
"""Convert a Value proto to native Python type (matches proto_json.patch() format).
55+
56+
Note: proto_json.patch() modifies MessageToDict to return raw bytes instead of
57+
base64 encoding, so we return raw bytes here to match that behavior.
58+
"""
5659
which = v.WhichOneof("val")
5760
if which is None or which == "null_val":
5861
return None
59-
elif which == "bytes_val":
60-
return base64.b64encode(v.bytes_val).decode("ascii")
6162
elif "_list_" in which:
6263
return list(getattr(v, which).val)
6364
else:

‎sdk/python/tests/unit/test_feature_server_utils.py‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
Related issue: https://github.com/feast-dev/feast/issues/6013
2222
"""
2323

24-
import base64
2524
import time
2625

2726
import pytest
@@ -99,7 +98,7 @@ def test_bytes_val(self):
9998
data = b"\x00\x01\x02\x03"
10099
v = Value(bytes_val=data)
101100
result = _value_to_native(v)
102-
assert result == base64.b64encode(data).decode("ascii")
101+
assert result == data
103102

104103
def test_double_list_val(self):
105104
v = Value(double_list_val=DoubleList(val=[1.1, 2.2, 3.3]))
@@ -357,7 +356,7 @@ def test_metadata_matches_patched_format(self):
357356
)
358357

359358
def test_bytes_values_match_patched_message_to_dict(self):
360-
"""Ensure bytes serialization matches proto_json.patch() format (base64)."""
359+
"""Ensure bytes serialization matches proto_json.patch() format (raw bytes)."""
361360
response = GetOnlineFeaturesResponse()
362361
fv = response.results.add()
363362
fv.values.append(Value(bytes_val=b"\x00\x01\x02\xff"))

0 commit comments

Comments
 (0)