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

Kenneth Knowles edited comment on BEAM-5967 at 11/5/18 8:53 PM:
----------------------------------------------------------------

So the question is where are you going to get that argument? If you provide it 
to a manually-instantiated coder then it should be pretty easy. If the code 
ends up with conditionals in every method, then it would make sense to have a 
separate class, but that is just an implementation detail. If you are going to 
include it in the data then it could be very inefficient (I think we have some 
Avro cases that do this :-/ )


was (Author: kenn):
So the hard question is where are you going to get that argument? If you 
provide it to a manually-instantiated coder then it should be pretty easy. If 
the code ends up with conditionals in every method, then it would make sense to 
have a separate class, but that is just an implementation detail.

> ProtoCoder doesn't support DynamicMessage
> -----------------------------------------
>
>                 Key: BEAM-5967
>                 URL: https://issues.apache.org/jira/browse/BEAM-5967
>             Project: Beam
>          Issue Type: Improvement
>          Components: sdk-java-core
>    Affects Versions: 2.8.0
>            Reporter: Alex Van Boxel
>            Priority: Major
>
> The ProtoCoder does make some assumptions about static messages being 
> available. The DynamicMessage doesn't have some of them, mainly because the 
> proto schema is defined at runtime and not at compile time.
> Does it make sense to make a special coder for DynamicMessage or build it 
> into the normal ProtoCoder.
> Here is an example of the assumtion being made in the current Codec:
> {code:java}
> try {
>   @SuppressWarnings("unchecked")
>   T protoMessageInstance = (T) 
> protoMessageClass.getMethod("getDefaultInstance").invoke(null);
>   @SuppressWarnings("unchecked")
>   Parser<T> tParser = (Parser<T>) protoMessageInstance.getParserForType();
>   memoizedParser = tParser;
> } catch (IllegalAccessException | InvocationTargetException | 
> NoSuchMethodException e) {
>   throw new IllegalArgumentException(e);
> }
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to