You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by "LuciferYang (via GitHub)" <gi...@apache.org> on 2026/10/01 11:30:56 UTC
[PR] fix(expression): treat COUNT(*) as referencing no fields in GetReferencedFieldIds [iceberg-cpp]
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: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
Re: [PR] fix(expression): treat COUNT(*) as referencing no fields in GetReferencedFieldIds [iceberg-cpp]
Posted by "LuciferYang (via GitHub)" <gi...@apache.org>.
LuciferYang commented on PR #981:
URL: https://github.com/apache/iceberg-cpp/pull/981#issuecomment-6140767266
Thank you @wgtmac @kamcheungting-db
--
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: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
Re: [PR] fix(expression): treat COUNT(*) as referencing no fields in GetReferencedFieldIds [iceberg-cpp]
Posted by "wgtmac (via GitHub)" <gi...@apache.org>.
wgtmac merged PR #981:
URL: https://github.com/apache/iceberg-cpp/pull/981
--
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: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org