1313# limitations under the License.
1414
1515import json
16+ import re
1617from collections import defaultdict
1718from datetime import datetime , timezone
1819from typing import (
@@ -752,7 +753,7 @@ def _non_empty_value(value: Any) -> bool:
752753
753754def spark_to_feast_value_type (spark_type_as_str : str ) -> ValueType :
754755 # TODO not all spark types are convertible
755- # Current non-convertible types: interval, map, struct, structfield, decimal, binary
756+ # Current non-convertible types: interval, map, struct, structfield, binary
756757 type_map : Dict [str , ValueType ] = {
757758 "null" : ValueType .UNKNOWN ,
758759 "byte" : ValueType .BYTES ,
@@ -762,6 +763,7 @@ def spark_to_feast_value_type(spark_type_as_str: str) -> ValueType:
762763 "bigint" : ValueType .INT64 ,
763764 "long" : ValueType .INT64 ,
764765 "double" : ValueType .DOUBLE ,
766+ "decimal" : ValueType .DOUBLE ,
765767 "float" : ValueType .FLOAT ,
766768 "boolean" : ValueType .BOOL ,
767769 "timestamp" : ValueType .UNIX_TIMESTAMP ,
@@ -774,6 +776,10 @@ def spark_to_feast_value_type(spark_type_as_str: str) -> ValueType:
774776 "array<boolean>" : ValueType .BOOL_LIST ,
775777 "array<timestamp>" : ValueType .UNIX_TIMESTAMP_LIST ,
776778 }
779+ decimal_regex_pattern = r"^decimal\([0-9]{1,2},[0-9]{1,2}\)$"
780+ if re .match (decimal_regex_pattern , spark_type_as_str ):
781+ spark_type_as_str = "decimal"
782+
777783 # TODO: Find better way of doing this.
778784 if not isinstance (spark_type_as_str , str ) or spark_type_as_str not in type_map :
779785 return ValueType .NULL
0 commit comments