leerho opened a new pull request, #791: URL: https://github.com/apache/datasketches-java/pull/791
Docs only. The quantiles API javadoc said that every query on an empty sketch throws `IllegalArgumentException`, but only some implementations do. A caller who followed the docs would miss the exception from a KLL sketch, because `SketchesArgumentException` extends `RuntimeException`, not `IllegalArgumentException`. ## What each sketch actually throws on an empty sketch | Methods | KLL (doubles, floats, longs, items) | `QuantilesDoublesSketch`, `QuantilesItemsSketch`, `ReqSketch` | |---|---|---| | `getQuantile(s)`, `getRank(s)`, `getPMF`, `getCDF`, `getMin/MaxItem`, `getQuantileLower/UpperBound` | `SketchesArgumentException` | `IllegalArgumentException` | | `getSortedView()` | `SketchesArgumentException` | `SketchesArgumentException` | | `getPartitionBoundariesFrom*()` (items sketches) | `IllegalArgumentException` | `IllegalArgumentException` | I found this by calling every documented method on an empty instance of each implementation, including the heapify, wrap and compact forms. ## Changes - `QuantilesDoublesAPI`, `QuantilesFloatsAPI`, `QuantilesGenericAPI`: each "if sketch is empty" `@throws` now names both cases, for example `SketchesArgumentException` for `KllFloatsSketch` and `IllegalArgumentException` for `ReqSketch`. - `QuantilesLongsAPI`, which only KLL implements, now names `SketchesArgumentException`. - `PartitioningFeature`: adds the missing `@throws IllegalArgumentException if sketch is empty`. - `GenericPartitionBoundaries.getMinItem()` / `getMaxItem()`: removes a `@throws` tag. They return a stored field and never throw. The `getSortedView()` docs were already correct. No behavior changes. Making the empty checks throw one exception type everywhere would change behavior for callers who catch `IllegalArgumentException`, so that is left for 10.0. ## Testing `mvn verify`, including javadoc and checkstyle: 2320 tests, 0 failures. 🤖 Generated with [Claude Code](https://claude.com/claude-code) -- 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]
