pitrou commented on a change in pull request #7770:
URL: https://github.com/apache/arrow/pull/7770#discussion_r455064306



##########
File path: cpp/src/arrow/dataset/filter.cc
##########
@@ -772,13 +772,10 @@ std::shared_ptr<Expression> 
and_(std::shared_ptr<Expression> lhs,
 }
 
 std::shared_ptr<Expression> and_(const ExpressionVector& subexpressions) {
-  if (subexpressions.size() == 0) {
-    return scalar(true);
-  }
   return std::accumulate(
-      subexpressions.begin(), subexpressions.end(), 
std::shared_ptr<Expression>(),
+      subexpressions.begin(), subexpressions.end(), scalar(true),
       [](std::shared_ptr<Expression> acc, const std::shared_ptr<Expression>& 
next) {
-        return acc == nullptr ? next : and_(std::move(acc), next);
+        return acc->Equals(true) ? next : and_(std::move(acc), next);

Review comment:
       Hmm... As a sidenote, I'm sure this would be more readable (at least to 
me!) if rewritten as a plain loop rather than a `std::accumulate` call.




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to