cshannon commented on issue #3348:
URL: https://github.com/apache/accumulo/issues/3348#issuecomment-1528838346

   I only briefly looked this over so it needs to be investigated in more 
detail but at first glance it seems like we could simply check for a negative 
value and return Long.MAX_VALUE instead of the negative when it overflows. We'd 
also need to be careful to not overflow elsewhere as well. For example, we 
iterate 
[here](https://github.com/apache/accumulo/blob/main/hadoop-mapreduce/src/main/java/org/apache/accumulo/hadoopImpl/mapreduce/BatchInputSplit.java#L113)
 and sum the total so that could overflow as well.
   
   There is a 
[method](https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Math.html#addExact(long,long))
 in the Math class that could be of use here to detect overflow but it's 
normally used for adding and this is doing bit shifting so not sure there are 
any utilities to help here. 


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

Reply via email to