package init

This commit is contained in:
baizg1107 2021-07-15 11:43:39 +08:00
parent e014ac8b32
commit 48149a3a6d
3 changed files with 193 additions and 0 deletions

View File

@ -0,0 +1,146 @@
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

Binary file not shown.

47
parquet-format.spec Normal file
View File

@ -0,0 +1,47 @@
Name: parquet-format
Version: 2.9.0
Release: 1
Summary: Columnar file format for Hadoop
License: Apache-2.0 and MIT
URL: http://parquet.io/
Source0: https://github.com/apache/parquet-format/archive/refs/tags/apache-parquet-format-2.9.0.tar.gz
Patch0: 0001-use-antrun-plugin-and-update-thrift-to-0.14.0.patch
BuildRequires: maven maven-local
BuildRequires: mvn(junit:junit)
BuildRequires: mvn(org.apache.maven.plugins:maven-antrun-plugin)
BuildRequires: mvn(org.slf4j:slf4j-api) exec-maven-plugin apache-rat-plugin
BuildRequires: thrift mvn(org.apache.thrift:libthrift)
BuildArch: noarch
%description
Parquet is a columnar storage format that supports nested data.
This provides all generated meta-data code.
%package javadoc
Summary: Javadoc for %{name}
%description javadoc
This package contains javadoc for %{name}.
%prep
%autosetup -n %{name}-apache-%{name}-%{version} -p1
%pom_remove_plugin :maven-shade-plugin
chmod 644 LICENSE
%build
%mvn_build --bootstrap -- -Drat.skip=true
%install
%mvn_install -- -Drat.skip=true
%files -f .mfiles
%doc CONTRIBUTING.md README.md
%license LICENSE
%files javadoc -f .mfiles-javadoc
%license LICENSE
%changelog
* Fri Jul 2 2021 baizhonggui <baizhonggui@huawei.com> - 2.9.0-1
- Package init