From 072128632bebb7f230b6975456ad28e27bb193ce Mon Sep 17 00:00:00 2001 From: rootkiller6788 Date: Thu, 24 Sep 2026 14:54:07 +0800 Subject: [PATCH 1/2] arrow: don't swallow the child type error when building a list array Visit(ListType) called the child type's Accept() and threw the returned status away. If the child type isn't one of the primitive visitors the status is NotImplemented, *out_data_ never gets assigned, and the caller ends up with a list ArrayData whose child is a null shared_ptr. Arrow then dereferences it in BaseListArray::SetData, so a plain list column takes the process down instead of reporting the unsupported type. --- tensorflow_io/core/kernels/arrow/arrow_util.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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 From 133ac56e5164b346a0eac62d7900f03508d9491a Mon Sep 17 00:00:00 2001 From: rootkiller6788 Date: Thu, 24 Sep 2026 14:54:14 +0800 Subject: [PATCH 2/2] add a test for a list column Covers the path that used to segfault: the column goes through ArrowIOTensor, the array builder bails out on the string child, and we should get an OpError naming the child type. --- tests/test_arrow.py | 8 ++++++++ 1 file changed, 8 insertions(+) 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(