You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@orc.apache.org by GitBox <gi...@apache.org> on 2020/12/22 21:09:59 UTC

[GitHub] [orc] pgaref commented on a change in pull request #586: ORC-703 : Fix RLE encoding bug on large negative integer.

pgaref commented on a change in pull request #586:
URL: https://github.com/apache/orc/pull/586#discussion_r547507745



##########
File path: c++/test/TestRleEncoder.cc
##########
@@ -280,6 +280,33 @@ namespace orc {
     decodeAndVerify(RleVersion_2, memStream, data, numValues, nullptr, isSigned);
   }
 
+  // This case is used to testing encoding large negative integer.

Review comment:
       Is there a case that this would be an issue for positive numbers as well?
   
   Can we also add some checks for the expected encoded values?

##########
File path: c++/src/RleEncoderV2.cc
##########
@@ -577,7 +577,10 @@ void RleEncoderV2::writePatchedBasedValues(EncodingOption& option) {
     // find the number of bytes required for base and shift it by 5 bits
     // to accommodate patch width. The additional bit is used to store the sign
     // of the base value.
-    const uint32_t baseWidth = findClosestNumBits(option.min) + 1;
+    uint32_t baseWidth = findClosestNumBits(option.min) + 1;

Review comment:
       Seems like getClosestFixedBits method can indeed return up to 64 bits and adding thee sign bit here would exceed 8 bytes -- would it make sense to add the logic as part of the underlying method?
   
   An alternative would be to skip the sign bit addition when the width is already 64 bits

##########
File path: java/core/src/java/org/apache/orc/impl/RunLengthIntegerWriterV2.java
##########
@@ -286,7 +286,10 @@ private void writePatchedBaseValues() throws IOException {
     // find the number of bytes required for base and shift it by 5 bits
     // to accommodate patch width. The additional bit is used to store the sign
     // of the base value.
-    final int baseWidth = utils.findClosestNumBits(min) + 1;
+    int baseWidth = utils.findClosestNumBits(min) + 1;

Review comment:
       Same comment applies here (as the C++ version) -- I would try to avoid the extra if statement.
   
   Can we please add some java tests as well?




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

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