Skip to content

Commit 5ce0fdb

Browse files
authored
Fix BYTES and BYTES_LIST type conversion (#2158)
Signed-off-by: Judah Rand <17158624+judahrand@users.noreply.github.com>
1 parent a753e73 commit 5ce0fdb

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

‎sdk/python/feast/type_map.py‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15+
import base64
1516
import re
1617
from datetime import datetime
1718
from typing import Any, Dict, List, Optional, Set, Tuple, Type
@@ -62,15 +63,19 @@ def feast_value_type_to_python_type(field_value_proto: ProtoValue) -> Any:
6263
if k == "int64Val":
6364
return int(val)
6465
if k == "bytesVal":
65-
return bytes(val)
66+
# MessageToDict converts the bytes object to base64 encoded string:
67+
# https://developers.google.com/protocol-buffers/docs/proto3#json
68+
return base64.b64decode(val)
6669
if (k == "int64ListVal") or (k == "int32ListVal"):
6770
return [int(item) for item in val]
6871
if (k == "floatListVal") or (k == "doubleListVal"):
6972
return [float(item) for item in val]
7073
if k == "stringListVal":
7174
return [str(item) for item in val]
7275
if k == "bytesListVal":
73-
return [bytes(item) for item in val]
76+
# MessageToDict converts the bytes object to base64 encoded string:
77+
# https://developers.google.com/protocol-buffers/docs/proto3#json
78+
return [base64.b64decode(val) for item in val]
7479
if k == "boolListVal":
7580
return [bool(item) for item in val]
7681

0 commit comments

Comments
 (0)