Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,19 +35,19 @@ 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
export PATH="/usr/local/opt/thrift@0.16.0/bin:$PATH"
export PATH="/usr/local/opt/thrift@0.19.0/bin:$PATH"
```

### Build Parquet with Maven
Expand Down
2 changes: 1 addition & 1 deletion dev/ci-before_install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,9 @@ public THIS columnOrder(ColumnOrder columnOrder) {

@Override
protected PrimitiveType build(String name) {
if (length == 0 && logicalTypeAnnotation instanceof LogicalTypeAnnotation.UUIDLogicalTypeAnnotation) {
length = LogicalTypeAnnotation.UUIDLogicalTypeAnnotation.BYTES;
}
if (PrimitiveTypeName.FIXED_LEN_BYTE_ARRAY == primitiveType) {
Preconditions.checkArgument(length > 0, "Invalid FIXED_LEN_BYTE_ARRAY length: %s", length);
}
Expand Down
5 changes: 5 additions & 0 deletions parquet-format-structures/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,11 @@
<artifactId>libthrift</artifactId>
<version>${format.thrift.version}</version>
</dependency>
<dependency>
<groupId>javax.annotation</groupId>
<artifactId>javax.annotation-api</artifactId>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where do we need this?

<version>${javax.annotation.version}</version>
</dependency>
</dependencies>

<profiles>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
import org.apache.thrift.protocol.TList;
Expand All @@ -42,187 +43,243 @@ public InterningProtocol(TProtocol delegate) {
this.delegate = delegate;
}

@Override
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();
}
Expand Down
5 changes: 5 additions & 0 deletions parquet-thrift/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,11 @@
<version>2.12.5</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.annotation</groupId>
<artifactId>javax.annotation-api</artifactId>
<version>${javax.annotation.version}</version>
</dependency>
<dependency> <!-- for pig runtime in tests -->
<groupId>org.antlr</groupId>
<artifactId>antlr-runtime</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import org.apache.parquet.ShouldNeverHappenException;
import org.apache.parquet.thrift.struct.ThriftField;
import org.apache.parquet.thrift.struct.ThriftType;
Expand Down Expand Up @@ -239,6 +240,10 @@ private boolean readOneValue(TProtocol in, byte type, List<Action> buffer, Thrif
final ByteBuffer bin = in.readBinary();
writeStringAction(buffer, bin);
break;
case TType.UUID:
final UUID uuid = in.readUuid();
writeUuidAction(buffer, uuid);
break;
case TType.VOID:
break;
default:
Expand All @@ -261,6 +266,20 @@ public String toDebugString() {
});
}

private void writeUuidAction(List<Action> buffer, final UUID uuid) {
buffer.add(new Action() {
@Override
public void write(TProtocol out) throws TException {
out.writeUuid(uuid);
}

@Override
public String toDebugString() {
return uuid.toString();
}
});
}

private void writeLongAction(List<Action> buffer, final long l) {
buffer.add(new Action() {
@Override
Expand Down Expand Up @@ -617,6 +636,9 @@ public void writeI32(int i) throws TException {}
@Override
public void writeI64(long l) throws TException {}

@Override
public void writeUuid(UUID uuid) throws TException {}

@Override
public void writeDouble(double v) throws TException {}

Expand Down Expand Up @@ -699,6 +721,11 @@ public long readI64() throws TException {
return 0;
}

@Override
public UUID readUuid() throws TException {
return null;
}

@Override
public double readDouble() throws TException {
return 0;
Expand Down
Loading