-
Notifications
You must be signed in to change notification settings - Fork 902
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
Support nested types for nth_element reduction #9043
Changes from 5 commits
878c0f4
a360e0d
fbd1039
cdd1a0c
ae5f633
5d54751
a82e1b2
1077e70
01be163
608565a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,6 +20,8 @@ | |
#include <cudf/utilities/traits.hpp> | ||
#include <cudf/utilities/type_dispatcher.hpp> | ||
|
||
#include <cudf/copying.hpp> | ||
karthikeyann marked this conversation as resolved.
Show resolved
Hide resolved
|
||
#include <cudf/detail/copy.hpp> | ||
#include <rmm/cuda_stream_view.hpp> | ||
|
||
namespace cudf { | ||
|
@@ -165,4 +167,25 @@ std::unique_ptr<scalar> make_default_constructed_scalar(data_type type, | |
return type_dispatcher(type, default_scalar_functor{}, stream, mr); | ||
} | ||
|
||
std::unique_ptr<scalar> make_empty_scalar_like(column_view const& column, | ||
rmm::cuda_stream_view stream, | ||
rmm::mr::device_memory_resource* mr) | ||
{ | ||
std::unique_ptr<scalar> result; | ||
switch (column.type().id()) { | ||
case type_id::LIST: | ||
result = make_list_scalar(empty_like(column)->view(), stream, mr); | ||
result->set_valid_async(false, stream); | ||
break; | ||
case type_id::STRUCT: | ||
// Struct scalar inputs must have exactly 1 row. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should have "at least one row", I think... There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If so, you don't have to have your own There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Wait, then you should use
ttnghia marked this conversation as resolved.
Show resolved
Hide resolved
|
||
CUDF_EXPECTS(!column.is_empty(), "Can not create empty struct scalar"); | ||
result = detail::get_element(column, 1, stream, mr); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. index= There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How about There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Yes, I corrected it. Thanks! |
||
result->set_valid_async(false, stream); | ||
break; | ||
default: result = make_default_constructed_scalar(column.type(), stream, mr); | ||
} | ||
return result; | ||
} | ||
|
||
} // namespace cudf |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks like we need something like a
make_empty_scalar_like(column_view)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree. And I created the method
make_empty_scalar_like
based on the above code.