-
Notifications
You must be signed in to change notification settings - Fork 4k
ARROW-12955: [C++] Add additional type support for if_else kernel #10538
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
Conversation
lidavidm
left a comment
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 good on a first pass. I suggested some minor simplifications.
c046e4a to
f3b2258
Compare
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.
IMO these cases could be consolidated into one or two checks since there are only 12 cases here (or 5 if you want to prune: null cond, true cond with null/non-null left array, false cond with null/non-null right array).
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.
well, there are 64 cases TBH. Each param can be null/ non-null and scalar/ array (4 variations). Since we have 3 params we have 4x4x4 = 64 permutations. 🙂
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.
CheckWithDifferentShapes actually checks for all those cases + with offsets. But I agree, in CheckWithDifferentShapes it could check similar cases redundantly in several iterations. But we decided to leave it as it is.
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.
minor nit but I wonder if the compiler could generate similar (enough) code from a
struct CopyBinaryBulk {
const offset_type* offsets;
const uint8_t* values;
offset_type* out_offsets;
uint8_t* out_values;
operator()(...) { ... }
};
so you don't have to copy-paste these everywhere
|
N.B. it looks like this segfaults in the tests on Windows MSVC 2019 (https://github.com/apache/arrow/pull/10538/checks?check_run_id=2966481230#step:8:339) and there are various errors on Clang, MSVC, and MinGW (mostly related to implicit casts or needing to explicitly parameterize std::max). |
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.
nit: just data() here?
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.
maybe checked_cast<const FixedSizeBinaryType&>(*left.type()) or checked_pointer_cast<FixedSizeBinaryType>(left.type()) (will be dynamic cast in debug, static cast in release)
|
Looks like this also needs to be rebased now. But once that's done and the nits above are addressed I think this can be merged. |
…hods inside annon ns
0681ec3 to
ad17b68
Compare
# Conflicts: # cpp/src/arrow/compute/kernels/scalar_if_else.cc # cpp/src/arrow/compute/kernels/scalar_if_else_benchmark.cc # cpp/src/arrow/compute/kernels/scalar_if_else_test.cc
This PR adds fixed and variable binary type support