You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@beam.apache.org by GitBox <gi...@apache.org> on 2022/09/26 19:23:11 UTC

[GitHub] [beam] Abacn opened a new issue, #23374: [Feature Request]: Design and Implement CoderLogicalType

Abacn opened a new issue, #23374:
URL: https://github.com/apache/beam/issues/23374

   ### What would you like to happen?
   
   It was mentioned in #7865 that a CoderLogicalType could enable any existing Coder to be used as a Schema field. In particular, the micros_millis and decimal logical types are made to be compatible with existing datetime and decimal java fieldtype, and they do not fit in the beam portable logical type representations. Currently they are treated as special cases with a representation that is not quite true: https://github.com/apache/beam/blob/3a4d57eb8976c5f503b32d478a80b1800490f66f/sdks/java/core/src/main/java/org/apache/beam/sdk/schemas/SchemaTranslation.java#L201
   
   For example, 
   here DATETIME has a representation of FieldType.INT64, but FieldType.INT64 is decoded with VarIntCoder, different from the actually used BigEndianLongCoder. 
   here DECIMAL has a representation of FieldType.BYTES, but the actually used BigDecimalCoder encoded a VarInt and a Bytes.
   
   Introducing CoderLogicalType and specify the coder to the logical type's payload could clarify this issue.
   
   ### Issue Priority
   
   Priority: 2
   
   ### Issue Component
   
   Component: cross-language


-- 
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: github-unsubscribe@beam.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [Feature Request]: Design and Implement CoderLogicalType [beam]

Posted by "Abacn (via GitHub)" <gi...@apache.org>.
Abacn commented on issue #23374:
URL: https://github.com/apache/beam/issues/23374#issuecomment-3246706154

   Logical type by definition is a derived type with some "meaning" on its representation type. A better route could be introducing a "Raw" type in Beam model:
   
   https://github.com/apache/beam/blob/4289ea20a8dc962dab0ead17ec8216a63655c48d/model/pipeline/src/main/proto/org/apache/beam/model/pipeline/v1/schema.proto#L66
   
   saying, add a
   
   ```
   RawType raw_type = 8;
   ```
   
   and
   
   ```
   message RawType {
     Coder coder = 1;
   }
   ```
   
   In the case of millis instant instant, it is then a logical type of `RAW<BigEndianInt32Coder>`
   
   A full design is planned.


-- 
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: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org