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

Jesse Anderson updated BEAM-225:
--------------------------------
    Description: 
There should be a built-in class for common types like String, Float, etc.

Right now, all types have to create an inline TypeDescriptor:
{code:java}
        PCollection<String> words = suits.apply(
                FlatMapElements.via(
                        (String line) -> Arrays.asList(line.split(" "))
                ).withOutputType(new TypeDescriptor<String>() {}));
{code}

The should be a built-in class with common types like String so you don't have 
to create a TypeDescriptor each time like:
{code:java}
              PCollection<String> words = suits.apply(
                FlatMapElements.via(
                        (String line) -> Arrays.asList(line.split(" "))
                ).withOutputType(TypeDescriptors.STRINGS));
{code}

Another possibility is to make it a static method:

{code:java}
              PCollection<String> words = suits.apply(
                FlatMapElements.via(
                        (String line) -> Arrays.asList(line.split(" "))
                ).withOutputType(TypeDescriptors.strings()));
{code}

An example of this is Apache Crunch's Writables class 
https://crunch.apache.org/apidocs/0.11.0/org/apache/crunch/types/writable/Writables.html.

  was:
There should be a built-in class for common types like String, Float, etc.

Right now, all types have to create an inline TypeDescriptor:
{code:java}
        PCollection<String> words = suits.apply(
                FlatMapElements.via(
                        (String line) -> Arrays.asList(line.split(" "))
                ).withOutputType(new TypeDescriptor<String>() {}));
{code}

The should be a built-in class with common types like String so you don't have 
to create a TypeDescriptor each time like:
{code:java}
              PCollection<String> words = suits.apply(
                FlatMapElements.via(
                        (String line) -> Arrays.asList(line.split(" "))
                ).withOutputType(TypeDescriptors.STRINGS));
{code}

An example of this is Apache Crunch's Writables class 
https://crunch.apache.org/apidocs/0.11.0/org/apache/crunch/types/writable/Writables.html.


> Create Class for Common TypeDescriptors
> ---------------------------------------
>
>                 Key: BEAM-225
>                 URL: https://issues.apache.org/jira/browse/BEAM-225
>             Project: Beam
>          Issue Type: Bug
>          Components: sdk-java-core
>            Reporter: Jesse Anderson
>            Assignee: Davor Bonaci
>
> There should be a built-in class for common types like String, Float, etc.
> Right now, all types have to create an inline TypeDescriptor:
> {code:java}
>         PCollection<String> words = suits.apply(
>                 FlatMapElements.via(
>                         (String line) -> Arrays.asList(line.split(" "))
>                 ).withOutputType(new TypeDescriptor<String>() {}));
> {code}
> The should be a built-in class with common types like String so you don't 
> have to create a TypeDescriptor each time like:
> {code:java}
>               PCollection<String> words = suits.apply(
>                 FlatMapElements.via(
>                         (String line) -> Arrays.asList(line.split(" "))
>                 ).withOutputType(TypeDescriptors.STRINGS));
> {code}
> Another possibility is to make it a static method:
> {code:java}
>               PCollection<String> words = suits.apply(
>                 FlatMapElements.via(
>                         (String line) -> Arrays.asList(line.split(" "))
>                 ).withOutputType(TypeDescriptors.strings()));
> {code}
> An example of this is Apache Crunch's Writables class 
> https://crunch.apache.org/apidocs/0.11.0/org/apache/crunch/types/writable/Writables.html.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to