You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by om...@apache.org on 2016/03/15 21:43:34 UTC
hive git commit: HIVE-13232. Aggressively drop compression buffers in
ORC OutStreams. (omalley reviewed by prasanthj)
Repository: hive
Updated Branches:
refs/heads/master 812820086 -> 4458b1a2b
HIVE-13232. Aggressively drop compression buffers in ORC OutStreams.
(omalley reviewed by prasanthj)
Project: http://git-wip-us.apache.org/repos/asf/hive/repo
Commit: http://git-wip-us.apache.org/repos/asf/hive/commit/4458b1a2
Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/4458b1a2
Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/4458b1a2
Branch: refs/heads/master
Commit: 4458b1a2b52ce0dfd17504775a016d46a12bc46b
Parents: 8128200
Author: Owen O'Malley <om...@apache.org>
Authored: Fri Mar 11 10:38:34 2016 -0800
Committer: Owen O'Malley <om...@apache.org>
Committed: Tue Mar 15 13:42:29 2016 -0700
----------------------------------------------------------------------
orc/src/java/org/apache/orc/impl/OutStream.java | 2 +-
.../test/org/apache/orc/impl/TestOutStream.java | 43 ++++++++++++++++++++
2 files changed, 44 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hive/blob/4458b1a2/orc/src/java/org/apache/orc/impl/OutStream.java
----------------------------------------------------------------------
diff --git a/orc/src/java/org/apache/orc/impl/OutStream.java b/orc/src/java/org/apache/orc/impl/OutStream.java
index 68ef7d4..81662cc 100644
--- a/orc/src/java/org/apache/orc/impl/OutStream.java
+++ b/orc/src/java/org/apache/orc/impl/OutStream.java
@@ -243,8 +243,8 @@ public class OutStream extends PositionedOutputStream {
if (compressed != null && compressed.position() != 0) {
compressed.flip();
receiver.output(compressed);
- compressed = null;
}
+ compressed = null;
uncompressedBytes = 0;
compressedBytes = 0;
overflow = null;
http://git-wip-us.apache.org/repos/asf/hive/blob/4458b1a2/orc/src/test/org/apache/orc/impl/TestOutStream.java
----------------------------------------------------------------------
diff --git a/orc/src/test/org/apache/orc/impl/TestOutStream.java b/orc/src/test/org/apache/orc/impl/TestOutStream.java
new file mode 100644
index 0000000..e9614d5
--- /dev/null
+++ b/orc/src/test/org/apache/orc/impl/TestOutStream.java
@@ -0,0 +1,43 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.orc.impl;
+
+import org.apache.orc.CompressionCodec;
+import org.junit.Test;
+import org.mockito.Mockito;
+
+import java.nio.ByteBuffer;
+
+import static org.junit.Assert.assertEquals;
+
+public class TestOutStream {
+
+ @Test
+ public void testFlush() throws Exception {
+ OutStream.OutputReceiver receiver =
+ Mockito.mock(OutStream.OutputReceiver.class);
+ CompressionCodec codec = new ZlibCodec();
+ OutStream stream = new OutStream("test", 128*1024, codec, receiver);
+ assertEquals(0L, stream.getBufferSize());
+ stream.write(new byte[]{0, 1, 2});
+ stream.flush();
+ Mockito.verify(receiver).output(Mockito.any(ByteBuffer.class));
+ assertEquals(0L, stream.getBufferSize());
+ }
+}