Richard-Durkee opened a new pull request, #137:
URL: https://github.com/apache/datafusion-iceberg/pull/137

   `EagerFileScanTaskProvider::partition_statistics` sums the `record_count` of 
its tasks and reports the result as `Inexact` whenever it's above zero. 
DataFusion only answers `COUNT(*)` from statistics when the row count is exact, 
so an unfiltered count still opens every data file. Follow-up to #125.
   
   A task returns exactly its `record_count` when it reads the whole file and 
has no row predicate and no delete files. When that holds for every task in the 
requested partition, we now report the sum as `Exact`. A task with a predicate 
or deletes keeps the sum `Inexact`, and a missing record count still gives 
`Absent`. Lazy scans are unchanged, because they don't know their files at 
planning time.
   
   The taxi test table has seven files of 25,000 rows and no deletes. With 
`iceberg.execution.eager_file_planning` on:
   
   ```sql
   SELECT count(*) FROM taxi;
   ```
   
   Before this PR:
   
   ```
   ProjectionExec: expr=[count(Int64(1))@0 as count(*)]
     AggregateExec: mode=Final, gby=[], aggr=[count(Int64(1))]
       CoalescePartitionsExec
         AggregateExec: mode=Partial, gby=[], aggr=[count(Int64(1))]
           DataSourceExec: format=iceberg, projection=[], provider=eager, 
planned_files=7
   ```
   
   With this PR:
   
   ```
   ProjectionExec: expr=[175000 as count(*)]
     PlaceholderRowExec
   ```
   
   The exact row count also turns the byte estimate into `Exact`, because 
`IcebergDataSource::partition_statistics` derives a missing byte size from the 
rows. The `eager_file_statistics_apply_fetch_per_partition` snapshot shows it. 
I left that alone, but I can keep the bytes `Inexact` if you'd prefer.
   
   The new test in `statistics.rs` counts reads with 
`ReadCountingStorageFactory`. It checks that the unfiltered count reads no data 
file, and that a count with a pushed-down predicate still does.
   


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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to