ParquetReader.read(InputFile) always causes exception on build
- Lenguaje dominante
- Java
- Estrellas
- 3.1k
- Forks
- 1.6k
- Merge medio
- 3 d 12 h
- PR fusionados (30 d)
- 33
Descripción
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.*
Guía de contribución
No hay ninguna guía de contribución indexada para este repositorio
Línea de trabajo
Comienza con ParquetReader.read(InputFile), sigue después el Builder devuelto hasta build() y su comprobación de getReadSupport(). Reproduce el fallo con HadoopInputFile.fromPath y compáralo con la ruta funcional ParquetFileReader.open(InputFile). Se considera terminado cuando la factory documentada ya no falla inmediatamente y el comportamiento está cubierto por una prueba de regresión.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- java
- Área
- data
- Tipo de issue
- Error
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Estado de actividad
- Estancado
- Claridad
- Bastante claro
- Aptitud para principiantes
- 35/100