Skip to content

Commit

Permalink
Zero-copy fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Lagrang committed Aug 26, 2022
1 parent 6d0a2d0 commit a0cba8d
Show file tree
Hide file tree
Showing 23 changed files with 41 additions and 32 deletions.
2 changes: 1 addition & 1 deletion java/adapter/avro/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<parent>
<groupId>org.apache.arrow</groupId>
<artifactId>arrow-java-root</artifactId>
<version>6.0.0</version>
<version>6.0.100</version>
<relativePath>../../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion java/adapter/jdbc/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<parent>
<groupId>org.apache.arrow</groupId>
<artifactId>arrow-java-root</artifactId>
<version>6.0.0</version>
<version>6.0.100</version>
<relativePath>../../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion java/adapter/orc/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
<parent>
<groupId>org.apache.arrow</groupId>
<artifactId>arrow-java-root</artifactId>
<version>6.0.0</version>
<version>6.0.100</version>
<relativePath>../../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion java/algorithm/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<parent>
<groupId>org.apache.arrow</groupId>
<artifactId>arrow-java-root</artifactId>
<version>6.0.0</version>
<version>6.0.100</version>
</parent>
<artifactId>arrow-algorithm</artifactId>
<name>Arrow Algorithms</name>
Expand Down
2 changes: 1 addition & 1 deletion java/c/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<parent>
<artifactId>arrow-java-root</artifactId>
<groupId>org.apache.arrow</groupId>
<version>6.0.0</version>
<version>6.0.100</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion java/compression/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<parent>
<groupId>org.apache.arrow</groupId>
<artifactId>arrow-java-root</artifactId>
<version>6.0.0</version>
<version>6.0.100</version>
</parent>
<artifactId>arrow-compression</artifactId>
<name>Arrow Compression</name>
Expand Down
2 changes: 1 addition & 1 deletion java/dataset/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<parent>
<artifactId>arrow-java-root</artifactId>
<groupId>org.apache.arrow</groupId>
<version>6.0.0</version>
<version>6.0.100</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion java/flight/flight-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<parent>
<groupId>org.apache.arrow</groupId>
<artifactId>arrow-java-root</artifactId>
<version>6.0.0</version>
<version>6.0.100</version>
<relativePath>../../pom.xml</relativePath>
</parent>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

package org.apache.arrow.flight;

import io.netty.buffer.PooledByteBufAllocator;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
Expand Down Expand Up @@ -130,15 +131,23 @@ public static HeaderType getHeader(byte b) {
// Pre-allocated buffers for padding serialized ArrowMessages.
private static final List<ByteBuf> PADDING_BUFFERS = Arrays.asList(
null,
Unpooled.copiedBuffer(new byte[] { 0 }),
Unpooled.copiedBuffer(new byte[] { 0, 0 }),
Unpooled.copiedBuffer(new byte[] { 0, 0, 0 }),
Unpooled.copiedBuffer(new byte[] { 0, 0, 0, 0 }),
Unpooled.copiedBuffer(new byte[] { 0, 0, 0, 0, 0 }),
Unpooled.copiedBuffer(new byte[] { 0, 0, 0, 0, 0, 0 }),
Unpooled.copiedBuffer(new byte[] { 0, 0, 0, 0, 0, 0, 0 })
paddingBuf(1),
paddingBuf(2),
paddingBuf(3),
paddingBuf(4),
paddingBuf(5),
paddingBuf(6),
paddingBuf(7)
);

private static ByteBuf paddingBuf(int size) {
ByteBuf byteBuf = Unpooled.directBuffer(size, size);
byte[] padding = new byte[size];
Arrays.fill(padding, (byte) 0);
byteBuf.writeBytes(padding);
return byteBuf;
}

private final IpcOption writeOption;
private final FlightDescriptor descriptor;
private final MessageMetadataResult message;
Expand Down Expand Up @@ -435,10 +444,10 @@ private InputStream asInputStream(BufferAllocator allocator) {
cos.writeUInt32NoTag(size);
cos.flush();

ByteBuf initialBuf = Unpooled.buffer(baos.size());
ByteBuf initialBuf = Unpooled.directBuffer(baos.size());
initialBuf.writeBytes(baos.toByteArray());
final CompositeByteBuf bb;
final int maxNumComponents = Math.max(2, bufs.size() + 1);
final int maxNumComponents = Math.max(2, allBufs.size() * 3);
final ImmutableList<ByteBuf> byteBufs = ImmutableList.<ByteBuf>builder()
.add(initialBuf)
.addAll(allBufs)
Expand Down
2 changes: 1 addition & 1 deletion java/flight/flight-grpc/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<parent>
<artifactId>arrow-java-root</artifactId>
<groupId>org.apache.arrow</groupId>
<version>6.0.0</version>
<version>6.0.100</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Expand Down
2 changes: 1 addition & 1 deletion java/format/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<parent>
<artifactId>arrow-java-root</artifactId>
<groupId>org.apache.arrow</groupId>
<version>6.0.0</version>
<version>6.0.100</version>
</parent>

<artifactId>arrow-format</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion java/gandiva/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<parent>
<groupId>org.apache.arrow</groupId>
<artifactId>arrow-java-root</artifactId>
<version>6.0.0</version>
<version>6.0.100</version>
</parent>

<groupId>org.apache.arrow.gandiva</groupId>
Expand Down
2 changes: 1 addition & 1 deletion java/memory/memory-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<parent>
<artifactId>arrow-memory</artifactId>
<groupId>org.apache.arrow</groupId>
<version>6.0.0</version>
<version>6.0.100</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion java/memory/memory-netty/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<parent>
<artifactId>arrow-memory</artifactId>
<groupId>org.apache.arrow</groupId>
<version>6.0.0</version>
<version>6.0.100</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion java/memory/memory-unsafe/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<parent>
<artifactId>arrow-memory</artifactId>
<groupId>org.apache.arrow</groupId>
<version>6.0.0</version>
<version>6.0.100</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion java/memory/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<parent>
<groupId>org.apache.arrow</groupId>
<artifactId>arrow-java-root</artifactId>
<version>6.0.0</version>
<version>6.0.100</version>
</parent>
<artifactId>arrow-memory</artifactId>
<name>Arrow Memory</name>
Expand Down
4 changes: 2 additions & 2 deletions java/performance/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<parent>
<artifactId>arrow-java-root</artifactId>
<groupId>org.apache.arrow</groupId>
<version>6.0.0</version>
<version>6.0.100</version>
</parent>
<artifactId>arrow-performance</artifactId>
<packaging>jar</packaging>
Expand Down Expand Up @@ -86,7 +86,7 @@
<dependency>
<groupId>org.apache.arrow</groupId>
<artifactId>arrow-algorithm</artifactId>
<version>6.0.0</version>
<version>6.0.100</version>
<scope>test</scope>
</dependency>
</dependencies>
Expand Down
2 changes: 1 addition & 1 deletion java/plasma/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<parent>
<groupId>org.apache.arrow</groupId>
<artifactId>arrow-java-root</artifactId>
<version>6.0.0</version>
<version>6.0.100</version>
</parent>
<artifactId>arrow-plasma</artifactId>
<name>Arrow Plasma Client</name>
Expand Down
2 changes: 1 addition & 1 deletion java/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

<groupId>org.apache.arrow</groupId>
<artifactId>arrow-java-root</artifactId>
<version>6.0.0</version>
<version>6.0.100</version>
<packaging>pom</packaging>

<name>Apache Arrow Java Root POM</name>
Expand Down
2 changes: 1 addition & 1 deletion java/tools/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<parent>
<groupId>org.apache.arrow</groupId>
<artifactId>arrow-java-root</artifactId>
<version>6.0.0</version>
<version>6.0.100</version>
</parent>
<artifactId>arrow-tools</artifactId>
<name>Arrow Tools</name>
Expand Down
2 changes: 1 addition & 1 deletion java/vector/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<parent>
<groupId>org.apache.arrow</groupId>
<artifactId>arrow-java-root</artifactId>
<version>6.0.0</version>
<version>6.0.100</version>
</parent>
<artifactId>arrow-vector</artifactId>
<name>Arrow Vectors</name>
Expand Down
2 changes: 1 addition & 1 deletion testing
Submodule testing updated 28 files
+ data/arrow-ipc-file/clusterfuzz-testcase-minimized-arrow-ipc-file-fuzz-6177196536889344
+ data/arrow-ipc-file/clusterfuzz-testcase-minimized-arrow-ipc-file-fuzz-6318558565498880.fuzz
+ data/arrow-ipc-stream/clusterfuzz-testcase-minimized-arrow-ipc-stream-fuzz-4961281405222912
+ data/parquet/fuzzing/clusterfuzz-testcase-5913005913407488
+ data/parquet/fuzzing/clusterfuzz-testcase-6606237035003904
+ data/parquet/fuzzing/clusterfuzz-testcase-dictbitwidth-4680774947569664
+ data/parquet/fuzzing/clusterfuzz-testcase-dictbitwidth-5882232959270912
+ data/parquet/fuzzing/clusterfuzz-testcase-minimized-parquet-arrow-fuzz-4738122420715520
+ data/parquet/fuzzing/clusterfuzz-testcase-minimized-parquet-arrow-fuzz-4866999088447488
+ data/parquet/fuzzing/clusterfuzz-testcase-minimized-parquet-arrow-fuzz-4938338763669504
+ data/parquet/fuzzing/clusterfuzz-testcase-minimized-parquet-arrow-fuzz-5004902418481152
+ data/parquet/fuzzing/clusterfuzz-testcase-minimized-parquet-arrow-fuzz-5103039558582272
+ data/parquet/fuzzing/clusterfuzz-testcase-minimized-parquet-arrow-fuzz-5106889906585600
+ data/parquet/fuzzing/clusterfuzz-testcase-minimized-parquet-arrow-fuzz-5152654819459072.fuzz
+ data/parquet/fuzzing/clusterfuzz-testcase-minimized-parquet-arrow-fuzz-5251250357141504
+ data/parquet/fuzzing/clusterfuzz-testcase-minimized-parquet-arrow-fuzz-5385788188131328
+ data/parquet/fuzzing/clusterfuzz-testcase-minimized-parquet-arrow-fuzz-5798108001337344
+ data/parquet/fuzzing/clusterfuzz-testcase-minimized-parquet-arrow-fuzz-5915095763386368
+ data/parquet/fuzzing/clusterfuzz-testcase-minimized-parquet-arrow-fuzz-6122962147737600.fuzz
+ data/parquet/fuzzing/clusterfuzz-testcase-minimized-parquet-arrow-fuzz-6289584196026368
+ data/parquet/fuzzing/clusterfuzz-testcase-minimized-parquet-arrow-fuzz-6539993600884736
+ data/parquet/fuzzing/clusterfuzz-testcase-minimized-parquet-arrow-fuzz-6696667471020032
+ data/parquet/fuzzing/clusterfuzz-testcase-parquet-arrow-fuzz-5004902418481152
+ data/parquet/fuzzing/clusterfuzz-testcase-parquet-arrow-fuzz-5973249794637824
+ data/parquet/fuzzing/clusterfuzz-testcase-parquet-arrow-fuzz-6196357887557632.fuzz
+ data/parquet/fuzzing/crash-61d6204d481340860da54e30f1937b67234ad0f7
+ data/parquet/fuzzing/crash-649c71a618ae2fd80cec177a9676eb3e280fc1fa
+ data/parquet/fuzzing/crash-9840a7b1a0d24996069f6ee0779bbe9875e8aca3

0 comments on commit a0cba8d

Please sign in to comment.