MCPcopy Index your code
hub / github.com/feast-dev/feast / _serialize_val

Function _serialize_val

sdk/python/feast/infra/key_encoding_utils.py:12–28  ·  view source on GitHub ↗
(
    value_type, v: ValueProto, entity_key_serialization_version=3
)

Source from the content-addressed store, hash-verified

10
11
12def _serialize_val(
13 value_type, v: ValueProto, entity_key_serialization_version=3
14) -> Tuple[bytes, int]:
15 if value_type == "string_val":
16 return v.string_val.encode("utf8"), ValueType.STRING
17 elif value_type == "bytes_val":
18 return v.bytes_val, ValueType.BYTES
19 elif value_type == "int32_val":
20 return struct.pack("<i", v.int32_val), ValueType.INT32
21 elif value_type == "int64_val":
22 if 0 <= entity_key_serialization_version <= 1:
23 return struct.pack("<l", v.int64_val), ValueType.INT64
24 return struct.pack("<q", v.int64_val), ValueType.INT64
25 elif value_type == "unix_timestamp_val":
26 return struct.pack("<q", v.unix_timestamp_val), ValueType.UNIX_TIMESTAMP
27 else:
28 raise ValueError(f"Value type not supported for feast feature store: {v}")
29
30
31def _deserialize_value(value_type, value_bytes) -> ValueProto:

Callers 3

test_serialize_valueFunction · 0.90
test_deserialize_valueFunction · 0.90
serialize_entity_keyFunction · 0.85

Calls 1

encodeMethod · 0.80

Tested by 2

test_serialize_valueFunction · 0.72
test_deserialize_valueFunction · 0.72