You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@orc.apache.org by om...@apache.org on 2016/08/17 20:49:32 UTC

orc git commit: ORC-93 Remove log message about seeking into an empty stream. (omalley reviewed by prasanthj)

Repository: orc
Updated Branches:
  refs/heads/master 9ba937821 -> b8a8a1ae7


ORC-93 Remove log message about seeking into an empty stream. (omalley reviewed
by prasanthj)

Fixes #56

Signed-off-by: Owen O'Malley <om...@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/orc/repo
Commit: http://git-wip-us.apache.org/repos/asf/orc/commit/b8a8a1ae
Tree: http://git-wip-us.apache.org/repos/asf/orc/tree/b8a8a1ae
Diff: http://git-wip-us.apache.org/repos/asf/orc/diff/b8a8a1ae

Branch: refs/heads/master
Commit: b8a8a1ae793e2eb031bff39a3198efefcffaa126
Parents: 9ba9378
Author: Owen O'Malley <om...@apache.org>
Authored: Tue Aug 16 16:41:55 2016 -0700
Committer: Owen O'Malley <om...@apache.org>
Committed: Wed Aug 17 13:48:03 2016 -0700

----------------------------------------------------------------------
 .../core/src/java/org/apache/orc/impl/InStream.java | 12 ------------
 .../src/test/org/apache/orc/impl/TestInStream.java  | 16 ++++++++++++++++
 2 files changed, 16 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/orc/blob/b8a8a1ae/java/core/src/java/org/apache/orc/impl/InStream.java
----------------------------------------------------------------------
diff --git a/java/core/src/java/org/apache/orc/impl/InStream.java b/java/core/src/java/org/apache/orc/impl/InStream.java
index a4615da..c85aee5 100644
--- a/java/core/src/java/org/apache/orc/impl/InStream.java
+++ b/java/core/src/java/org/apache/orc/impl/InStream.java
@@ -124,15 +124,10 @@ public abstract class InStream extends InputStream {
 
     public void seek(long desired) {
       if (desired == 0 && bytes.isEmpty()) {
-        logEmptySeek(name);
         return;
       }
       int i = 0;
       for (DiskRange curRange : bytes) {
-        if (desired == 0 && curRange.getData().remaining() == 0) {
-          logEmptySeek(name);
-          return;
-        }
         if (curRange.getOffset() <= desired &&
             (desired - curRange.getOffset()) < curRange.getLength()) {
           currentOffset = desired;
@@ -360,7 +355,6 @@ public abstract class InStream extends InputStream {
 
     private void seek(long desired) throws IOException {
       if (desired == 0 && bytes.isEmpty()) {
-        logEmptySeek(name);
         return;
       }
       int i = 0;
@@ -417,12 +411,6 @@ public abstract class InStream extends InputStream {
 
   public abstract void seek(PositionProvider index) throws IOException;
 
-  private static void logEmptySeek(String name) {
-    if (LOG.isWarnEnabled()) {
-      LOG.warn("Attempting seek into empty stream (" + name + ") Skipping stream.");
-    }
-  }
-
   /**
    * Create an input stream from a list of buffers.
    * @param streamName the name of the stream

http://git-wip-us.apache.org/repos/asf/orc/blob/b8a8a1ae/java/core/src/test/org/apache/orc/impl/TestInStream.java
----------------------------------------------------------------------
diff --git a/java/core/src/test/org/apache/orc/impl/TestInStream.java b/java/core/src/test/org/apache/orc/impl/TestInStream.java
index 9e65345..eea2ab2 100644
--- a/java/core/src/test/org/apache/orc/impl/TestInStream.java
+++ b/java/core/src/test/org/apache/orc/impl/TestInStream.java
@@ -29,6 +29,7 @@ import java.nio.ByteBuffer;
 import java.util.ArrayList;
 import java.util.List;
 
+import org.apache.hadoop.hive.common.io.DiskRange;
 import org.apache.orc.CompressionCodec;
 import org.junit.Test;
 
@@ -311,4 +312,19 @@ public class TestInStream {
       assertEquals(i, inStream.readInt());
     }
   }
+
+  @Test
+  public void testEmptyDiskRange() throws IOException {
+    List<DiskRange> rangeList = new ArrayList<>();
+    rangeList.add(new BufferChunk(ByteBuffer.allocate(0), 0));
+    InStream stream = new InStream.UncompressedStream("test", rangeList, 0);
+    assertEquals(0, stream.available());
+    stream.seek(new PositionProvider() {
+      @Override
+      public long getNext() {
+        return 0;
+      }
+    });
+    assertEquals(0, stream.available());
+  }
 }