Uploaded image for project: 'Beam'
  1. Beam
  2. BEAM-225

Create Class for Common TypeDescriptors

Details

    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:

              PCollection<String> words = suits.apply(
                      FlatMapElements.via(
                              (String line) -> Arrays.asList(line.split(" "))
                      ).withOutputType(new TypeDescriptor<String>() {}));
      

      The should be a built-in class with common types like String so you don't have to create a TypeDescriptor each time like:

                    PCollection<String> words = suits.apply(
                      FlatMapElements.via(
                              (String line) -> Arrays.asList(line.split(" "))
                      ).withOutputType(TypeDescriptors.STRINGS));
      

      Another possibility is to make it a static method:

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

      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.

      Attachments

        Activity

          People

            eljefe6aa Jesse Anderson
            eljefe6aa Jesse Anderson
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: