Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement interleave_columns for list type #8046

Merged
merged 40 commits into from
May 3, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
4e7336b
Add `lists/interleave_columns.cuh|cu` files
ttnghia Apr 13, 2021
4921a8d
Remove headers from `interleave_columns_tests.cpp`
ttnghia Apr 14, 2021
e61170e
Add skeleton for `interleave_columns` that supports `list_view`
ttnghia Apr 14, 2021
07beb16
Finish doxygen and declaration for `lists::interleave_columns`
ttnghia Apr 14, 2021
90f6973
Add call to `lists::interleave_columns`
ttnghia Apr 14, 2021
f70fb41
WIP for `lists::interleave_columns`
ttnghia Apr 14, 2021
7aa2120
Finish InvalidInput test
ttnghia Apr 14, 2021
3065577
Rewrite input validation
ttnghia Apr 14, 2021
180cc21
Rewrite InvalidInput test and add skeleton for other tests
ttnghia Apr 14, 2021
b7f994e
Rewrite ConcatenateEmptyColumns test
ttnghia Apr 14, 2021
c5a5814
Finish SimpleInputNoNull and SimpleInputStringsColumnsNoNull tests
ttnghia Apr 14, 2021
ea08f43
Finish SimpleInputWithNulls test
ttnghia Apr 14, 2021
83305be
Finish SimpleInputStringsColumnsWithNulls
ttnghia Apr 14, 2021
76c4876
Finish SlicedColumnsInputNoNull and SlicedColumnsInputWithNulls tests
ttnghia Apr 14, 2021
414dc9b
Rewrite doxygen
ttnghia Apr 21, 2021
dcf95ef
Add a function to compute the offsets of the output lists column
ttnghia Apr 21, 2021
64dad79
Fix doxygen again
ttnghia Apr 21, 2021
b5dd17c
Finish skeleton for `lists::detail::interleave_columns`
ttnghia Apr 21, 2021
7908f64
Refactor
ttnghia Apr 21, 2021
8c4b458
Implementation for fixed with
ttnghia Apr 22, 2021
45ed175
Fix error
ttnghia Apr 22, 2021
9ac0143
Draft
ttnghia Apr 22, 2021
a406543
Fix a bug in unit tests
ttnghia Apr 23, 2021
e1c0a5a
working
ttnghia Apr 23, 2021
00be57d
Merge branch 'branch-0.20' into lists_interleave
ttnghia Apr 23, 2021
ac31b2e
Complete
ttnghia Apr 23, 2021
f9a02be
Implement `interleave_columns` for list type
ttnghia Apr 23, 2021
48a6b14
Use `thrust::identity` and `thrust::copy`
ttnghia Apr 23, 2021
9d66ce2
Edit comments
ttnghia Apr 28, 2021
add80fa
Merge branch 'branch-0.20' into lists_columns_interleave
ttnghia Apr 28, 2021
467845f
Fix doxygen
ttnghia Apr 28, 2021
53dda6d
Change `size_type` to `offset_type`
ttnghia Apr 28, 2021
0ccb82f
Rename variables and some other improvements
ttnghia Apr 28, 2021
ed45140
Rewrite unit tests
ttnghia Apr 28, 2021
d22c317
Add keyword `template` to template function calls
ttnghia Apr 28, 2021
0e50dfc
Add header to conda recipes
ttnghia Apr 28, 2021
a470368
Add `template` keyword to template function calls
ttnghia Apr 28, 2021
2b5c9e8
Rewrite comments and rename variables
ttnghia Apr 28, 2021
2581176
Merge branch 'branch-0.20' into lists_columns_interleave
ttnghia Apr 30, 2021
cca057c
Rewrite unit tests
ttnghia Apr 30, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions conda/recipes/libcudf/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ test:
- test -f $PREFIX/include/cudf/lists/detail/concatenate.hpp
- test -f $PREFIX/include/cudf/lists/detail/copying.hpp
- test -f $PREFIX/include/cudf/lists/detail/drop_list_duplicates.hpp
- test -f $PREFIX/include/cudf/lists/detail/interleave_columns.hpp
- test -f $PREFIX/include/cudf/lists/detail/sorting.hpp
- test -f $PREFIX/include/cudf/lists/count_elements.hpp
- test -f $PREFIX/include/cudf/lists/explode.hpp
Expand Down
3 changes: 2 additions & 1 deletion cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -268,9 +268,10 @@ add_library(cudf
src/lists/copying/gather.cu
src/lists/copying/segmented_gather.cu
src/lists/count_elements.cu
src/lists/drop_list_duplicates.cu
src/lists/explode.cu
src/lists/extract.cu
src/lists/drop_list_duplicates.cu
src/lists/interleave_columns.cu
src/lists/lists_column_factories.cu
src/lists/lists_column_view.cu
src/lists/segmented_sort.cu
Expand Down
55 changes: 55 additions & 0 deletions cpp/include/cudf/lists/detail/interleave_columns.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
/*
* Copyright (c) 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.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once

#include <cudf/column/column.hpp>
#include <cudf/table/table_view.hpp>

#include <rmm/cuda_stream_view.hpp>

namespace cudf {
namespace lists {
namespace detail {

/**
* @brief Returns a single column by interleaving rows of the given table of list elements.
*
* @code{.pseudo}
* s1 = [{0, 1}, {2, 3, 4}, {5}, {}, {6, 7}]
* s2 = [{8}, {9}, {}, {10, 11, 12}, {13, 14, 15, 16}]
* r = lists::interleave_columns(s1, s2)
* r is now [{0, 1}, {8}, {2, 3, 4}, {9}, {5}, {}, {}, {10, 11, 12}, {6, 7}, {13, 14, 15, 16}]
* @endcode
*
* @throws cudf::logic_error if any column of the input table is not a lists columns.
* @throws cudf::logic_error if any lists column contains nested typed entry.
* @throws cudf::logic_error if all lists columns do not have the same entry type.
*
* @param input Table containing lists columns to interleave.
* @param has_null_mask A boolean flag indicating that the input columns have a null mask.
* @param stream CUDA stream used for device memory operations and kernel launches.
* @param mr Device memory resource used to allocate the returned column's device memory.
* @return The interleaved columns as a single column.
*/
std::unique_ptr<column> interleave_columns(
table_view const& input,
bool has_null_mask,
rmm::cuda_stream_view stream,
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource());

} // namespace detail
} // namespace lists
} // namespace cudf
Loading