ProtoRecordConverter might wrongly cast a Message.Builder to Message
- 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
Research direction
Start at ProtoRecordConverter#getCurrentRecord and inspect the reusedBuilder and buildBefore paths described in the issue. Reproduce the case where the current record type is a Message subclass and buildBefore is false, then verify that the returned value has the expected Message type without a cast failure.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- data-engineering
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100