Skip to content
Merged
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: Add np.ndarray support in nested collection proto conversion and…
… clarify placeholder pyarrow type

- Add np.ndarray to isinstance check in _convert_nested_collection_to_proto
  to fix KeyError for 3+ level nesting during materialization (PyArrow produces
  np.ndarray, not Python list)
- Add comment clarifying VALUE_LIST/VALUE_SET placeholder in feast_value_type_to_pa

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: soojin <soojin@dable.io>
  • Loading branch information
2 people authored and ntkathole committed Apr 2, 2026
commit a4dde0f81f79681ad8d41fe5a068b12ea7deb724
5 changes: 4 additions & 1 deletion sdk/python/feast/type_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -1088,7 +1088,8 @@ def _convert_nested_collection_to_proto(
# Empty inner collection: store as empty ProtoValue
inner_values.append(ProtoValue())
elif any(
isinstance(item, (list, set, tuple)) for item in inner_list
isinstance(item, (list, set, tuple, np.ndarray))
for item in inner_list
):
# Deeper nesting (3+ levels): recurse using VALUE_LIST
inner_proto = _convert_nested_collection_to_proto(
Expand Down Expand Up @@ -1765,6 +1766,8 @@ def feast_value_type_to_pa(
ValueType.JSON_LIST: pyarrow.list_(pyarrow.large_string()),
ValueType.STRUCT: pyarrow.struct([]),
ValueType.STRUCT_LIST: pyarrow.list_(pyarrow.struct([])),
# Placeholder: inner type is unknown from ValueType alone.
# Callers needing accurate inner types should use from_feast_to_pyarrow_type() with a FeastType.
ValueType.VALUE_LIST: pyarrow.list_(pyarrow.list_(pyarrow.string())),
ValueType.VALUE_SET: pyarrow.list_(pyarrow.list_(pyarrow.string())),
Comment on lines +1771 to +1772
Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration Bot Mar 30, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 feast_value_type_to_pa returns hardcoded list(list(string)) for all VALUE_LIST/VALUE_SET regardless of actual inner type

The feast_value_type_to_pa mapping at sdk/python/feast/type_map.py:1671-1672 hardcodes pyarrow.list_(pyarrow.list_(pyarrow.string())) for both VALUE_LIST and VALUE_SET. This means any caller that uses feast_value_type_to_pa to build a PyArrow schema for nested collections (e.g., Array(Array(Int32))) would get list<list<string>> instead of list<list<int32>>. While get_pyarrow_schema_from_batch_source in offline_utils.py:287-288 has special handling to avoid this, other potential callers would silently get the wrong type. The correct type-aware conversion exists in from_feast_to_pyarrow_type (sdk/python/feast/types.py:375-376), but that function takes a FeastType, not a ValueType. This inconsistency could cause silent data corruption if any code path relies on feast_value_type_to_pa for nested types without the special-case override.

Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

ValueType.NULL: pyarrow.null(),
Expand Down
Loading