From ccd3f94b077c4760c3d7a7e92b7e7bd807237b62 Mon Sep 17 00:00:00 2001 From: Fokko Driesprong Date: Mon, 4 Sep 2023 20:21:39 +0200 Subject: [PATCH] PARQUET-2344: Bump to Thrift 0.19.0 --- README.md | 8 +-- dev/ci-before_install.sh | 2 +- parquet-format-structures/pom.xml | 5 ++ .../parquet/format/InterningProtocol.java | 56 +++++++++++++++++++ parquet-thrift/pom.xml | 5 ++ .../thrift/BufferedProtocolReadToWrite.java | 10 ++++ .../parquet/thrift/ParquetProtocol.java | 11 ++++ .../parquet/thrift/struct/ThriftTypeID.java | 9 ++- pom.xml | 6 +- 9 files changed, 104 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 8514a701d4..c535cb8009 100644 --- a/README.md +++ b/README.md @@ -35,15 +35,15 @@ Parquet-MR uses Maven to build and depends on the thrift compiler (protoc is now To build and install the thrift compiler, run: ``` -wget -nv http://archive.apache.org/dist/thrift/0.16.0/thrift-0.16.0.tar.gz -tar xzf thrift-0.16.0.tar.gz -cd thrift-0.16.0 +wget -nv http://archive.apache.org/dist/thrift/0.19.0/thrift-0.19.0.tar.gz +tar xzf thrift-0.19.0.tar.gz +cd thrift-0.19.0 chmod +x ./configure ./configure --disable-libs sudo make install ``` -If you're on OSX and use homebrew, you can instead install Thrift 0.16.0 with `brew` and ensure that it comes first in your `PATH`. +If you're on OSX and use homebrew, you can instead install Thrift 0.19.0 with `brew` and ensure that it comes first in your `PATH`. ``` brew install thrift diff --git a/dev/ci-before_install.sh b/dev/ci-before_install.sh index 82b7a06760..9d15311f52 100755 --- a/dev/ci-before_install.sh +++ b/dev/ci-before_install.sh @@ -20,7 +20,7 @@ # This script gets invoked by the CI system in a "before install" step ################################################################################ -export THRIFT_VERSION=0.16.0 +export THRIFT_VERSION=0.19.0 set -e date diff --git a/parquet-format-structures/pom.xml b/parquet-format-structures/pom.xml index ca4912cb4c..4ff2c86cc8 100644 --- a/parquet-format-structures/pom.xml +++ b/parquet-format-structures/pom.xml @@ -156,6 +156,11 @@ libthrift ${format.thrift.version} + + javax.annotation + javax.annotation-api + ${javax.annotation.version} + diff --git a/parquet-format-structures/src/main/java/org/apache/parquet/format/InterningProtocol.java b/parquet-format-structures/src/main/java/org/apache/parquet/format/InterningProtocol.java index a1a6466bdd..833b928a1e 100644 --- a/parquet-format-structures/src/main/java/org/apache/parquet/format/InterningProtocol.java +++ b/parquet-format-structures/src/main/java/org/apache/parquet/format/InterningProtocol.java @@ -20,6 +20,7 @@ package org.apache.parquet.format; import java.nio.ByteBuffer; +import java.util.UUID; import org.apache.thrift.TException; import org.apache.thrift.protocol.TField; @@ -47,183 +48,238 @@ public TTransport getTransport() { return delegate.getTransport(); } + @Override public void writeMessageBegin(TMessage message) throws TException { delegate.writeMessageBegin(message); } + @Override public void writeMessageEnd() throws TException { delegate.writeMessageEnd(); } + @Override public int hashCode() { return delegate.hashCode(); } + @Override public void writeStructBegin(TStruct struct) throws TException { delegate.writeStructBegin(struct); } + @Override public void writeStructEnd() throws TException { delegate.writeStructEnd(); } + @Override public void writeFieldBegin(TField field) throws TException { delegate.writeFieldBegin(field); } + @Override public void writeFieldEnd() throws TException { delegate.writeFieldEnd(); } + @Override public void writeFieldStop() throws TException { delegate.writeFieldStop(); } + @Override public void writeMapBegin(TMap map) throws TException { delegate.writeMapBegin(map); } + @Override public void writeMapEnd() throws TException { delegate.writeMapEnd(); } + @Override public void writeListBegin(TList list) throws TException { delegate.writeListBegin(list); } + @Override public void writeListEnd() throws TException { delegate.writeListEnd(); } + @Override public void writeSetBegin(TSet set) throws TException { delegate.writeSetBegin(set); } + @Override public void writeSetEnd() throws TException { delegate.writeSetEnd(); } + @Override public void writeBool(boolean b) throws TException { delegate.writeBool(b); } + @Override public void writeByte(byte b) throws TException { delegate.writeByte(b); } + @Override public void writeI16(short i16) throws TException { delegate.writeI16(i16); } + @Override public void writeI32(int i32) throws TException { delegate.writeI32(i32); } + @Override public void writeI64(long i64) throws TException { delegate.writeI64(i64); } + @Override + public void writeUuid(UUID uuid) throws TException { + delegate.writeUuid(uuid); + } + + @Override public void writeDouble(double dub) throws TException { delegate.writeDouble(dub); } + @Override public void writeString(String str) throws TException { delegate.writeString(str); } + @Override public void writeBinary(ByteBuffer buf) throws TException { delegate.writeBinary(buf); } + @Override public TMessage readMessageBegin() throws TException { return delegate.readMessageBegin(); } + @Override public void readMessageEnd() throws TException { delegate.readMessageEnd(); } + @Override public TStruct readStructBegin() throws TException { return delegate.readStructBegin(); } + @Override public void readStructEnd() throws TException { delegate.readStructEnd(); } + @Override public TField readFieldBegin() throws TException { return delegate.readFieldBegin(); } + @Override public void readFieldEnd() throws TException { delegate.readFieldEnd(); } + @Override public TMap readMapBegin() throws TException { return delegate.readMapBegin(); } + @Override public void readMapEnd() throws TException { delegate.readMapEnd(); } + @Override public TList readListBegin() throws TException { return delegate.readListBegin(); } + @Override public void readListEnd() throws TException { delegate.readListEnd(); } + @Override public TSet readSetBegin() throws TException { return delegate.readSetBegin(); } + @Override public void readSetEnd() throws TException { delegate.readSetEnd(); } + @Override public boolean equals(Object obj) { return delegate.equals(obj); } + @Override public boolean readBool() throws TException { return delegate.readBool(); } + @Override public byte readByte() throws TException { return delegate.readByte(); } + @Override public short readI16() throws TException { return delegate.readI16(); } + @Override public int readI32() throws TException { return delegate.readI32(); } + @Override public long readI64() throws TException { return delegate.readI64(); } + @Override + public UUID readUuid() throws TException { + return delegate.readUuid(); + } + + @Override public double readDouble() throws TException { return delegate.readDouble(); } + @Override public String readString() throws TException { // this is where we intern the strings return delegate.readString().intern(); } + @Override public ByteBuffer readBinary() throws TException { return delegate.readBinary(); } + @Override public void reset() { delegate.reset(); } + @Override public String toString() { return delegate.toString(); } diff --git a/parquet-thrift/pom.xml b/parquet-thrift/pom.xml index 833a0b55a2..beb3fe1f34 100644 --- a/parquet-thrift/pom.xml +++ b/parquet-thrift/pom.xml @@ -138,6 +138,11 @@ 2.12.5 provided + + javax.annotation + javax.annotation-api + ${javax.annotation.version} + org.antlr antlr-runtime diff --git a/parquet-thrift/src/main/java/org/apache/parquet/thrift/BufferedProtocolReadToWrite.java b/parquet-thrift/src/main/java/org/apache/parquet/thrift/BufferedProtocolReadToWrite.java index 254386b04d..6fcdeb2ee5 100644 --- a/parquet-thrift/src/main/java/org/apache/parquet/thrift/BufferedProtocolReadToWrite.java +++ b/parquet-thrift/src/main/java/org/apache/parquet/thrift/BufferedProtocolReadToWrite.java @@ -21,6 +21,7 @@ import java.nio.ByteBuffer; import java.util.ArrayList; import java.util.List; +import java.util.UUID; import org.apache.thrift.TException; import org.apache.thrift.protocol.TField; @@ -623,6 +624,10 @@ public void writeI32(int i) throws TException { public void writeI64(long l) throws TException { } + @Override + public void writeUuid(UUID uuid) throws TException { + } + @Override public void writeDouble(double v) throws TException { } @@ -714,6 +719,11 @@ public long readI64() throws TException { return 0; } + @Override + public UUID readUuid() throws TException { + return null; + } + @Override public double readDouble() throws TException { return 0; diff --git a/parquet-thrift/src/main/java/org/apache/parquet/thrift/ParquetProtocol.java b/parquet-thrift/src/main/java/org/apache/parquet/thrift/ParquetProtocol.java index b26cdcb7fa..f247076b38 100644 --- a/parquet-thrift/src/main/java/org/apache/parquet/thrift/ParquetProtocol.java +++ b/parquet-thrift/src/main/java/org/apache/parquet/thrift/ParquetProtocol.java @@ -20,6 +20,7 @@ import java.lang.reflect.Method; import java.nio.ByteBuffer; +import java.util.UUID; import org.apache.thrift.TException; import org.apache.thrift.protocol.TField; @@ -157,6 +158,11 @@ public void writeI64(long i64) throws TException { throw exception(); } + @Override + public void writeUuid(UUID uuid) throws TException { + throw exception(); + } + @Override public void writeDouble(double dub) throws TException { throw exception(); @@ -259,6 +265,11 @@ public long readI64() throws TException { throw exception(); } + @Override + public UUID readUuid() throws TException { + throw exception(); + } + @Override public double readDouble() throws TException { throw exception(); diff --git a/parquet-thrift/src/main/java/org/apache/parquet/thrift/struct/ThriftTypeID.java b/parquet-thrift/src/main/java/org/apache/parquet/thrift/struct/ThriftTypeID.java index f5f97edc9f..8624b33ca2 100644 --- a/parquet-thrift/src/main/java/org/apache/parquet/thrift/struct/ThriftTypeID.java +++ b/parquet-thrift/src/main/java/org/apache/parquet/thrift/struct/ThriftTypeID.java @@ -51,10 +51,15 @@ public enum ThriftTypeID { LIST (TType.LIST, true, ListType.class), ENUM (TType.ENUM, TType.I32, EnumType.class); - private static ThriftTypeID[] types = new ThriftTypeID[17]; + private static final ThriftTypeID[] types; static { + types = new ThriftTypeID[18]; for (ThriftTypeID t : ThriftTypeID.values()) { - types[t.thriftType] = t; + if (t.thriftType == -1) { + types[17] = t; + } else { + types[t.thriftType] = t; + } } } diff --git a/pom.xml b/pom.xml index bc3c654618..94d46e987a 100644 --- a/pom.xml +++ b/pom.xml @@ -69,6 +69,7 @@ 2.15.3 2.15.2 0.18.2 + 1.3.2 shaded.parquet 3.3.5 2.9.0 @@ -82,7 +83,7 @@ 0.16.0 h2 0.10.0 - 0.16.0 + 0.19.0 ${thrift.version} 8.5.12 0.9.33 @@ -576,6 +577,9 @@ true true + + javax.annotation:javax.annotation-api:jar:1.3.2 +