diff --git a/tensorflow_io/core/kernels/arrow/arrow_util.cc b/tensorflow_io/core/kernels/arrow/arrow_util.cc index 931d8f796..b33f7a178 100644 --- a/tensorflow_io/core/kernels/arrow/arrow_util.cc +++ b/tensorflow_io/core/kernels/arrow/arrow_util.cc @@ -420,7 +420,11 @@ class ArrowMakeArrayDataImpl : public arrow::TypeVisitor { // Make array data for the child type type_ = type.value_type(); - type.value_type()->Accept(this); + arrow::Status child_status = type.value_type()->Accept(this); + if (!child_status.ok()) { + return arrow::Status::NotImplemented( + "Unsupported list child type " + type.value_type()->ToString()); + } auto child_data = *out_data_; // Make array data for the list TODO null count == 0 diff --git a/tests/test_arrow.py b/tests/test_arrow.py index 6ff64a50b..8f9cf1572 100644 --- a/tests/test_arrow.py +++ b/tests/test_arrow.py @@ -189,6 +189,14 @@ def test_arrow_io_tensor_lists(self): iot = tfio.IOTensor.from_arrow(table) self.run_test_case(iot, truth_data, table.column_names) + def test_arrow_io_tensor_list_string(self): + """A list of strings is not buildable yet and must fail cleanly""" + table = pa.Table.from_arrays( + [pa.array([["a", "b"], ["c"]], type=pa.list_(pa.string()))], names=["a"] + ) + with self.assertRaisesRegex(tf.errors.OpError, "Unsupported list child type"): + tfio.IOTensor.from_arrow(table) + def test_arrow_io_tensor_mixed(self): """test_arrow_io_tensor_mixed""" truth_data = TruthData(