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

Method Matches

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

Source from the content-addressed store, hash-verified

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;

Callers

nothing calls this directly

Calls 6

is_decimalFunction · 0.50
sizeMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
idMethod · 0.45
scaleMethod · 0.45

Tested by

no test coverage detected