MCPcopy Create free account
hub / github.com/apache/arrow / AddDecimalBinaryKernels

Function AddDecimalBinaryKernels

cpp/src/arrow/compute/kernels/scalar_arithmetic.cc:683–709  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

681
682template <typename Op>
683void AddDecimalBinaryKernels(const std::string& name, ScalarFunction* func) {
684 OutputType out_type(null());
685 std::shared_ptr<MatchConstraint> constraint = nullptr;
686 const std::string op = name.substr(0, name.find("_"));
687 if (op == "add" || op == "subtract") {
688 out_type = OutputType(ResolveDecimalAdditionOrSubtractionOutput);
689 constraint = DecimalsHaveSameScale();
690 } else if (op == "remainder" || op == "modulo") {
691 out_type = OutputType(ResolveDecimalRemainderOutput);
692 constraint = DecimalsHaveSameScale();
693 } else if (op == "multiply") {
694 out_type = OutputType(ResolveDecimalMultiplicationOutput);
695 } else if (op == "divide") {
696 out_type = OutputType(ResolveDecimalDivisionOutput);
697 } else {
698 DCHECK(false);
699 }
700
701 auto in_type128 = InputType(Type::DECIMAL128);
702 auto in_type256 = InputType(Type::DECIMAL256);
703 auto exec128 = ScalarBinaryNotNullEqualTypes<Decimal128Type, Decimal128Type, Op>::Exec;
704 auto exec256 = ScalarBinaryNotNullEqualTypes<Decimal256Type, Decimal256Type, Op>::Exec;
705 DCHECK_OK(func->AddKernel({in_type128, in_type128}, out_type, exec128, /*init=*/nullptr,
706 constraint));
707 DCHECK_OK(func->AddKernel({in_type256, in_type256}, out_type, exec256, /*init=*/nullptr,
708 constraint));
709}
710
711template <typename Op>
712void AddHalfFloatUnaryKernel(ScalarFunction* func) {

Callers

nothing calls this directly

Calls 6

OutputTypeFunction · 0.85
DecimalsHaveSameScaleFunction · 0.85
InputTypeFunction · 0.85
substrMethod · 0.80
findMethod · 0.45
AddKernelMethod · 0.45

Tested by

no test coverage detected