orc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From AnatoliShein <...@git.apache.org>
Subject [GitHub] orc pull request #134: Orc 17
Date Wed, 05 Jul 2017 15:22:29 GMT
Github user AnatoliShein commented on a diff in the pull request:

    https://github.com/apache/orc/pull/134#discussion_r125674828
  
    --- Diff: c++/src/OrcHdfsFile.cc ---
    @@ -121,39 +116,24 @@ namespace orc {
         }
     
         uint64_t getNaturalReadSize() const override {
    -      return BUF_SIZE;
    +      return 1048576; //1 MB
         }
     
         void read(void* buf,
                   uint64_t length,
                   uint64_t offset) override {
     
    -      ssize_t total_bytes_read = 0;
           size_t last_bytes_read = 0;
     
           if (!buf) {
             throw ParseError("Buffer is null");
           }
     
           hdfs::Status status;
    -      char input_buffer[BUF_SIZE];
    -      do{
    -        //Reading file chunks
    -        status = file->PositionRead(input_buffer, sizeof(input_buffer), offset, &last_bytes_read);
    -        if(status.ok()) {
    -          //Writing file chunks to buf
    -          if(total_bytes_read + last_bytes_read >= length){
    -            memcpy((char*) buf + total_bytes_read, input_buffer, length - total_bytes_read);
    -            break;
    -          } else {
    -            memcpy((char*) buf + total_bytes_read, input_buffer, last_bytes_read);
    -            total_bytes_read += last_bytes_read;
    -            offset += last_bytes_read;
    -          }
    -        } else {
    -          throw ParseError("Error reading the file: " + status.ToString());
    -        }
    -      } while (true);
    +      status = file->PositionRead(buf, static_cast<size_t>(length), static_cast<off_t>(offset),
&last_bytes_read);
    --- End diff --
    
    This makes sense. I just added a loop here.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message