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

Method ExtractOneFromComparison

cpp/src/arrow/compute/expression.cc:1197–1216  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1195 }
1196
1197 static std::optional<Inequality> ExtractOneFromComparison(const Expression& guarantee) {
1198 auto call = guarantee.call();
1199 if (!call) return std::nullopt;
1200
1201 if (auto cmp = Comparison::Get(call->function_name)) {
1202 // not_equal comparisons are not very usable as guarantees
1203 if (*cmp == Comparison::NOT_EQUAL) return std::nullopt;
1204
1205 auto target = call->arguments[0].field_ref();
1206 if (!target) return std::nullopt;
1207
1208 auto bound = call->arguments[1].literal();
1209 if (!bound) return std::nullopt;
1210 if (!bound->is_scalar()) return std::nullopt;
1211
1212 return Inequality{*cmp, /*target=*/*target, *bound, /*nullable=*/false};
1213 }
1214
1215 return std::nullopt;
1216 }
1217
1218 /// The given expression simplifies to `value` if the inequality
1219 /// target is not nullable. Otherwise, it simplifies to either a

Callers

nothing calls this directly

Calls 5

callMethod · 0.80
field_refMethod · 0.80
literalMethod · 0.80
is_scalarMethod · 0.80
GetFunction · 0.70

Tested by

no test coverage detected