Skip to content

Commit d4637c5

Browse files
feat: Add decimal datatype to spark mapping to feast data type
Signed-off-by: tanlocnguyen <tanlocnguyen296@gmail.com>
1 parent 21e5434 commit d4637c5

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

sdk/python/feast/type_map.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -752,7 +752,7 @@ def _non_empty_value(value: Any) -> bool:
752752

753753
def spark_to_feast_value_type(spark_type_as_str: str) -> ValueType:
754754
# TODO not all spark types are convertible
755-
# Current non-convertible types: interval, map, struct, structfield, decimal, binary
755+
# Current non-convertible types: interval, map, struct, structfield, binary
756756
type_map: Dict[str, ValueType] = {
757757
"null": ValueType.UNKNOWN,
758758
"byte": ValueType.BYTES,
@@ -762,6 +762,7 @@ def spark_to_feast_value_type(spark_type_as_str: str) -> ValueType:
762762
"bigint": ValueType.INT64,
763763
"long": ValueType.INT64,
764764
"double": ValueType.DOUBLE,
765+
"decimal": ValueType.DOUBLE,
765766
"float": ValueType.FLOAT,
766767
"boolean": ValueType.BOOL,
767768
"timestamp": ValueType.UNIX_TIMESTAMP,
@@ -774,6 +775,9 @@ def spark_to_feast_value_type(spark_type_as_str: str) -> ValueType:
774775
"array<boolean>": ValueType.BOOL_LIST,
775776
"array<timestamp>": ValueType.UNIX_TIMESTAMP_LIST,
776777
}
778+
if spark_type_as_str.startswith('decimal'):
779+
spark_type_as_str = "decimal"
780+
777781
# TODO: Find better way of doing this.
778782
if not isinstance(spark_type_as_str, str) or spark_type_as_str not in type_map:
779783
return ValueType.NULL

0 commit comments

Comments
 (0)