apache / apache/parquet-java

ProtoRecordConverter might wrongly cast a Message.Builder to Message

Open
#1,899 9 comments 0 reactions 0 assignees View on GitHub
Component: Java Component: Parquet Priority: Major Type: bug
Dominant language
Java
Stars
3.1k
Forks
1.6k
Avg merge
3d 12h
Merged PRs (30d)
33

Description

ProtoRecordConverter returns current record as follows:

```Java
public T getCurrentRecord() {
if (buildBefore) {
return (T) this.reusedBuilder.build();
} else {
return (T) this.reusedBuilder;
}
}
```

However this might fail if T is subclass of Message and buildBefore == false, since it's actually casting a Message.Builder instance to Message type.

**Reporter**: [Wu Xiang](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=wxiang7)
**Assignee**: [Reuben Kuhnert](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=sircodesalot) / @sircodesalotOfTheRound

**Note**: *This issue was originally created as [PARQUET-388](https://issues.apache.org/jira/browse/PARQUET-388). Please see the [migration documentation](https://issues.apache.org/jira/browse/PARQUET-2502) for further details.*

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.