parquet-format/0001-use-antrun-plugin-and-update-thrift-to-0.14.0.patch
2021-08-02 18:10:25 +08:00

147 lines
5.3 KiB
Diff

From a679e4ef3b9f9ea450672e68d864c6f4e133ce6d Mon Sep 17 00:00:00 2001
From: bzg1107 <preloyalwhite@163.com>
Date: Mon, 2 Aug 2021 17:59:28 +0800
Subject: [PATCH] use antrun plugin and update thrift to 0.14.0
---
.github/workflows/test.yml | 4 +--
.gitignore | 1 +
pom.xml | 35 +++++++++++--------
.../parquet/format/InterningProtocol.java | 5 +++
.../java/org/apache/parquet/format/Util.java | 5 +--
5 files changed, 31 insertions(+), 19 deletions(-)
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index a93eee5..deddca4 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -40,8 +40,8 @@ jobs:
sudo apt-get update -qq
sudo apt-get install -qq protobuf-compiler
sudo apt-get install -qq libboost-dev libboost-test-dev libboost-program-options-dev libevent-dev automake libtool flex bison pkg-config g++ libssl-dev
- wget -qO- https://archive.apache.org/dist/thrift/0.13.0/thrift-0.13.0.tar.gz | tar zxf -
- cd thrift-0.13.0/
+ wget -qO- https://archive.apache.org/dist/thrift/0.14.0/thrift-0.14.0.tar.gz | tar zxf -
+ cd thrift-0.14.0/
chmod +x ./configure
./configure --disable-libs
sudo make install
diff --git a/.gitignore b/.gitignore
index 944e4a2..6eed724 100644
--- a/.gitignore
+++ b/.gitignore
@@ -23,3 +23,4 @@ dependency-reduced-pom.xml
# IDE stuff
.idea/
+*.iml
diff --git a/pom.xml b/pom.xml
index aeec130..ed80eaf 100644
--- a/pom.xml
+++ b/pom.xml
@@ -86,7 +86,7 @@
<maven.compiler.target>1.8</maven.compiler.target>
<shade.prefix>shaded.parquet</shade.prefix>
<thrift.executable>thrift</thrift.executable>
- <thrift.version>0.13.0</thrift.version>
+ <thrift.version>0.14.0</thrift.version>
<thrift-maven-plugin.version>0.10.0</thrift-maven-plugin.version>
</properties>
@@ -94,19 +94,29 @@
<plugins>
<!-- thrift -->
<plugin>
- <groupId>org.apache.thrift</groupId>
- <artifactId>thrift-maven-plugin</artifactId>
- <version>${thrift-maven-plugin.version}</version>
- <configuration>
- <thriftSourceRoot>src/main/thrift</thriftSourceRoot>
- <thriftExecutable>${thrift.executable}</thriftExecutable>
- </configuration>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <version>1.7</version>
<executions>
<execution>
- <id>thrift-sources</id>
<phase>generate-sources</phase>
+ <configuration>
+ <tasks>
+ <mkdir dir="${basedir}/target/generated-sources"/>
+ <exec executable="thrift" failonerror="true">
+ <arg value="--gen"/>
+ <arg value="java"/>
+ <arg value="-o"/>
+ <arg value="${basedir}/target/generated-sources"/>
+ <arg value="${basedir}/src/main/thrift/parquet.thrift"/>
+ </exec>
+ <copy todir="${basedir}/src/main/java" overwrite="true">
+ <fileset dir="${basedir}/target/generated-sources/gen-java"/>
+ </copy>
+ </tasks>
+ </configuration>
<goals>
- <goal>compile</goal>
+ <goal>run</goal>
</goals>
</execution>
</executions>
@@ -187,11 +197,6 @@
<artifactId>libthrift</artifactId>
<version>${thrift.version}</version>
</dependency>
- <dependency>
- <groupId>javax.annotation</groupId>
- <artifactId>javax.annotation-api</artifactId>
- <version>1.3.2</version>
- </dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
diff --git a/src/main/java/org/apache/parquet/format/InterningProtocol.java b/src/main/java/org/apache/parquet/format/InterningProtocol.java
index 843a02c..90a1170 100644
--- a/src/main/java/org/apache/parquet/format/InterningProtocol.java
+++ b/src/main/java/org/apache/parquet/format/InterningProtocol.java
@@ -224,6 +224,11 @@ public class InterningProtocol extends TProtocol {
return delegate.readBinary();
}
+ @Override
+ public int getMinSerializedSize(byte b) throws TException {
+ return delegate.getMinSerializedSize(b);
+ }
+
public void reset() {
delegate.reset();
}
diff --git a/src/main/java/org/apache/parquet/format/Util.java b/src/main/java/org/apache/parquet/format/Util.java
index 0532bce..0c831b6 100644
--- a/src/main/java/org/apache/parquet/format/Util.java
+++ b/src/main/java/org/apache/parquet/format/Util.java
@@ -47,6 +47,7 @@ import org.apache.parquet.format.event.EventBasedThriftReader;
import org.apache.parquet.format.event.TypedConsumer.I32Consumer;
import org.apache.parquet.format.event.TypedConsumer.I64Consumer;
import org.apache.parquet.format.event.TypedConsumer.StringConsumer;
+import org.apache.thrift.transport.TTransportException;
/**
* Utility to read/write metadata
@@ -207,11 +208,11 @@ public class Util {
}
}
- private static TProtocol protocol(OutputStream to) {
+ private static TProtocol protocol(OutputStream to) throws TTransportException {
return protocol(new TIOStreamTransport(to));
}
- private static TProtocol protocol(InputStream from) {
+ private static TProtocol protocol(InputStream from) throws TTransportException {
return protocol(new TIOStreamTransport(from));
}
--
2.30.0