Skip to content

Commit f361891

Browse files
committed
fix(snowflake): convert arrays, maps and structs using the base class implementation
1 parent 758ec25 commit f361891

File tree

1 file changed

+16
-9
lines changed

1 file changed

+16
-9
lines changed

ibis/backends/snowflake/converter.py

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,6 @@
1414

1515

1616
class SnowflakePandasData(PandasData):
17-
@classmethod
18-
def convert_JSON(cls, s, dtype, pandas_type):
19-
converter = cls.convert_JSON_element(dtype)
20-
return s.map(converter, na_action="ignore").astype("object")
21-
22-
convert_Struct = convert_Map = convert_JSON
23-
2417
@classmethod
2518
def convert_Timestamp_element(cls, dtype):
2619
return datetime.datetime.fromisoformat
@@ -33,11 +26,25 @@ def convert_Date_element(cls, dtype):
3326
def convert_Time_element(cls, dtype):
3427
return datetime.time.fromisoformat
3528

29+
@classmethod
30+
def convert_JSON(cls, s, dtype, pandas_type):
31+
converter = cls.convert_JSON_element(dtype)
32+
return s.map(converter, na_action="ignore").astype("object")
33+
3634
@classmethod
3735
def convert_Array(cls, s, dtype, pandas_type):
3836
raw_json_objects = cls.convert_JSON(s, dtype, pandas_type)
39-
converter = cls.get_element_converter(dtype.value_type)
40-
return raw_json_objects.map(converter, na_action="ignore")
37+
return super().convert_Array(raw_json_objects, dtype, pandas_type)
38+
39+
@classmethod
40+
def convert_Map(cls, s, dtype, pandas_type):
41+
raw_json_objects = cls.convert_JSON(s, dtype, pandas_type)
42+
return super().convert_Map(raw_json_objects, dtype, pandas_type)
43+
44+
@classmethod
45+
def convert_Struct(cls, s, dtype, pandas_type):
46+
raw_json_objects = cls.convert_JSON(s, dtype, pandas_type)
47+
return super().convert_Struct(raw_json_objects, dtype, pandas_type)
4148

4249

4350
class SnowflakePyArrowData(PyArrowData):

0 commit comments

Comments
 (0)