From 291bee531378aa8c088c89be916a168630a81233 Mon Sep 17 00:00:00 2001 From: Nikolaus Schuetz Date: Wed, 22 Jul 2026 10:58:24 -0700 Subject: [PATCH] fix: Map Postgres real to FLOAT instead of DOUBLE Postgres real is a single-precision float4 column, but pg_type_to_feast_value_type mapped real to ValueType.DOUBLE (and real[] to DOUBLE_LIST), silently widening the inferred schema to float64. The mssql, oracle, and trino type maps in the same module all map real to FLOAT; only Postgres diverged. Map real to FLOAT and real[] to FLOAT_LIST to match. Signed-off-by: Nikolaus Schuetz --- sdk/python/feast/type_map.py | 4 ++-- sdk/python/tests/unit/test_type_map.py | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/sdk/python/feast/type_map.py b/sdk/python/feast/type_map.py index 5eca6782d5a..70894150d46 100644 --- a/sdk/python/feast/type_map.py +++ b/sdk/python/feast/type_map.py @@ -2047,7 +2047,7 @@ def pg_type_to_feast_value_type(type_str: str) -> ValueType: "bigint": ValueType.INT64, "smallint": ValueType.INT32, "integer": ValueType.INT32, - "real": ValueType.DOUBLE, + "real": ValueType.FLOAT, "double precision": ValueType.DOUBLE, "boolean[]": ValueType.BOOL_LIST, "bytea[]": ValueType.BYTES_LIST, @@ -2058,7 +2058,7 @@ def pg_type_to_feast_value_type(type_str: str) -> ValueType: "text[]": ValueType.STRING_LIST, "character[]": ValueType.STRING_LIST, "bigint[]": ValueType.INT64_LIST, - "real[]": ValueType.DOUBLE_LIST, + "real[]": ValueType.FLOAT_LIST, "double precision[]": ValueType.DOUBLE_LIST, "character": ValueType.STRING, "character varying": ValueType.STRING, diff --git a/sdk/python/tests/unit/test_type_map.py b/sdk/python/tests/unit/test_type_map.py index 412b63298a5..4fd62dc680e 100644 --- a/sdk/python/tests/unit/test_type_map.py +++ b/sdk/python/tests/unit/test_type_map.py @@ -541,6 +541,11 @@ def test_pg_type_to_feast_value_type_json_array(self): assert pg_type_to_feast_value_type("json[]") == ValueType.MAP_LIST assert pg_type_to_feast_value_type("jsonb[]") == ValueType.MAP_LIST + def test_pg_type_to_feast_value_type_real(self): + """Postgres real is single-precision (float4), so it maps to FLOAT, not DOUBLE.""" + assert pg_type_to_feast_value_type("real") == ValueType.FLOAT + assert pg_type_to_feast_value_type("real[]") == ValueType.FLOAT_LIST + def test_snowflake_variant_to_map(self): """Test that Snowflake VARIANT/OBJECT types convert to ValueType.MAP.""" assert snowflake_type_to_feast_value_type("VARIANT") == ValueType.MAP