lidavidm commented on a change in pull request #10253:
URL: https://github.com/apache/arrow/pull/10253#discussion_r629645983



##########
File path: cpp/src/arrow/dataset/file_parquet.cc
##########
@@ -198,16 +198,27 @@ static util::optional<compute::Expression> 
ColumnChunkStatisticsAsExpression(
   auto maybe_min = min->CastTo(field->type());
   auto maybe_max = max->CastTo(field->type());
   if (maybe_min.ok() && maybe_max.ok()) {
-    auto col_min = maybe_min.MoveValueUnsafe();
-    auto col_max = maybe_max.MoveValueUnsafe();
-    if (col_min->Equals(col_max)) {
-      return compute::equal(std::move(field_expr), 
compute::literal(std::move(col_min)));
+    min = maybe_min.MoveValueUnsafe();
+    max = maybe_max.MoveValueUnsafe();
+
+    compute::Expression range;
+    if (min->Equals(max)) {
+      auto single_value = compute::equal(field_expr, 
compute::literal(std::move(min)));
+
+      if (statistics->null_count() == 0) {
+        return single_value;
+      }
+      return compute::or_(std::move(single_value), 
is_null(std::move(field_expr)));
     }
 
     auto lower_bound =
-        compute::greater_equal(field_expr, 
compute::literal(std::move(col_min)));
-    auto upper_bound =
-        compute::less_equal(std::move(field_expr), 
compute::literal(std::move(col_max)));
+        compute::greater_equal(field_expr, compute::literal(std::move(min)));
+    auto upper_bound = compute::less_equal(field_expr, 
compute::literal(std::move(max)));
+
+    if (statistics->null_count() == 0) {

Review comment:
       Was this meant to be `!= 0`?

##########
File path: cpp/src/arrow/compute/exec/expression_test.cc
##########
@@ -64,6 +64,12 @@ Expression cast(Expression argument, 
std::shared_ptr<DataType> to_type) {
               compute::CastOptions::Safe(std::move(to_type)));
 }
 
+Expression invert(Expression argument) { return call("invert", 
{std::move(argument)}); }

Review comment:
       Isn't this `compute::not_`?




-- 
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:
[email protected]


Reply via email to