|
23 | 23 | from feast.protos.feast.types.Value_pb2 import FloatList |
24 | 24 | from feast.protos.feast.types.Value_pb2 import Value as ValueProto |
25 | 25 | 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 | +) |
27 | 37 | from feast.usage import log_exceptions_and_usage |
28 | 38 |
|
29 | 39 | logger = logging.getLogger(__name__) |
|
34 | 44 | DataType.INT64: Int64, |
35 | 45 | DataType.FLOAT: Float32, |
36 | 46 | DataType.DOUBLE: Float64, |
37 | | - DataType.STRING: String, |
| 47 | + DataType.VARCHAR: String, |
38 | 48 | DataType.UNKNOWN: Invalid, |
39 | 49 | DataType.FLOAT_VECTOR: Array(Float32), |
40 | 50 | DataType.BINARY_VECTOR: Array(Bytes), |
@@ -255,16 +265,26 @@ def _convert_featureview_schema_to_milvus_readable( |
255 | 265 | ) |
256 | 266 | raise e |
257 | 267 |
|
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( |
261 | 278 | name=field_name, |
262 | 279 | dtype=data_type, |
| 280 | + max_length=50, |
263 | 281 | description=description, |
264 | 282 | is_primary=is_primary, |
265 | 283 | dim=dimensions, |
266 | 284 | ) |
267 | | - ) |
| 285 | + |
| 286 | + # Appending the above converted values to construct a FieldSchema |
| 287 | + field_list.append(field) |
268 | 288 | # Returning a CollectionSchema which is a list of type FieldSchema. |
269 | 289 | return CollectionSchema(field_list), indexes |
270 | 290 |
|
@@ -478,6 +498,10 @@ def _get_milvus_type(self, feast_type) -> DataType: |
478 | 498 | """ |
479 | 499 | Convert Feast type to Milvus type using the TYPE_MAPPING bidict. |
480 | 500 | """ |
| 501 | + # todo this is just a hacky way to make the event_timestamp work |
| 502 | + if feast_type == UnixTimestamp: |
| 503 | + return DataType.INT64 |
| 504 | + |
481 | 505 | return TYPE_MAPPING.inverse.get(feast_type, None) |
482 | 506 |
|
483 | 507 | def _get_feast_type(self, milvus_type) -> object: |
|
0 commit comments