morningman opened a new pull request, #65060:
URL: https://github.com/apache/doris/pull/65060

   ## Proposed changes
   
   Backport of #64648 to branch-4.0.
   
   `IcebergScanNode.getCountFromSnapshot()` read `total-equality-deletes` /
   `total-position-deletes` / `total-records` from the Iceberg snapshot summary 
and
   called `.equals()` / `Long.parseLong()` directly on the `Map.get()` results. 
An
   Iceberg snapshot summary is **not guaranteed** to carry these `total-*` 
counters
   (snapshots written by compaction/replace, or some writers, may omit them), so
   `SELECT COUNT(*)` threw a `NullPointerException` on such tables while 
`SELECT *`
   worked fine.
   
   ### Fix
   
   - Extract the summary parsing into a pure static
     `IcebergUtils.getCountFromSummary(summary, ignoreDanglingDelete)` that
     null-checks the counters and falls back to a normal scan (`return -1`) 
when any
     required counter is absent, and reuse it from both `IcebergScanNode` and
     `IcebergUtils.getIcebergRowCount()`.
   - BE: `IcebergTableReader::init_row_filters()` accepts a table-level row 
count of
     `0` (`>= 0` instead of `> 0`) so a genuine pushed-down count of 0 takes the
     CountReader fast path. Applied to this branch's
     `be/src/vec/exec/format/table/iceberg_reader.cpp` (master's
     `iceberg_reader_mixin.h` does not exist on this branch).
   
   Unit test `IcebergCountPushDownTest` covers the missing-counter, no-delete,
   equality-delete, position-delete and zero-count cases.
   


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