You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@orc.apache.org by "Gang Wu (JIRA)" <ji...@apache.org> on 2017/04/27 06:05:04 UTC

[jira] [Created] (ORC-181) ByteRleDecoder doesn't seek correctly when the runtime type is BooleanRleDecoderImpl

Gang Wu created ORC-181:
---------------------------

             Summary: ByteRleDecoder doesn't seek correctly when the runtime type is BooleanRleDecoderImpl
                 Key: ORC-181
                 URL: https://issues.apache.org/jira/browse/ORC-181
             Project: ORC
          Issue Type: Bug
          Components: C++
    Affects Versions: 1.0.0
            Reporter: Gang Wu
            Assignee: Gang Wu


The following piece of code is located at ByteRLE.cc line 254:

{code:title=ByteRLE.cc|borderStyle=solid}
  void BooleanRleDecoderImpl::seek(PositionProvider& location) {
    ByteRleDecoderImpl::seek(location);
    uint64_t consumed = location.next();
    if (consumed > 8) {
      throw ParseError("bad position");
    }
    if (consumed != 0) {
      remainingBits = 8 - consumed;
      ByteRleDecoderImpl::next(&lastByte, 1, 0);
    }
  }
{code}

The basic idea of this function is to seek to the right position in the byte stream and then seek to the right bit in a specific byte. Therefore, firstly it calls ByteRleDecoderImpl::seek(location) first which is located at ByteRLE.cc line 113 as below:

{code:title=ByteRLE.cc|borderStyle=solid}
  void ByteRleDecoderImpl::seek(PositionProvider& location) {
    // move the input stream
    inputStream->seek(location);
    // force a re-read from the stream
    bufferEnd = bufferStart;
    // read a new header
    readHeader();
    // skip ahead the given number of records
    skip(location.next());
  }
{code}

However, at the end of ByteRleDecoderImpl::seek(), it calls skip(location.next()) which is actually BooleanRleDecoderImpl::skip() not ByteRleDecoderImpl::skip(). Oops!



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)