Skip to content

Commit 8c1e825

Browse files
raashish1601ntkathole
authored andcommitted
fix: Map INT32_LIST, PDF_BYTES and IMAGE_BYTES type names to their ValueType
The INT32_LIST key in _convert_value_type_str_to_value_type had a trailing space, and PDF_BYTES and IMAGE_BYTES were missing, so all three fell back to STRING. The registry REST API uses this to describe feature types, so such features were reported (and rendered in the generated Field code) as String. Signed-off-by: Raashish Aggarwal <[email protected]>
1 parent fcc9a85 commit 8c1e825

2 files changed

Lines changed: 8 additions & 1 deletion

File tree

‎sdk/python/feast/type_map.py‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -567,7 +567,7 @@ def _convert_value_type_str_to_value_type(type_str: str) -> ValueType:
567567
"UNIX_TIMESTAMP": ValueType.UNIX_TIMESTAMP,
568568
"BYTES_LIST": ValueType.BYTES_LIST,
569569
"STRING_LIST": ValueType.STRING_LIST,
570-
"INT32_LIST ": ValueType.INT32_LIST,
570+
"INT32_LIST": ValueType.INT32_LIST,
571571
"INT64_LIST": ValueType.INT64_LIST,
572572
"DOUBLE_LIST": ValueType.DOUBLE_LIST,
573573
"FLOAT_LIST": ValueType.FLOAT_LIST,
@@ -600,6 +600,8 @@ def _convert_value_type_str_to_value_type(type_str: str) -> ValueType:
600600
"DECIMAL_SET": ValueType.DECIMAL_SET,
601601
"SCALAR_MAP": ValueType.SCALAR_MAP,
602602
"ZONED_TIMESTAMP": ValueType.ZONED_TIMESTAMP,
603+
"PDF_BYTES": ValueType.PDF_BYTES,
604+
"IMAGE_BYTES": ValueType.IMAGE_BYTES,
603605
}
604606
return type_map.get(type_str, ValueType.STRING)
605607

‎sdk/python/tests/unit/test_type_map.py‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -615,6 +615,11 @@ def test_convert_value_type_str_map_list(self):
615615
"""Test that 'MAP_LIST' string converts to ValueType.MAP_LIST."""
616616
assert _convert_value_type_str_to_value_type("MAP_LIST") == ValueType.MAP_LIST
617617

618+
@pytest.mark.parametrize("value_type", list(ValueType), ids=lambda v: v.name)
619+
def test_convert_value_type_str_round_trips_every_name(self, value_type):
620+
"""Every ValueType name converts back to that ValueType."""
621+
assert _convert_value_type_str_to_value_type(value_type.name) == value_type
622+
618623
def test_arrow_to_pg_type_map(self):
619624
"""Test that Arrow map type converts to Postgres jsonb."""
620625
assert arrow_to_pg_type("map<string, string>") == "jsonb"

0 commit comments

Comments
 (0)