Phoenix500526 commented on PR #273:
URL: 
https://github.com/apache/datasketches-rust/pull/273#issuecomment-5536464460

   > > Distinguish valid empty sketches from invalid query arguments across 
T-Digest, KLL, and REQ without changing deserialization errors.
   > 
   > Could you give a brief on the design? Otherwise I have to reverse 
engineering the code to understand the intention. Even if with AI assistant the 
intention can drift.
   
   The query APIs currently handle empty sketches and invalid arguments 
inconsistently: KLL and REQ report an empty sketch as InvalidArgument, while 
T-Digest returns None for an empty sketch but panics on invalid query 
arguments. This PR adopts one contract across the three implementations. A 
fallible query returns Ok(Some(value)) for a valid query on a non-empty sketch, 
Ok(None) for a valid query on an empty sketch, and Err(InvalidArgument) for an 
invalid rank, NaN value, or invalid split points. Validation runs before the 
empty-state check, so an invalid query against an empty sketch still returns an 
error. Queries without an invalid-argument path, such as rank on KLL and REQ, 
return Option directly. Deserialization continues to return InvalidData; the 
serialization format and deserialization behavior are unchanged.
   
   The implementation applies this contract to mutable and immutable T-Digest 
queries and to both Sketch and SortedView for KLL and REQ. The rest of the diff 
updates callers, examples, benchmarks, and existing tests to the new return 
types, with regression coverage for empty queries, invalid arguments, and their 
precedence.


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