Skip to content
Open
Changes from all commits
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
2 changes: 1 addition & 1 deletion sdk/python/feast/type_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -1015,7 +1015,7 @@ def python_values_to_proto_values(
value_type = python_type_to_feast_value_type("", sample)

if value_type == ValueType.UNKNOWN:
raise TypeError("Couldn't infer value type from empty value")
return [ProtoValue() for _ in values]
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

πŸ”΄ Silent data loss for empty-collection values (e.g., []) now treated as null instead of erroring

Replacing the TypeError with return [ProtoValue() for _ in values] silently converts legitimate empty-collection values (like []) into null ProtoValues. The _non_empty_value function at sdk/python/feast/type_map.py:1351-1360 treats empty lists/sets as "empty" (returns False), so when the only values are empty collections, sample is None, value_type stays UNKNOWN, and the new code returns null ProtoValues.

This causes silent data corruption in at least two call paths:

  1. _python_dict_to_map_proto (line 983): A struct like {"scores": []} will have its empty-list value silently converted to a null ProtoValue, losing the semantic distinction between "empty list" and "null".

  2. remote.py:205-213: When the remote online store returns a feature with status "PRESENT" and value [] (a valid empty list), the function returns ProtoValue() (null). The caller then stores this as the feature value (feature_values_dict[feature_name] = message[0]), silently dropping the actual empty-list value.

A safer fix would be to only return empty ProtoValues when all values are actually None, not when they are empty collections.

Prompt for agents
In sdk/python/feast/type_map.py at line 1017-1018, the fix for all-NULL columns is too broad β€” it also silently converts empty-collection values (like []) to null ProtoValues. Instead of unconditionally returning empty ProtoValues when value_type is UNKNOWN, check whether ALL values are actually None. If so, return empty ProtoValues (the intended fix for all-NULL columns). If some values are non-None but just empty collections (like []), either raise the original TypeError or attempt more aggressive type inference. For example:

if value_type == ValueType.UNKNOWN:
    if all(v is None for v in values):
        return [ProtoValue() for _ in values]
    raise TypeError("Couldn't infer value type from empty value")
Open in Devin Review

Was this helpful? React with πŸ‘ or πŸ‘Ž to provide feedback.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@yuan1j Looks like a perfect issue identification here. Could you please change the code to match the devins expectations here.


proto_values = _python_value_to_proto_value(value_type, values)

Expand Down