Skip to content

Commit

Permalink
Updating Parquet version (#63)
Browse files Browse the repository at this point in the history
* Project building with Parquet 1.12.0, new icons added

* Google Java Format

* Updating Avro version

Co-authored-by: GitHub Actions <>
  • Loading branch information
benwatson528 authored Mar 25, 2021
1 parent 13694bc commit 6d39ddb
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 22 deletions.
11 changes: 5 additions & 6 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,16 @@ targetCompatibility = JavaVersion.VERSION_1_8

dependencies {
//Avro dependencies
compile("org.apache.avro:avro:1.10.0") {
compile("org.apache.avro:avro:1.10.2") {
exclude group: 'org.slf4j'
}
compile("org.xerial.snappy:snappy-java:1.1.8.1")

//Parquet dependencies
//This is org.apache.parquet:parquet-avro-1.11.0 with added support for INT96
compile files("libs/parquet-avro-1.11.1-SNAPSHOT.jar")
compile("org.apache.parquet:parquet-column:1.11.1")
compile("org.apache.parquet:parquet-hadoop:1.11.1")
compile("org.apache.parquet:parquet-format-structures:1.11.1")
compile("org.apache.parquet:parquet-avro:1.12.0")
compile("org.apache.parquet:parquet-column:1.12.0")
compile("org.apache.parquet:parquet-hadoop:1.12.0")
compile("org.apache.parquet:parquet-format-structures:1.12.0")
compile("org.apache.hadoop:hadoop-client:3.3.0")

//External dependencies
Expand Down
13 changes: 0 additions & 13 deletions libs/README.md

This file was deleted.

Binary file removed libs/parquet-avro-1.11.1-SNAPSHOT.jar
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,27 @@
import java.util.ArrayList;
import java.util.List;
import org.apache.avro.generic.GenericData;
import org.apache.hadoop.conf.Configuration;
import org.apache.parquet.avro.AvroParquetReader;
import org.apache.parquet.hadoop.ParquetReader;

public class ParquetFileReader implements Reader {

private static final Logger LOGGER = Logger.getInstance(ParquetFileReader.class);
private final Path path;
private final Configuration conf;

public ParquetFileReader(File file) {
this.path = file.toPath();
this.conf = new Configuration();
this.conf.set("parquet.avro.readInt96AsFixed", "true");
GenericDataConfigurer.configureGenericData();
}

@Override
public String getSchema() throws IOException {
try (ParquetReader<Object> parquetReader =
AvroParquetReader.builder(new LocalInputFile(this.path)).build()) {
AvroParquetReader.builder(new LocalInputFile(this.path)).withConf(this.conf).build()) {
GenericData.Record firstRecord = (GenericData.Record) parquetReader.read();
if (firstRecord == null) {
throw new IOException("Can't process empty Parquet file");
Expand All @@ -37,6 +41,7 @@ public List<String> getRecords(int numRecords) throws IOException, IllegalArgume
try (ParquetReader<Object> parquetReader =
AvroParquetReader.builder(new LocalInputFile(this.path))
.withDataModel(GenericData.get())
.withConf(this.conf)
.build()) {
List<String> records = new ArrayList<>();
GenericData.Record value;
Expand Down
6 changes: 4 additions & 2 deletions src/main/resources/META-INF/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
<depends>com.intellij.modules.lang</depends>

<extensions defaultExtensionNs="com.intellij">
<toolWindow id="Avro/Parquet Viewer" anchor="bottom"
factoryClass="uk.co.hadoopathome.intellij.viewer.FileViewerToolWindow"/>
<toolWindow id="Avro/Parquet Viewer"
anchor="bottom"
factoryClass="uk.co.hadoopathome.intellij.viewer.FileViewerToolWindow"
icon="/menuIcon.svg"/>
</extensions>
</idea-plugin>
8 changes: 8 additions & 0 deletions src/main/resources/menuIcon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 6d39ddb

Please sign in to comment.