YutSean commented on a change in pull request #3940:
URL: https://github.com/apache/hbase/pull/3940#discussion_r771397933
##########
File path:
hbase-common/src/main/java/org/apache/hadoop/hbase/util/OrderedBytes.java
##########
@@ -716,9 +716,14 @@ private static int encodeNumericLarge(PositionedByteRange
dst, BigDecimal val) {
}
// normalize abs(val) to determine E
- while (abs.compareTo(E32) >= 0 && e <= 350) { abs = abs.movePointLeft(32);
e +=16; }
- while (abs.compareTo(E8) >= 0 && e <= 350) { abs = abs.movePointLeft(8);
e+= 4; }
- while (abs.compareTo(BigDecimal.ONE) >= 0 && e <= 350) { abs =
abs.movePointLeft(2); e++; }
+ int integerDigits = abs.precision() - abs.scale();
+ int lengthToMoveLeft = integerDigits % 2 == 0 ? integerDigits :
integerDigits + 1;
+ e = lengthToMoveLeft / 2;
+ if (e > 350) {
+ e = 351;
+ lengthToMoveLeft = 702;
+ }
+ abs = abs.movePointLeft(lengthToMoveLeft);
Review comment:
This old 350 limit is problematic, for value > 100^350, the abs will >
1, which will make the following steps have an incorrect encoding for M .
--
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]