The given expression simplifies to `value` if the inequality target is not nullable. Otherwise, it simplifies to either a call to true_unless_null or !true_unless_null.
| 1219 | /// target is not nullable. Otherwise, it simplifies to either a |
| 1220 | /// call to true_unless_null or !true_unless_null. |
| 1221 | Result<Expression> simplified_to(const Expression& bound_target, bool value) const { |
| 1222 | if (!nullable) return literal(value); |
| 1223 | |
| 1224 | ExecContext exec_context; |
| 1225 | |
| 1226 | // Data may be null, so comparison will yield `value` - or null IFF the data was null |
| 1227 | // |
| 1228 | // true_unless_null is cheap; it purely reuses the validity bitmap for the values |
| 1229 | // buffer. Inversion is less cheap but we expect that term never to be evaluated |
| 1230 | // since invert(true_unless_null(x)) is not satisfiable. |
| 1231 | Expression::Call call; |
| 1232 | call.function_name = "true_unless_null"; |
| 1233 | call.arguments = {bound_target}; |
| 1234 | ARROW_ASSIGN_OR_RAISE( |
| 1235 | auto true_unless_null, |
| 1236 | BindNonRecursive(std::move(call), |
| 1237 | /*insert_implicit_casts=*/false, &exec_context)); |
| 1238 | if (value) return true_unless_null; |
| 1239 | |
| 1240 | Expression::Call invert; |
| 1241 | invert.function_name = "invert"; |
| 1242 | invert.arguments = {std::move(true_unless_null)}; |
| 1243 | return BindNonRecursive(std::move(invert), |
| 1244 | /*insert_implicit_casts=*/false, &exec_context); |
| 1245 | } |
| 1246 | |
| 1247 | /// Simplify an `is_in` call against an inequality guarantee. |
| 1248 | /// |
nothing calls this directly
no test coverage detected