apache / apache/parquet-java

Schema change results in exception - java.lang.ClassCastException

Đang mở
#2,365 3 bình luận 0 reaction 0 người được giao Xem trên GitHub
Component: Avro Component: Parquet Priority: Major Type: bug
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ả

Following exception was seen with parquet 1.8.1 (and in parquet 1.12.0, when trying to reproduce it).

Exception in thread "main" java.lang.ClassCastException: optional binary phone_number (STRING) is not a group
at com.uber.komondor.shaded.org.apache.parquet.schema.Type.asGroupType(Type.java:250)
at com.uber.komondor.shaded.org.apache.parquet.avro.AvroRecordConverter.newConverter(AvroRecordConverter.java:279)
at com.uber.komondor.shaded.org.apache.parquet.avro.AvroRecordConverter.newConverter(AvroRecordConverter.java:232)
at com.uber.komondor.shaded.org.apache.parquet.avro.AvroRecordConverter.access$100(AvroRecordConverter.java:78)
at org.apache.parquet.avro.AvroRecordConverter$AvroCollectionConverter$ElementConverter.(AvroRecordConverter.java:536)
at org.apache.parquet.avro.AvroRecordConverter$AvroCollectionConverter.(AvroRecordConverter.java:486)
at org.apache.parquet.avro.AvroRecordConverter.newConverter(AvroRecordConverter.java:289)
at org.apache.parquet.avro.AvroRecordConverter.(AvroRecordConverter.java:141)
at org.apache.parquet.avro.AvroRecordConverter.newConverter(AvroRecordConverter.java:279)
at org.apache.parquet.avro.AvroRecordConverter.(AvroRecordConverter.java:141)
at org.apache.parquet.avro.AvroRecordConverter.(AvroRecordConverter.java:95)
at org.apache.parquet.avro.AvroRecordMaterializer.(AvroRecordMaterializer.java:33)
at org.apache.parquet.avro.AvroReadSupport.prepareForRead(AvroReadSupport.java:138)
at org.apache.parquet.hadoop.InternalParquetRecordReader.initialize(InternalParquetRecordReader.java:183)
at org.apache.parquet.hadoop.ParquetReader.initReader(ParquetReader.java:156)
at org.apache.parquet.hadoop.ParquetReader.read(ParquetReader.java:135)
at util.ParquetToAvroSchemaConverter$.convert(ParquetToAvroSchemaConverter.scala:46)
at util.ParquetToAvroSchemaConverter$.main(ParquetToAvroSchemaConverter.scala:20)
at util.ParquetToAvroSchemaConverter.main(ParquetToAvroSchemaConverter.scala)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.hadoop.util.RunJar.run(RunJar.java:221)
at org.apache.hadoop.util.RunJar.main(RunJar.java:136)

Original exception was triggered by the following schema change.
Schema Before change:
{
"default": null,
"name": "master_cluster",
"type": [
"null",
{
"fields": [
{
"name": "uuid",
"type": "string"
},
{
"name": "namespace",
"type": "string"
},
{
"name": "version",
"type": "long"
}
],
"name": "master_cluster",
"type": "record"
}
]
},

After schema change:
{
"default": null,
"name": "master_cluster",
"type": [
"null",
{
"fields": [
{
"default": null,
"name": "uuid",
"type": [
"null",
"string"
]
},
{
"default": null,
"name": "namespace",
"type": [
"null",
"string"
]
},
{
"default": null,
"name": "version",
"type": [
"null",
"long"
]
}
],
"name": "VORGmaster_cluster",
"type": "record"
}
]
},

We were suspecting PARQUET-1441 could be in play and tried to reproduce the issue on parquet-1.12.0 and seeing the same exception.

During the repro noticed that issue could be with avroSchema conversion (field name was substituted with generic name "array"). While we look into this further, want to get community input on whether this is a known issue and any thoughts on path forward.

19/09/12 22:34:37 DEBUG avro.SchemaCompatibility: Checking compatibility of reader {"type":"record","name":"IDphones_items","fields":[{"name":"phone_number","type":["null","string"],"default":null}]} with writer {"type":"record","name":"array","fields":[{"name":"phone_number","type":["null","string"],"default":null}]}

**Environment**: Hoodie/Parquet/Avro

Parquet-1.8.1

Avro-1.7.6
**Reporter**: [Balajee Nagasubramaniam](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=balajeeUber)
**Assignee**: [Xinli Shang](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=shangx@uber.com) / @shangxinli
#### Externally tracked issue: [https://issues.apache.org/jira/browse/PARQUET-1681](https://issues.apache.org/jira/browse/PARQUET-1681)

**Note**: *This issue was originally created as [PARQUET-1656](https://issues.apache.org/jira/browse/PARQUET-1656). 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 các điểm vào của stack trace trong AvroRecordConverter và AvroReadSupport, sau đó kiểm tra util.ParquetToAvroSchemaConverter.scala tại các dòng chuyển đổi được báo cáo. So sánh các schema trước và sau, cùng với các schema reader/writer được ghi log, và kiểm tra issue PARQUET-1681 được theo dõi bên ngoài để xác định trạng thái hiện tại và definition of done.

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-engineering
Loại issue
Lỗi
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Cần làm rõ
Mức phù hợp với người mới
35/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.