Skip to content

Commit

Permalink
Fix returned column type when extracting from an empty list column (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
jlowe authored Apr 22, 2021
1 parent 86897fb commit bbeb2aa
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions cpp/src/lists/extract.cu
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020, NVIDIA CORPORATION.
* Copyright (c) 2020-2021, NVIDIA CORPORATION.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -63,7 +63,7 @@ std::unique_ptr<column> extract_list_element(lists_column_view lists_column,
rmm::cuda_stream_view stream,
rmm::mr::device_memory_resource* mr)
{
if (lists_column.is_empty()) return empty_like(lists_column.parent());
if (lists_column.is_empty()) return empty_like(lists_column.child());
auto const offsets_column = lists_column.offsets();

// create a column_view with attributes of the parent and data from the offsets
Expand Down
3 changes: 2 additions & 1 deletion cpp/tests/lists/extract_tests.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019-2020, NVIDIA CORPORATION.
* Copyright (c) 2019-2021, NVIDIA CORPORATION.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -215,6 +215,7 @@ TEST_F(ListsExtractTest, ExtractElementEmpty)

LCW empty{};
auto result = cudf::lists::extract_list_element(cudf::lists_column_view(empty), 1);
EXPECT_EQ(cudf::data_type{cudf::type_id::STRING}, result->type());
EXPECT_EQ(0, result->size());

LCW empty_strings({LCW{"", "", ""}});
Expand Down

0 comments on commit bbeb2aa

Please sign in to comment.