apache / apache/parquet-java

Cannot read schema from parquet file

Open
#2,690 3 comments 0 reactions 0 assignees View on GitHub
Component: Avro Component: Parquet Priority: Major Type: bug
Dominant language
Java
Stars
3.1k
Forks
1.6k
Avg merge
3d 12h
Merged PRs (30d)
33

Description

I'm trying to generate a Avro schema from a parquet file. I get the issue both when using in Intellij as well as when I'm using my own implementation of generating a schema.

The parquet file contains nested entries and arrays: \{"a": a, "b": [{"c": c}]}

I get the following error message:
```java

org.apache.avro.SchemaParseException: Can't redefine: element
    at org.apache.avro.Schema$Names.put(Schema.java:1547)
    at org.apache.avro.Schema$NamedSchema.writeNameRef(Schema.java:810)
    at org.apache.avro.Schema$RecordSchema.toJson(Schema.java:972)
    at org.apache.avro.Schema$UnionSchema.toJson(Schema.java:1239)
    at org.apache.avro.Schema$RecordSchema.fieldsToJson(Schema.java:1000)
    at org.apache.avro.Schema$RecordSchema.toJson(Schema.java:984)
    at org.apache.avro.Schema$ArraySchema.toJson(Schema.java:1134)
    at org.apache.avro.Schema$UnionSchema.toJson(Schema.java:1239)
    at org.apache.avro.Schema$RecordSchema.fieldsToJson(Schema.java:1000)
    at org.apache.avro.Schema$RecordSchema.toJson(Schema.java:984)
    at org.apache.avro.Schema$UnionSchema.toJson(Schema.java:1239)
    at org.apache.avro.Schema$RecordSchema.fieldsToJson(Schema.java:1000)
    at org.apache.avro.Schema$RecordSchema.toJson(Schema.java:984)
    at org.apache.avro.Schema.toString(Schema.java:424)
    at org.apache.avro.Schema.toString(Schema.java:396)
    at uk.co.hadoopathome.intellij.viewer.fileformat.ParquetFileReader.getSchema(ParquetFileReader.java:65)
    at uk.co.hadoopathome.intellij.viewer.FileViewerToolWindow$2.doInBackground(FileViewerToolWindow.java:196)
    at uk.co.hadoopathome.intellij.viewer.FileViewerToolWindow$2.doInBackground(FileViewerToolWindow.java:184)
    at java.desktop/javax.swing.SwingWorker$1.call(SwingWorker.java:304)
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
    at java.desktop/javax.swing.SwingWorker.run(SwingWorker.java:343)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
    at java.base/java.lang.Thread.run(Thread.java:829)
```

It appears to be an issue similar to [PARQUET-1441](https://issues.apache.org/jira/browse/PARQUET-1441) or [PARQUET-1409](https://issues.apache.org/jira/browse/PARQUET-1409).

Or could it possibly be something wrong in my parquet file?

**Reporter**: [Nils Broman](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=nils.scila)

**Note**: *This issue was originally created as [PARQUET-2153](https://issues.apache.org/jira/browse/PARQUET-2153). Please see the [migration documentation](https://issues.apache.org/jira/browse/PARQUET-2502) for further details.*

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.