You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@beam.apache.org by "Alex Van Boxel (JIRA)" <ji...@apache.org> on 2018/11/05 12:04:00 UTC

[jira] [Updated] (BEAM-5967) ProtoCoder doesn't support DynamicMessage

     [ https://issues.apache.org/jira/browse/BEAM-5967?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Alex Van Boxel updated BEAM-5967:
---------------------------------
    Description: 
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 codec 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}

  was:
The ProtoCodec 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 codec for DynamicMessage or build it into the normal ProtoCodec.

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}

        Summary: ProtoCoder doesn't support DynamicMessage  (was: ProtoCodec doesn't support DynamicMessage)

> 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
>            Assignee: Kenneth Knowles
>            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 codec 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)