From 8b7127fe92aa28321b6422643a3d1d3ca2301ae1 Mon Sep 17 00:00:00 2001 From: Matt Topol Date: Fri, 22 Nov 2024 18:16:42 -0500 Subject: [PATCH] Fix Debug-mode failing Arrow test (#17405) Fixes #17153 by fixing the appropriate element nullability data types Authors: - Matt Topol (https://github.com/zeroshade) Approvers: - Yunsong Wang (https://github.com/PointKernel) - David Wendt (https://github.com/davidwendt) URL: https://github.com/rapidsai/cudf/pull/17405 --- cpp/tests/interop/arrow_utils.hpp | 3 +-- cpp/tests/interop/from_arrow_test.cpp | 5 ++++- cpp/tests/interop/to_arrow_test.cpp | 4 ++-- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/cpp/tests/interop/arrow_utils.hpp b/cpp/tests/interop/arrow_utils.hpp index 70a9fe64d70..e785845394a 100644 --- a/cpp/tests/interop/arrow_utils.hpp +++ b/cpp/tests/interop/arrow_utils.hpp @@ -212,9 +212,8 @@ std::shared_ptr get_arrow_list_array(std::vector data, "Failed to append values to buffer builder"); CUDF_EXPECTS(buff_builder.Finish(&offset_buffer).ok(), "Failed to allocate buffer"); - auto nullable = std::accumulate(list_validity.begin(), list_validity.end(), 0) > 0; return std::make_shared( - arrow::list(arrow::field("", data_array->type(), nullable)), + arrow::list(arrow::field("element", data_array->type(), data_array->null_count() > 0)), offsets.size() - 1, offset_buffer, data_array, diff --git a/cpp/tests/interop/from_arrow_test.cpp b/cpp/tests/interop/from_arrow_test.cpp index 18efae75cb1..62e38cbfd45 100644 --- a/cpp/tests/interop/from_arrow_test.cpp +++ b/cpp/tests/interop/from_arrow_test.cpp @@ -279,7 +279,10 @@ TEST_F(FromArrowTest, StructColumn) auto list_arr = get_arrow_list_array({1, 2, 3, 4, 5, 6, 7, 8, 9}, {0, 2, 4, 5, 6, 7, 9}); std::vector offset{0, 3, 4, 6}; auto nested_list_arr = std::make_shared( - arrow::list(list(arrow::int64())), offset.size() - 1, arrow::Buffer::Wrap(offset), list_arr); + arrow::list(list(arrow::field("element", arrow::int64(), false))), + offset.size() - 1, + arrow::Buffer::Wrap(offset), + list_arr); std::vector> child_arrays2({str2_array, int2_array}); auto fields2 = std::vector>{ diff --git a/cpp/tests/interop/to_arrow_test.cpp b/cpp/tests/interop/to_arrow_test.cpp index 86295d8efb1..faa07ba3311 100644 --- a/cpp/tests/interop/to_arrow_test.cpp +++ b/cpp/tests/interop/to_arrow_test.cpp @@ -261,14 +261,14 @@ TEST_F(ToArrowTest, NestedList) std::vector offset{0, 0, 2}; auto mask_buffer = arrow::internal::BytesToBits({0, 1}).ValueOrDie(); auto nested_list_arr = std::make_shared( - arrow::list(arrow::field("a", arrow::list(arrow::int64()), false)), + arrow::list(arrow::field("element", arrow::list(arrow::int64()), false)), offset.size() - 1, arrow::Buffer::Wrap(offset), list_arr, mask_buffer); std::vector> schema_vector( - {arrow::field("a", nested_list_arr->type())}); + {arrow::field("a", nested_list_arr->type(), false)}); auto schema = std::make_shared(schema_vector); auto expected_arrow_table = arrow::Table::Make(schema, {nested_list_arr});