ParquetReader.read(InputFile) always causes exception on build
- Lingua principale
- Java
- Stelle
- 3.1k
- Fork
- 1.6k
- Merge medio
- 3g 12h
- PR unite (30g)
- 33
Descrizione
The [`ParquetReader.read(InputFile file)`](https://www.javadoc.io/static/org.apache.parquet/parquet-hadoop/1.11.1/org/apache/parquet/hadoop/ParquetReader.html#read-org.apache.parquet.io.InputFile-) static factory method in `parquet-hadoop` creates a builder from an `InputFile`. This method always throws an `IllegalArgumentException` when `.build()` is subsequently called.
```java
java.nio.Path parquetFile = getParquetFile();
ParquetReader.read(HadoopInputFile.fromPath(new org.apache.hadoop.fs.Path(parquetFile.toUri()), new Configuration()))
.build();
```
```
java.lang.IllegalArgumentException: [BUG] Classes that extend Builder should override getReadSupport()
at org.apache.parquet.Preconditions.checkArgument(Preconditions.java:53)
at org.apache.parquet.hadoop.ParquetReader$Builder.getReadSupport(ParquetReader.java:310)
at org.apache.parquet.hadoop.ParquetReader$Builder.build(ParquetReader.java:337)
```
The issue appears to be that the [`build()`](https://www.javadoc.io/static/org.apache.parquet/parquet-hadoop/1.11.1/org/apache/parquet/hadoop/ParquetReader.Builder.html#build--) method enforces that a [`ReadSupport`](https://www.javadoc.io/static/org.apache.parquet/parquet-hadoop/1.11.1/org/apache/parquet/hadoop/api/ReadSupport.html) value was set on the builder, but `ParquetReader.read(InputFile file)` doesn't take accept a `ReadSupport`, nor is there a way to set it after the builder has been created.
For context, my use case is reading Parquet files directly from Java.
## Expected behavior
I wouldn't expect a method to exist that always results in an exception being thrown. I would expect the `ParquetReader.read(InputFile file)` to be fixed, replaced, or removed.
## Workaround
I am able to achieve my goal by using [`ParquetFileReader.open(InputFile)`](https://www.javadoc.io/static/org.apache.parquet/parquet-hadoop/1.11.1/org/apache/parquet/hadoop/ParquetFileReader.html#open-org.apache.parquet.io.InputFile-) instead of `ParquetReader.read(InputFile)`.
```java
java.nio.Path parquetFile = getParquetFile();
ParquetFileReader reader = ParquetFileReader.open(
HadoopInputFile.fromPath(new org.apache.hadoop.fs.Path(parquetFile.toUri()), new Configuration()));
```
**Reporter**: [M. Justin](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=mjjustin)
**Note**: *This issue was originally created as [PARQUET-1912](https://issues.apache.org/jira/browse/PARQUET-1912). Please see the [migration documentation](https://issues.apache.org/jira/browse/PARQUET-2502) for further details.*
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Direzione di ricerca
Inizia con ParquetReader.read(InputFile), quindi segui il Builder restituito fino a build() e al relativo controllo di getReadSupport(). Riproduci il fallimento con HadoopInputFile.fromPath e confrontalo con il percorso funzionante ParquetFileReader.open(InputFile). Il lavoro è completato quando la factory documentata non fallisce più immediatamente e il comportamento è coperto da un test di regressione.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- java
- Ambito
- data
- Tipo di issue
- Bug
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 35/100