Skip to content

Commit 53dc637

Browse files
Merge pull request #24 from ExpediaGroup/feature/timestamp_hotfix
hot-fixed type mappings - will need rework
2 parents 01867f4 + e84f436 commit 53dc637

1 file changed

Lines changed: 30 additions & 6 deletions

File tree

sdk/python/feast/expediagroup/vectordb/milvus_online_store.py

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,17 @@
2323
from feast.protos.feast.types.Value_pb2 import FloatList
2424
from feast.protos.feast.types.Value_pb2 import Value as ValueProto
2525
from feast.repo_config import FeastConfigBaseModel
26-
from feast.types import Array, Bytes, Float32, Float64, Int32, Int64, Invalid, String
26+
from feast.types import (
27+
Array,
28+
Bytes,
29+
Float32,
30+
Float64,
31+
Int32,
32+
Int64,
33+
Invalid,
34+
String,
35+
UnixTimestamp,
36+
)
2737
from feast.usage import log_exceptions_and_usage
2838

2939
logger = logging.getLogger(__name__)
@@ -34,7 +44,7 @@
3444
DataType.INT64: Int64,
3545
DataType.FLOAT: Float32,
3646
DataType.DOUBLE: Float64,
37-
DataType.STRING: String,
47+
DataType.VARCHAR: String,
3848
DataType.UNKNOWN: Invalid,
3949
DataType.FLOAT_VECTOR: Array(Float32),
4050
DataType.BINARY_VECTOR: Array(Bytes),
@@ -255,16 +265,26 @@ def _convert_featureview_schema_to_milvus_readable(
255265
)
256266
raise e
257267

258-
# Appending the above converted values to construct a FieldSchema
259-
field_list.append(
260-
FieldSchema(
268+
field = FieldSchema(
269+
name=field_name,
270+
dtype=data_type,
271+
description=description,
272+
is_primary=is_primary,
273+
dim=dimensions,
274+
)
275+
276+
if data_type == DataType.VARCHAR:
277+
field = FieldSchema(
261278
name=field_name,
262279
dtype=data_type,
280+
max_length=50,
263281
description=description,
264282
is_primary=is_primary,
265283
dim=dimensions,
266284
)
267-
)
285+
286+
# Appending the above converted values to construct a FieldSchema
287+
field_list.append(field)
268288
# Returning a CollectionSchema which is a list of type FieldSchema.
269289
return CollectionSchema(field_list), indexes
270290

@@ -478,6 +498,10 @@ def _get_milvus_type(self, feast_type) -> DataType:
478498
"""
479499
Convert Feast type to Milvus type using the TYPE_MAPPING bidict.
480500
"""
501+
# todo this is just a hacky way to make the event_timestamp work
502+
if feast_type == UnixTimestamp:
503+
return DataType.INT64
504+
481505
return TYPE_MAPPING.inverse.get(feast_type, None)
482506

483507
def _get_feast_type(self, milvus_type) -> object:

0 commit comments

Comments
 (0)