felipecrv commented on code in PR #41363:
URL: https://github.com/apache/arrow/pull/41363#discussion_r1600293888
##########
cpp/src/arrow/compute/kernels/scalar_if_else.cc:
##########
@@ -1195,6 +1195,43 @@ struct ResolveIfElseExec<NullType, AllocateMem> {
}
};
+template <typename ResolverForOtherTypes>
+Result<TypeHolder> ResolveDecimalCaseType(KernelContext* ctx,
+ const std::vector<TypeHolder>& types,
+ ResolverForOtherTypes&& resolver) {
+ if (!HasDecimal(types)) {
+ return resolver(ctx, types);
+ }
+
+ int32_t max_precision = 0, max_scale = 0;
+ for (auto& type : types) {
+ if (is_floating(type.id()) || is_integer(type.id())) {
+ return Status::Invalid("Need to cast numeric types containing decimal
types");
Review Comment:
I think a better approach for these failures is to have kernels that fail.
You write input matchers to cover all cases and dispatch to the fail kernels
for types that can't be handled without casts.
##########
cpp/src/arrow/compute/kernels/scalar_if_else.cc:
##########
@@ -1195,6 +1195,43 @@ struct ResolveIfElseExec<NullType, AllocateMem> {
}
};
+template <typename ResolverForOtherTypes>
+Result<TypeHolder> ResolveDecimalCaseType(KernelContext* ctx,
Review Comment:
Name suggestion: `ResolveDecimalCaseWhenOutputType`
Because "DecimalCase" is ambiguous by "case" being a word that would fit
here, but it actually refers to the kernel function called "CaseWhen".
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]