Visitar URL original
feat: Add UUID and TIME_UUID as feature types (#5885) by soooojinlee · Pull Request #5951 · feast-dev/feast · GitHub
Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix: Address review feedback for UUID type support
Signed-off-by: soojin <soojin@dable.io>
  • Loading branch information
soooojinlee authored and ntkathole committed Apr 1, 2026
commit a098c3c808c0ebf9d6562a5cb036946e83377956
6 changes: 4 additions & 2 deletions sdk/python/feast/on_demand_feature_view.py
Comment thread
soooojinlee marked this conversation as resolved.
Original file line number Diff line number Diff line change
Expand Up @@ -1164,8 +1164,8 @@ def _get_sample_values_by_type(self) -> dict[ValueType, list[Any]]:
ValueType.PDF_BYTES: [pdf_sample],
ValueType.IMAGE_BYTES: [image_sample],
# UUID types
ValueType.UUID: [str(uuid.uuid4())],
ValueType.TIME_UUID: [str(uuid.uuid1())],
ValueType.UUID: [uuid.uuid4()],
ValueType.TIME_UUID: [uuid.uuid1()],
# List types
ValueType.BYTES_LIST: [[b"hello world"]],
ValueType.STRING_LIST: [["hello world"]],
Expand All @@ -1175,6 +1175,8 @@ def _get_sample_values_by_type(self) -> dict[ValueType, list[Any]]:
ValueType.FLOAT_LIST: [[1.0]],
ValueType.BOOL_LIST: [[True]],
ValueType.UNIX_TIMESTAMP_LIST: [[_utc_now()]],
ValueType.UUID_LIST: [[uuid.uuid4(), uuid.uuid4()]],
ValueType.TIME_UUID_LIST: [[uuid.uuid1(), uuid.uuid1()]],
}

@staticmethod
Expand Down
8 changes: 7 additions & 1 deletion sdk/python/feast/type_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,9 +158,13 @@ def feast_value_type_to_python_type(
if val_attr in ("uuid_list_val", "time_uuid_list_val"):
return [uuid_module.UUID(v) if isinstance(v, str) else v for v in val]

# Backward compatibility: handle UUIDs stored as string_val with feature_type hint
# Backward compatibility: handle UUIDs stored as string_val/string_list_val with feature_type hint
if feature_type in (ValueType.UUID, ValueType.TIME_UUID) and isinstance(val, str):
return uuid_module.UUID(val)
if feature_type in (ValueType.UUID_LIST, ValueType.TIME_UUID_LIST) and isinstance(
val, list
):
return [uuid_module.UUID(v) if isinstance(v, str) else v for v in val]

return val

Expand Down Expand Up @@ -1399,6 +1403,8 @@ def _convert_value_name_to_snowflake_udf(value_name: str, project_name: str) ->
"UNIX_TIMESTAMP_LIST": f"feast_{project_name}_snowflake_array_timestamp_to_list_unix_timestamp_proto",
"UUID": f"feast_{project_name}_snowflake_varchar_to_string_proto",
"TIME_UUID": f"feast_{project_name}_snowflake_varchar_to_string_proto",
"UUID_LIST": f"feast_{project_name}_snowflake_array_varchar_to_list_string_proto",
"TIME_UUID_LIST": f"feast_{project_name}_snowflake_array_varchar_to_list_string_proto",
}
return name_map[value_name].upper()

Expand Down