ParquetReader.read(InputFile) always causes exception on build
- Ngôn ngữ chính
- Java
- Star
- 3.1k
- Fork
- 1.6k
- Merge trung bình
- 3 ngày 12 giờ
- Pull request đã merge (30 ngày)
- 33
Mô tả
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.*
Hướng dẫn đóng góp
Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này
Hướng nghiên cứu
Bắt đầu với ParquetReader.read(InputFile), sau đó lần theo Builder được trả về đến build() và bước kiểm tra getReadSupport() của nó. Tái hiện lỗi với HadoopInputFile.fromPath và so sánh với đường dẫn đang hoạt động ParquetFileReader.open(InputFile). Hoàn tất có nghĩa là factory được ghi trong tài liệu không còn thất bại ngay lập tức và hành vi này được kiểm thử bằng một regression test.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- java
- Lĩnh vực
- data
- Loại issue
- Lỗi
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 35/100