MCPcopy
hub / github.com/feast-dev/feast / _deserialize_value

Function _deserialize_value

sdk/python/feast/infra/key_encoding_utils.py:31–47  ·  view source on GitHub ↗
(value_type, value_bytes)

Source from the content-addressed store, hash-verified

29
30
31def _deserialize_value(value_type, value_bytes) -> ValueProto:
32 if value_type == ValueType.INT64:
33 value = struct.unpack("<q", value_bytes)[0]
34 return ValueProto(int64_val=value)
35 if value_type == ValueType.INT32:
36 value = struct.unpack("<i", value_bytes)[0]
37 return ValueProto(int32_val=value)
38 elif value_type == ValueType.STRING:
39 value = value_bytes.decode("utf-8")
40 return ValueProto(string_val=value)
41 elif value_type == ValueType.BYTES:
42 return ValueProto(bytes_val=value_bytes)
43 elif value_type == ValueType.UNIX_TIMESTAMP:
44 value = struct.unpack("<q", value_bytes)[0]
45 return ValueProto(unix_timestamp_val=value)
46 else:
47 raise ValueError(f"Unsupported value type: {value_type}")
48
49
50def serialize_entity_key_prefix(

Callers 4

test_serialize_valueFunction · 0.90
test_deserialize_valueFunction · 0.90
deserialize_entity_keyFunction · 0.85

Calls 1

decodeMethod · 0.80

Tested by 2

test_serialize_valueFunction · 0.72
test_deserialize_valueFunction · 0.72