Catch TypeError on PyArrow array instantiation (#9139)

This commit is contained in:
Rob DiCiuccio 2020-02-17 08:34:00 -08:00 committed by GitHub
parent 9f7466ef90
commit 0992445ae9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 0 deletions

View File

@ -106,6 +106,7 @@ class SupersetResultSet:
pa.lib.ArrowInvalid,
pa.lib.ArrowTypeError,
pa.lib.ArrowNotImplementedError,
TypeError, # this is super hackey, https://issues.apache.org/jira/browse/ARROW-7855
):
# attempt serialization of values as strings
stringified_arr = stringify_values(array[column])

View File

@ -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):
data = [(None,)]
cursor_descr = [("ds", "timestamp", None, None, None, None, True)]