| 141 | } |
| 142 | |
| 143 | static std::optional<std::pair<std::shared_ptr<Expression>, std::shared_ptr<Expression>>> |
| 144 | tryGetModuloSumPredicateInputs(const std::shared_ptr<Expression>& predicate) { |
| 145 | if (!isScalarFunction(predicate, function::EqualsFunction::name) || |
| 146 | predicate->getNumChildren() != 2) { |
| 147 | return std::nullopt; |
| 148 | } |
| 149 | auto modulo = predicate->getChild(0); |
| 150 | auto zero = predicate->getChild(1); |
| 151 | if (isInt64Literal(modulo, 0)) { |
| 152 | std::swap(modulo, zero); |
| 153 | } |
| 154 | if (!isInt64Literal(zero, 0) || !isScalarFunction(modulo, function::ModuloFunction::name) || |
| 155 | modulo->getNumChildren() != 2 || !isInt64Literal(modulo->getChild(1), 10)) { |
| 156 | return std::nullopt; |
| 157 | } |
| 158 | auto add = modulo->getChild(0); |
| 159 | if (!isScalarFunction(add, function::AddFunction::name) || add->getNumChildren() != 2) { |
| 160 | return std::nullopt; |
| 161 | } |
| 162 | return std::make_pair(add->getChild(0), add->getChild(1)); |
| 163 | } |
| 164 | |
| 165 | static std::unique_ptr<PhysicalOperator> tryMapPackedFilteredCount(PlanMapper& mapper, |
| 166 | main::ClientContext* clientContext, const LogicalAggregate& agg) { |
no test coverage detected