YoungRX opened a new issue, #34313:
URL: https://github.com/apache/arrow/issues/34313

   ### Describe the bug, including details regarding any error messages, 
version, and platform.
   
   Suppose there are 10 row groups and 1 column (name id) in a Parquet file. 
Each row group has 10000 data.
   Data distribution is as follows:
   > row_group_1: (1, 2, 3, ..., 10000); 
   > row_group_2: (10001, 10002, 10003, ..., 20000); 
   > ......
   > row_group_10: (90001, 90002, 90003, ..., 100000).
   
   Then I use `Future<util::optional<int64_t>> 
ParquetFileFormat::CountRows(const std::shared_ptr<FileFragment>& file, 
compute::Expression predicate, const std::shared_ptr<ScanOptions>& options)` to 
count the number of rows after predicate pushdown.
   If I set id < 12345 in compute::Expression, `CountRows` returns 
`util::nullopt`.
   If I set id < 20000 in compute::Expression, `CountRows` returns 
`util::nullopt`.
   If I set id < 20001, `CountRows` returns 
`util::make_optional<int64_t>(20000)`.
   I found that `ParquetFileFormat::CountRows` calls 
`ParquetFileFragment::TryCountRows`, and the code in 
`ParquetFileFragment::TryCountRows` is as follows:
   
   ```
         // Unless the row group is entirely included, bail out of fast path
         if (expressions[i] != compute::literal(true)) return util::nullopt;
   ```
   It is unreasonable. I think id < 12345 actually scans two row groups, the 
correct result for `CountRows` should be 20000. I hope you can solve this 
problem, or you have a different view.
   I'd like to ask a few more questions, and I hope you can answer them.
   
   > 1. For Parquet's predicate pushdown, is the filter level row group or page?
   > 2. If it's row group, would the filtering level of the page be more 
efficient?
   > 3. If it's page, can `ParquetFileFormat::CountRows` accurately calculate 
the number of rows corresponding to the predicate expression?
   > 4. And where is the key code about the above questions?
   
   ### Component(s)
   
   C++


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

Reply via email to