From 193529435c5aa5ee9309aab69d963b5039445667 Mon Sep 17 00:00:00 2001 From: Danny Chiao Date: Wed, 19 Oct 2022 15:11:22 -0400 Subject: [PATCH 1/2] fix: Ensure that Snowflake properly accounts for INT32/INT64 columns with default precision 38 type Signed-off-by: Danny Chiao --- sdk/python/feast/infra/offline_stores/snowflake_source.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sdk/python/feast/infra/offline_stores/snowflake_source.py b/sdk/python/feast/infra/offline_stores/snowflake_source.py index 40e50b3cab..3176e0a59e 100644 --- a/sdk/python/feast/infra/offline_stores/snowflake_source.py +++ b/sdk/python/feast/infra/offline_stores/snowflake_source.py @@ -263,6 +263,11 @@ def get_table_column_names_and_types( result.dtypes[column].name ] else: + if len(result) > 0: + max_value = result.iloc[0][0] + if max_value is not None and len(str(max_value)) <= 18: + row["snowflake_type"] = "NUMBER" + continue raise NotImplementedError( "NaNs or Numbers larger than INT64 are not supported" ) From 3b3fbac71ccde32b0e0530dace8353644cfb9c0c Mon Sep 17 00:00:00 2001 From: "miles.adkins" Date: Wed, 26 Oct 2022 13:12:03 -0500 Subject: [PATCH 2/2] fix: Snowflake infer snowflake OBJECT return type for number inference Signed-off-by: miles.adkins --- .../feast/infra/offline_stores/snowflake_source.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/sdk/python/feast/infra/offline_stores/snowflake_source.py b/sdk/python/feast/infra/offline_stores/snowflake_source.py index 3176e0a59e..cc5208a676 100644 --- a/sdk/python/feast/infra/offline_stores/snowflake_source.py +++ b/sdk/python/feast/infra/offline_stores/snowflake_source.py @@ -265,8 +265,13 @@ def get_table_column_names_and_types( else: if len(result) > 0: max_value = result.iloc[0][0] - if max_value is not None and len(str(max_value)) <= 18: - row["snowflake_type"] = "NUMBER" + if max_value is not None and len(str(max_value)) <= 9: + row["snowflake_type"] = "NUMBER32" + continue + elif ( + max_value is not None and len(str(max_value)) <= 18 + ): + row["snowflake_type"] = "NUMBER64" continue raise NotImplementedError( "NaNs or Numbers larger than INT64 are not supported"