This is an automated email from the ASF dual-hosted git repository.

maximebeauchemin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-superset.git


The following commit(s) were added to refs/heads/master by this push:
     new 0992445  Catch TypeError on PyArrow array instantiation (#9139)
0992445 is described below

commit 0992445ae907879f2308fb9493e19d62a27911d4
Author: Rob DiCiuccio <[email protected]>
AuthorDate: Mon Feb 17 08:34:00 2020 -0800

    Catch TypeError on PyArrow array instantiation (#9139)
---
 superset/result_set.py    |  1 +
 tests/result_set_tests.py | 10 ++++++++++
 2 files changed, 11 insertions(+)

diff --git a/superset/result_set.py b/superset/result_set.py
index 29294d7..8c4c567 100644
--- a/superset/result_set.py
+++ b/superset/result_set.py
@@ -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])
diff --git a/tests/result_set_tests.py b/tests/result_set_tests.py
index 9df461f..f1d78a4 100644
--- a/tests/result_set_tests.py
+++ b/tests/result_set_tests.py
@@ -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)]

Reply via email to