ptupitsyn commented on code in PR #3493:
URL: https://github.com/apache/ignite-3/pull/3493#discussion_r1541128121
##########
modules/binary-tuple/src/main/java/org/apache/ignite/internal/binarytuple/BinaryTupleBuilder.java:
##########
@@ -315,8 +320,34 @@ public BinaryTupleBuilder appendNumber(BigInteger value) {
* @return {@code this} for chaining.
*/
public BinaryTupleBuilder appendDecimalNotNull(BigDecimal value, int
scale) {
- // TODO IGNITE-21745: Inefficient serialization, many bytes wasted to
store small values when scale is big.
- putBytes(value.setScale(scale,
RoundingMode.HALF_UP).unscaledValue().toByteArray());
+ value = value.stripTrailingZeros();
+ int valScale = value.scale();
+
+ if (valScale < 0) {
+ value = value.setScale(0, RoundingMode.UNNECESSARY);
+ valScale = 0;
+ }
Review Comment:
Yes, this is wrong, not sure what I was thinking. As discussed in private,
I've removed varlen logic and now we store signed scale as 2 bytes (see
https://github.com/apache/ignite-3/blob/a7188adc70d6f3bf9189feba3b5c6878bd3a27ec/modules/catalog/src/main/java/org/apache/ignite/internal/catalog/commands/CatalogUtils.java#L113).
--
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]