-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
GH-45167: [C++] Implement Compute Equals for List Types #45272
base: main
Are you sure you want to change the base?
Changes from all commits
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 |
---|---|---|
|
@@ -445,6 +445,14 @@ std::shared_ptr<ScalarFunction> MakeCompareFunction(std::string name, FunctionDo | |
DCHECK_OK(func->AddKernel({ty, ty}, boolean(), std::move(exec))); | ||
} | ||
|
||
if constexpr (std::is_same_v<Op, Equal> || std::is_same_v<Op, NotEqual>) { | ||
for (const auto id : {Type::LIST, Type::LARGE_LIST}) { | ||
auto exec = GenerateList<applicator::ScalarBinaryEqualTypes, BooleanType, Op>(id); | ||
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. Another approach with perhaps a better performance potential would be to leverage the existing 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. Thanks for the heads up - I will give that a look. So I see all of the functions right now in the compare module are registered via 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. Also I'm guessing the FWIW though I did benchmark the current implementation and it was definitely slow. Seemed about 1000x slower than an equivalent comparison using primitive types 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.
I think we can avoid that by directly calling into
A list scalar's value is actually an array, so that should not necessarily be a problem. |
||
DCHECK_OK( | ||
func->AddKernel({InputType(id), InputType(id)}, boolean(), std::move(exec))); | ||
} | ||
} | ||
|
||
return func; | ||
} | ||
|
||
|
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.
The alternative to calling
ToArray
with the cast would be to implement something likevalue_slice
on theArraySpan
directly, although I'm not sure if theArraySpan
is supposed to return anything but pointers to primitives (as is currently implemeted)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 is going to be slow, so we probably want to avoid this IMHO.
You may want to run a crude benchmark from Python to check this.