[
https://issues.apache.org/jira/browse/PARQUET-388?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14987295#comment-14987295
]
Wu Xiang commented on PARQUET-388:
----------------------------------
Hi Lukas,
Thanks for your reply.
To be sure, when you say 'The cast is correct', do you mean by that
{{ProtoRecordConverter<MyProtoMessage>::getCurrentRecord}} would work correctly
?
In my case, I created a instance of {{ProtoReadSupport<MyProtoMessage>}}, which
then created {{RecordMaterializer<MyProtoMessage>}} and
{{ProtoRecordConverter<MyProtoMessage>}} instances internally. Since the
{{buildBefore}} flag is not set,
{{ProtoRecordConverter<MyProtoMessage>::getCurrentRecord}} would definitely
cast a {{MyProtoMessage.Builder}} instance to {{MyProtoMessage}}, with runtime
exceptions.
P.S. The signature for {{ProtoReadSupport}} is as follows, which leads
{{ProtoReadSupport<MyProtoMessage.Builder>}} to compile time error.
{code}
public class ProtoReadSupport<T extends Message> extends ReadSupport<T> {}
{code}
wu
> ProtoRecordConverter might wrongly cast a Message.Builder to Message
> --------------------------------------------------------------------
>
> Key: PARQUET-388
> URL: https://issues.apache.org/jira/browse/PARQUET-388
> Project: Parquet
> Issue Type: Bug
> Components: parquet-mr
> Reporter: Wu Xiang
> Assignee: Reuben Kuhnert
>
> ProtoRecordConverter returns current record as follows:
> {code}
> public T getCurrentRecord() {
> if (buildBefore) {
> return (T) this.reusedBuilder.build();
> } else {
> return (T) this.reusedBuilder;
> }
> }
> {code}
> 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.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)