edponce commented on code in PR #11115:
URL: https://github.com/apache/arrow/pull/11115#discussion_r924678152
##########
cpp/src/arrow/compute/kernels/scalar_arithmetic.cc:
##########
@@ -1001,6 +1001,95 @@ struct Trunc {
}
};
+// TODO(edponce): Move builders to function state and reset.
+struct Divmod {
+ template <typename T, typename Arg0, typename Arg1>
+ static enable_if_floating_value<T, FixedSizeListScalar> Call(KernelContext*
ctx, Arg0 dividend, Arg1 divisor, Status* st) {
+ T quotient = std::floor(dividend / divisor);
+ T remainder = dividend - quotient * divisor;
+
+ NumericBuilder<T> builder;
+ builder.Append(quotient);
+ builder.Append(remainder);
+ std::shared_ptr<Array> array;
+ builder.Finish(&array);
+ FixedSizeListScalar list(array, builder.type())
Review Comment:
Ok, I will revert to a `StructArray`. Thanks!
--
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]