tadeja commented on code in PR #48914:
URL: https://github.com/apache/arrow/pull/48914#discussion_r3894939482
##########
cpp/src/arrow/compute/kernels/scalar_arithmetic.cc:
##########
@@ -663,7 +663,7 @@ void AddDecimalBinaryKernels(const std::string& name,
ScalarFunction* func) {
OutputType out_type(null());
std::shared_ptr<MatchConstraint> constraint = nullptr;
const std::string op = name.substr(0, name.find("_"));
- if (op == "add" || op == "subtract") {
+ if (op == "add" || op == "subtract" || op == "remainder" || op == "mod") {
out_type = OutputType(ResolveDecimalAdditionOrSubtractionOutput);
constraint = DecimalsHaveSameScale();
Review Comment:
```suggestion
if (op == "add" || op == "subtract") {
out_type = OutputType(ResolveDecimalAdditionOrSubtractionOutput);
constraint = DecimalsHaveSameScale();
} else if (op == "remainder" || op == "modulo") {
out_type = OutputType(ResolveDecimalRemainderOutput);
constraint = DecimalsHaveSameScale();
```
##########
cpp/src/arrow/compute/kernels/scalar_arithmetic.cc:
##########
Review Comment:
```suggestion
Result<TypeHolder> ResolveDecimalRemainderOutput(KernelContext*,
const
std::vector<TypeHolder>& types) {
return ResolveDecimalBinaryOperationOutput(
types,
[](int32_t p1, int32_t s1, int32_t p2,
int32_t s2) -> Result<std::pair<int32_t, int32_t>> {
DCHECK_EQ(s1, s2);
return std::make_pair(std::max(p1, p2), s1);
});
}
```
##########
cpp/src/arrow/compute/kernels/scalar_arithmetic.cc:
##########
@@ -663,7 +663,7 @@ void AddDecimalBinaryKernels(const std::string& name,
ScalarFunction* func) {
OutputType out_type(null());
std::shared_ptr<MatchConstraint> constraint = nullptr;
const std::string op = name.substr(0, name.find("_"));
- if (op == "add" || op == "subtract") {
+ if (op == "add" || op == "subtract" || op == "remainder" || op == "mod") {
out_type = OutputType(ResolveDecimalAdditionOrSubtractionOutput);
constraint = DecimalsHaveSameScale();
Review Comment:
(suggestion for point 2))
##########
cpp/src/arrow/compute/kernels/scalar_arithmetic.cc:
##########
Review Comment:
(suggestion for point 2))
--
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]