mirror of https://github.com/apache/superset.git
Catch TypeError on PyArrow array instantiation (#9139)
This commit is contained in:
parent
9f7466ef90
commit
0992445ae9
|
@ -106,6 +106,7 @@ class SupersetResultSet:
|
||||||
pa.lib.ArrowInvalid,
|
pa.lib.ArrowInvalid,
|
||||||
pa.lib.ArrowTypeError,
|
pa.lib.ArrowTypeError,
|
||||||
pa.lib.ArrowNotImplementedError,
|
pa.lib.ArrowNotImplementedError,
|
||||||
|
TypeError, # this is super hackey, https://issues.apache.org/jira/browse/ARROW-7855
|
||||||
):
|
):
|
||||||
# attempt serialization of values as strings
|
# attempt serialization of values as strings
|
||||||
stringified_arr = stringify_values(array[column])
|
stringified_arr = stringify_values(array[column])
|
||||||
|
|
|
@ -200,6 +200,16 @@ class SupersetResultSetTestCase(SupersetTestCase):
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def test_nested_list_types(self):
|
||||||
|
data = [([{"TestKey": [123456, "foo"]}],)]
|
||||||
|
cursor_descr = [("metadata",)]
|
||||||
|
results = SupersetResultSet(data, cursor_descr, BaseEngineSpec)
|
||||||
|
self.assertEqual(results.columns[0]["type"], "STRING")
|
||||||
|
df = results.to_pandas_df()
|
||||||
|
self.assertEqual(
|
||||||
|
df_to_records(df), [{"metadata": '[{"TestKey": [123456, "foo"]}]'}]
|
||||||
|
)
|
||||||
|
|
||||||
def test_empty_datetime(self):
|
def test_empty_datetime(self):
|
||||||
data = [(None,)]
|
data = [(None,)]
|
||||||
cursor_descr = [("ds", "timestamp", None, None, None, None, True)]
|
cursor_descr = [("ds", "timestamp", None, None, None, None, True)]
|
||||||
|
|
Loading…
Reference in New Issue