Skip to content

Commit f1a92e0

Browse files
adjusting some type issues
Signed-off-by: Francisco Javier Arceo <farceo@redhat.com>
1 parent 25a065e commit f1a92e0

File tree

2 files changed

+12
-11
lines changed

2 files changed

+12
-11
lines changed

sdk/python/feast/infra/online_stores/milvus_online_store/milvus.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from datetime import datetime
2-
from typing import Any, Callable, Dict, List, Literal, Optional, Sequence, Tuple
2+
from typing import Any, Callable, Dict, List, Literal, Optional, Sequence, Tuple, Union
33

44
from pydantic import StrictStr
55
from pymilvus import (
@@ -24,13 +24,13 @@
2424
from feast.protos.feast.types.Value_pb2 import Value as ValueProto
2525
from feast.repo_config import FeastConfigBaseModel, RepoConfig
2626
from feast.type_map import PROTO_VALUE_TO_VALUE_TYPE_MAP
27-
from feast.types import VALUE_TYPES_TO_FEAST_TYPES, Array, PrimitiveFeastType, ValueType
27+
from feast.types import VALUE_TYPES_TO_FEAST_TYPES, Array, PrimitiveFeastType, ComplexFeastType, ValueType
2828
from feast.utils import (
2929
_build_retrieve_online_document_record,
3030
to_naive_utc,
3131
)
3232

33-
PROTO_TO_MILVUS_TYPE_MAPPING = {
33+
PROTO_TO_MILVUS_TYPE_MAPPING: Dict[ValueType, DataType] = {
3434
PROTO_VALUE_TO_VALUE_TYPE_MAP["bytes_val"]: DataType.STRING,
3535
PROTO_VALUE_TO_VALUE_TYPE_MAP["bool_val"]: DataType.BOOL,
3636
PROTO_VALUE_TO_VALUE_TYPE_MAP["string_val"]: DataType.STRING,
@@ -45,7 +45,7 @@
4545
PROTO_VALUE_TO_VALUE_TYPE_MAP["bool_list_val"]: DataType.BINARY_VECTOR,
4646
}
4747

48-
FEAST_PRIMITIVE_TO_MILVUS_TYPE_MAPPING = {}
48+
FEAST_PRIMITIVE_TO_MILVUS_TYPE_MAPPING: Dict[Union[PrimitiveFeastType, Array, ComplexFeastType], DataType] = {}
4949

5050
for value_type, feast_type in VALUE_TYPES_TO_FEAST_TYPES.items():
5151
if isinstance(feast_type, PrimitiveFeastType):
@@ -288,10 +288,10 @@ def update(
288288
collection.drop()
289289
self._collections.pop(collection_name, None)
290290

291-
# def plan(
292-
# self, config: RepoConfig, desired_registry_proto: RegistryProto
293-
# ) -> List[InfraObject]:
294-
# raise NotImplementedError
291+
def plan(
292+
self, config: RepoConfig, desired_registry_proto: RegistryProto
293+
) -> List[InfraObject]:
294+
raise NotImplementedError
295295

296296
def teardown(
297297
self,
@@ -397,11 +397,11 @@ def _connect(self):
397397

398398
def to_infra_object_proto(self) -> InfraObjectProto:
399399
# Implement serialization if needed
400-
pass
400+
raise NotImplementedError
401401

402402
def update(self):
403403
# Implement update logic if needed
404-
pass
404+
raise NotImplementedError
405405

406406
def teardown(self):
407407
collection = Collection(name=self.name)

sdk/python/feast/type_map.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -538,7 +538,6 @@ def python_values_to_proto_values(
538538
"string_list_val": ValueType.STRING_LIST,
539539
"bytes_list_val": ValueType.BYTES_LIST,
540540
"bool_list_val": ValueType.BOOL_LIST,
541-
None: ValueType.NULL,
542541
}
543542

544543

@@ -553,6 +552,8 @@ def _proto_value_to_value_type(proto_value: ProtoValue) -> ValueType:
553552
A variant of ValueType.
554553
"""
555554
proto_str = proto_value.WhichOneof("val")
555+
if proto_str is None:
556+
return ValueType.UNKNOWN
556557
return PROTO_VALUE_TO_VALUE_TYPE_MAP[proto_str]
557558

558559

0 commit comments

Comments
 (0)