szehon-ho commented on code in PR #17546:
URL: https://github.com/apache/iceberg/pull/17546#discussion_r3798937176
##########
core/src/main/java/org/apache/iceberg/BasePartitionStatistics.java:
##########
@@ -173,7 +173,8 @@ private Object getByPos(int pos) {
case DV_COUNT_POSITION:
return dvCount;
default:
- throw new UnsupportedOperationException("Unknown position: " + pos);
+ throw new UnsupportedOperationException(
+ "Unknown position: " + pos + " (expected 0-" + DV_COUNT_POSITION +
")");
Review Comment:
`DV_COUNT_POSITION` is a compile-time constant `12`, so this is equivalent
to hardcoding the bound rather than deriving it. Positions are appended in
schema order, so the next statistic would be `13` and both messages would then
report `expected 0-12` while `13` is valid — asserting something false instead
of just being unhelpful.
`BASE_TYPE.fields().size() - 1` is the bound that actually self-updates (the
constructor already uses `BASE_TYPE.fields().size()`). A small private helper
for the exception would also avoid duplicating this in `internalSet`.
--
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]