lidavidm commented on code in PR #12891:
URL: https://github.com/apache/arrow/pull/12891#discussion_r853427405
##########
cpp/src/arrow/compute/exec/expression.cc:
##########
@@ -305,19 +308,47 @@ bool Expression::IsNullLiteral() const {
return false;
}
-bool Expression::IsSatisfiable() const {
- if (type() && type()->id() == Type::NA) {
- return false;
+namespace {
+util::optional<compute::NullHandling::type> GetNullHandling(
+ const Expression::Call& call) {
+ DCHECK_NE(call.function, nullptr);
+ if (call.function->kind() == compute::Function::SCALAR) {
+ return static_cast<const
compute::ScalarKernel*>(call.kernel)->null_handling;
}
+ return util::nullopt;
+}
+} // namespace
+
+bool Expression::IsSatisfiable() const {
+ if (!type()) return true;
+ if (type()->id() != Type::BOOL) return true;
if (auto lit = literal()) {
if (lit->null_count() == lit->length()) {
return false;
}
- if (lit->is_scalar() && lit->type()->id() == Type::BOOL) {
+ if (lit->is_scalar()) {
return lit->scalar_as<BooleanScalar>().value;
}
+
+ return true;
+ }
+
+ if (field_ref()) return true;
+
+ auto call = CallNotNull(*this);
+
+ if (call->function_name == "invert") {
+ if (auto nested_call = call->arguments[0].call()) {
+ if (nested_call->function_name == "true_unless_null") return false;
+ }
+ }
+
+ if (call->function_name == "and_kleene") {
Review Comment:
I'll move the explanation from
https://issues.apache.org/jira/browse/ARROW-13848
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]