Skip to content

Commit 3835940

Browse files
committed
Redis Test Fixed for entity key prefix
1 parent 146185e commit 3835940

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

sdk/python/feast/infra/key_encoding_utils.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,9 @@ def _deserialize_value(value_type, value_bytes) -> ValueProto:
4242
raise ValueError(f"Unsupported value type: {value_type}")
4343

4444

45-
def serialize_entity_key_prefix(entity_keys: List[str]) -> bytes:
45+
def serialize_entity_key_prefix(
46+
entity_keys: List[str], entity_key_serialization_version: int = 3
47+
) -> bytes:
4648
"""
4749
Serialize keys to a bytestring, so it can be used to prefix-scan through items stored in the online store
4850
using serialize_entity_key.
@@ -52,8 +54,12 @@ def serialize_entity_key_prefix(entity_keys: List[str]) -> bytes:
5254
"""
5355
sorted_keys = sorted(entity_keys)
5456
output: List[bytes] = []
57+
if entity_key_serialization_version > 2:
58+
output.append(struct.pack("<I", len(sorted_keys)))
5559
for k in sorted_keys:
5660
output.append(struct.pack("<I", ValueType.STRING))
61+
if entity_key_serialization_version > 2:
62+
output.append(struct.pack("<I", len(k)))
5763
output.append(k.encode("utf8"))
5864
return b"".join(output)
5965

sdk/python/tests/integration/feature_repos/repo_configuration.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -570,7 +570,7 @@ def construct_test_environment(
570570
if isinstance(test_repo_config.online_store, dict)
571571
else test_repo_config.online_store
572572
)
573-
if online_store in ["milvus", "pgvector", "qdrant", "elasticsearch"]:
573+
if online_store in ["milvus", "pgvector", "qdrant", "elasticsearch", "redis"]:
574574
entity_key_serialization_version = 3
575575

576576
environment_params = {

0 commit comments

Comments
 (0)