| 681 | |
| 682 | template <typename Op> |
| 683 | void 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 | |
| 711 | template <typename Op> |
| 712 | void AddHalfFloatUnaryKernel(ScalarFunction* func) { |
nothing calls this directly
no test coverage detected