iverase commented on PR #12460:
URL: https://github.com/apache/lucene/pull/12460#issuecomment-1735063044

   I have been thinking a bit longer about this and I think this approach of 
`DataInput` is not right. Instead we should try to return an API more similar 
to `RandomAccessInput` as Uwe suggested. 
   
   What convinces me is the fact that `BytesRef` can easily implement (and 
maybe should) RandomAccessInput. Unfortunately it is not straightforward to 
change BytesRef with RandomAccessInput as we are doing things with BytesRef 
that are challenging to implement generically:
   
   - Maybe we should add the length of the `RandomAccessInput` to the API? ` 
public long length()`
   - We can copy the contents of a `RandomAccessInput` byte by byte, should we 
add a bulk copy method like  ` public byte readBytes(long pos, byte[] b,  int 
offset, int length) throws IOException;`?
   - Can RandomAccessInput implement Comparable?
   - Can RandomAccessInput implementation have implementations of equals and 
hashCode?
   
   The first two are easy to implement and maybe we should do it regardless 
this issue. The other two are much trickier.
   
   


-- 
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-unsubscr...@lucene.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org
For additional commands, e-mail: issues-h...@lucene.apache.org

Reply via email to