Skip to content

Commit

Permalink
Fix Debug-mode failing Arrow test (#17405)
Browse files Browse the repository at this point in the history
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: #17405
  • Loading branch information
zeroshade authored Nov 22, 2024
1 parent 092fdff commit 8b7127f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
3 changes: 1 addition & 2 deletions cpp/tests/interop/arrow_utils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -212,9 +212,8 @@ std::shared_ptr<arrow::Array> get_arrow_list_array(std::vector<T> 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::ListArray>(
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,
Expand Down
5 changes: 4 additions & 1 deletion cpp/tests/interop/from_arrow_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,10 @@ TEST_F(FromArrowTest, StructColumn)
auto list_arr = get_arrow_list_array<int64_t>({1, 2, 3, 4, 5, 6, 7, 8, 9}, {0, 2, 4, 5, 6, 7, 9});
std::vector<int32_t> offset{0, 3, 4, 6};
auto nested_list_arr = std::make_shared<arrow::ListArray>(
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<std::shared_ptr<arrow::Array>> child_arrays2({str2_array, int2_array});
auto fields2 = std::vector<std::shared_ptr<arrow::Field>>{
Expand Down
4 changes: 2 additions & 2 deletions cpp/tests/interop/to_arrow_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -261,14 +261,14 @@ TEST_F(ToArrowTest, NestedList)
std::vector<int32_t> offset{0, 0, 2};
auto mask_buffer = arrow::internal::BytesToBits({0, 1}).ValueOrDie();
auto nested_list_arr = std::make_shared<arrow::ListArray>(
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<std::shared_ptr<arrow::Field>> schema_vector(
{arrow::field("a", nested_list_arr->type())});
{arrow::field("a", nested_list_arr->type(), false)});
auto schema = std::make_shared<arrow::Schema>(schema_vector);

auto expected_arrow_table = arrow::Table::Make(schema, {nested_list_arr});
Expand Down

0 comments on commit 8b7127f

Please sign in to comment.