[ 
https://issues.apache.org/jira/browse/PARQUET-388?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15127838#comment-15127838
 ] 

Matt Martin commented on PARQUET-388:
-------------------------------------

I agree with [~wxiang7] that there seems to be something a little bit off here. 
 I'm also getting an unexpected ClassCastException in the following Scala code:

{code}
val reader = ParquetReader.builder(new ProtoReadSupport[SomeMessageClass](), 
new Path(file.toURI)).build
...
reader.read
{code}

At reader.read I get the following exception:

{code}
ClassCastException: : SomeMessageClass$Builder cannot be cast to 
SomeMessageClass
{code}

I cannot change the declaration of reader to the following:

{code}
val reader = ParquetReader.builder(new 
ProtoReadSupport[SomeMessageClass$Builder](), new Path(file.toURI)).build
{code}

because then I get the following error:

{code}
type arguments [SomeMessageClass$Builder] do not conform to class 
ProtoReadSupport's type parameter bounds [T <: com.google.protobuf.Message]
{code}

> 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)

Reply via email to