reuvenlax commented on pull request #16558:
URL: https://github.com/apache/beam/pull/16558#issuecomment-1027182884


   I think the existing code to map Coder class -> URN is based on Class
   identity (i.e. hashmap Class -> String), so it won't take in account class
   inheritance relationships. We could of course special case it there, but
   then we're simply moving this complexity from one place to another, not
   getting rid of it.
   
   On Tue, Feb 1, 2022 at 10:52 AM Brian Hulette ***@***.***>
   wrote:
   
   > ***@***.**** commented on this pull request.
   >
   > It seems there's a lot of complexity introduced because we now have two
   > Java classes mapping to one URN. Could it be simplified by just mapping
   > SchemaCoder to beam:coder:row:v1 instead of RowCoder? a RowCoder is a
   > SchemaCoder after all:
   > 
https://github.com/apache/beam/blob/59b0b2a53140a149f06b3001505530173cbce9d8/sdks/java/core/src/main/java/org/apache/beam/sdk/coders/RowCoder.java#L34
   >
   > The hydration logic could just branch on whether or not sdk_options is
   > defined (and similarly for rehydration). Or maybe I'm missing something?
   > ------------------------------
   >
   > In model/pipeline/src/main/proto/schema.proto
   > <https://github.com/apache/beam/pull/16558#discussion_r796889046>:
   >
   > > @@ -37,6 +37,7 @@ message Schema {
   >
   >    // REQUIRED. An RFC 4122 UUID.
   >
   >    string id = 2;
   >
   >    repeated Option options = 3;
   >
   > +  repeated Option sdk_options = 5;
   >
   >
   > Could you document this briefly here?
   > ------------------------------
   >
   > In model/pipeline/src/main/proto/schema.proto
   > <https://github.com/apache/beam/pull/16558#discussion_r796889724>:
   >
   > > @@ -46,7 +47,7 @@ message Field {
   >
   >    string name = 1;
   >
   >    // OPTIONAL. Human readable description of this field, such as the 
query that generated it.
   >
   >    string description = 2;
   >
   > -  FieldType type = 3;
   >
   > +    FieldType type = 3;
   >
   >
   > nit: this looks unnecessary (but maybe there is an indentation issue below)
   > ⬇️ Suggested change
   >
   > -    FieldType type = 3;
   >
   > +  FieldType type = 3;
   >
   >
   > ------------------------------
   >
   > In
   > 
runners/core-construction-java/src/test/java/org/apache/beam/runners/core/construction/CommonCoderTest.java
   > <https://github.com/apache/beam/pull/16558#discussion_r796891877>:
   >
   > > @@ -334,8 +334,9 @@ private static Object convertValue(Object value, 
CommonCoder coderSpec, Coder co
   >
   >      } else if (s.equals(getUrn(StandardCoders.Enum.ROW))) {
   >
   >        Schema schema;
   >
   >        try {
   >
   > -        schema =
   >
   > -            
SchemaTranslation.schemaFromProto(SchemaApi.Schema.parseFrom(coderSpec.getPayload()));
   >
   > +        SchemaApi.Schema protoSchema;
   >
   > +        protoSchema = SchemaApi.Schema.parseFrom(coderSpec.getPayload());
   >
   > +        schema = SchemaTranslation.schemaFromProto(protoSchema);
   >
   >
   > Did anything functionally change here?
   >
   > —
   > Reply to this email directly, view it on GitHub
   > <https://github.com/apache/beam/pull/16558#pullrequestreview-869638174>,
   > or unsubscribe
   > 
<https://github.com/notifications/unsubscribe-auth/AFAYJVJQAAXGGBZMWYTANXDUZATVZANCNFSM5MJETAQQ>
   > .
   > Triage notifications on the go with GitHub Mobile for iOS
   > 
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
   > or Android
   > 
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
   >
   > You are receiving this because you authored the thread.Message ID:
   > ***@***.***>
   >
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to