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

Function DecimalsHaveSameScale

cpp/src/arrow/compute/kernel.cc:500–520  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

498}
499
500std::shared_ptr<MatchConstraint> DecimalsHaveSameScale() {
501 class DecimalsHaveSameScaleConstraint : public MatchConstraint {
502 public:
503 bool Matches(const std::vector<TypeHolder>& types) const override {
504 DCHECK_GE(types.size(), 2);
505 DCHECK(std::all_of(types.begin(), types.end(),
506 [](const TypeHolder& type) { return is_decimal(type.id()); }));
507 const auto& ty0 = checked_cast<const DecimalType&>(*types[0].type);
508 auto s0 = ty0.scale();
509 for (size_t i = 1; i < types.size(); ++i) {
510 const auto& ty = checked_cast<const DecimalType&>(*types[i].type);
511 if (ty.scale() != s0) {
512 return false;
513 }
514 }
515 return true;
516 }
517 };
518 static auto instance = std::make_shared<DecimalsHaveSameScaleConstraint>();
519 return instance;
520}
521
522// ----------------------------------------------------------------------
523// KernelSignature

Callers 3

TESTFunction · 0.85
MakeCompareFunctionFunction · 0.85
AddDecimalBinaryKernelsFunction · 0.85

Calls

no outgoing calls

Tested by 1

TESTFunction · 0.68