ParquetReader.read(InputFile) always causes exception on build
- Langage dominant
- Java
- Étoiles
- 3.1k
- Forks
- 1.6k
- Merge moyen
- 3 j 12 h
- PR mergées (30 j)
- 33
Description
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.*
Guide de contribution
Aucun guide de contribution indexé pour ce dépôt
Piste de recherche
Commencez par ParquetReader.read(InputFile), puis suivez le Builder renvoyé jusqu'à build() et à sa vérification de getReadSupport(). Reproduisez l'échec avec HadoopInputFile.fromPath et comparez-le au chemin fonctionnel ParquetFileReader.open(InputFile). C'est terminé lorsque la factory documentée n'échoue plus immédiatement et que le comportement est couvert par un test de régression.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- java
- Domaine
- data
- Type d'issue
- Bug
- Difficulté
- 3/5
- Temps estimé
- 1-2 jours
- Activité
- À l'abandon
- Clarté
- Plutôt claire
- Accessibilité débutants
- 35/100