-
Notifications
You must be signed in to change notification settings - Fork 915
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support create lists column from a
list_scalar
(#8185)
This PR adds support to `make_column_from_scalar` for `list_scalar`. For 0-length columns, a well-formed `LIST` type column, whose child column has the same column hierarchy to the row data stored in `list_scalar` is returned. Example: ``` slr.data = [1, 2, 3] // An integer list of 1, 2, 3, `data` is an INT column make_column_from_scalar(s, 2) // List<int> column: {[1, 2, 3], [1, 2, 3]}, whose child column is an `INT` column. slr.data = [[1, 2], [3]] // A list of integer lists, `data` is a List<int> column make_column_from_scalar(s, 0) // Well formed, 0-length List<List<int>> column, whose child column is a List<int> column. ``` Closes #8088 Authors: - Michael Wang (https://github.com/isVoid) Approvers: - AJ Schmidt (https://github.com/ajschmidt8) - Devavret Makkar (https://github.com/devavret) - Mark Harris (https://github.com/harrism) URL: #8185
- Loading branch information
Showing
6 changed files
with
413 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/* | ||
* 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. | ||
*/ | ||
|
||
#include <cudf/column/column.hpp> | ||
#include <cudf/scalar/scalar.hpp> | ||
#include <cudf/types.hpp> | ||
|
||
namespace cudf { | ||
namespace lists { | ||
namespace detail { | ||
|
||
/** | ||
* @brief Internal API to construct a lists column from a `list_scalar`, for public | ||
* use, use `cudf::make_column_from_scalar`. | ||
* | ||
* @param[in] value The `list_scalar` to construct from | ||
* @param[in] size The number of rows for the output column. | ||
* @param[in] stream CUDA stream used for device memory operations and kernel launches. | ||
* @param[in] mr Device memory resource used to allocate the returned column's device memory. | ||
*/ | ||
std::unique_ptr<cudf::column> make_lists_column_from_scalar( | ||
list_scalar const& value, | ||
size_type size, | ||
rmm::cuda_stream_view stream = rmm::cuda_stream_default, | ||
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource()); | ||
|
||
} // namespace detail | ||
} // namespace lists | ||
} // namespace cudf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.