LuciferYang opened a new pull request, #981:
URL: https://github.com/apache/iceberg-cpp/pull/981

   ## What
   
   `ReferenceVisitor::GetReferencedFieldIds` crashed on a bound `COUNT(*)`. 
`ReferenceVisitor::Aggregate` dereferenced `aggregate->reference()`, which is 
`nullptr` for `COUNT(*)` (its term is null by construction). The visitor is 
reached through the exported `GetReferencedFieldIds`, so a consumer doing 
aggregate pushdown would segfault on the most common SQL aggregate.
   
   Closes #978.
   
   ## How
   
   `Aggregate` now inserts the field id only when `reference()` is non-null, so 
`COUNT(*)` contributes nothing (it references no columns). `COUNT(col)` / `MAX` 
/ `MIN` keep their existing behavior.
   
   ## Testing
   
   Two tests in `expression_visitor_test.cc`:
   
   - `CountStar` — binding `COUNT(*)` and calling `GetReferencedFieldIds` 
returns an empty set. Without the fix this segfaults the test binary at the 
null dereference.
   - `AggregateWithTerm` — `MAX(age)` still reports its field id `{3}`, pinning 
the non-null branch so a mutation that drops or inverts the guard is caught.
   


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