Details
-
Bug
-
Status: Resolved
-
P4
-
Resolution: Fixed
-
None
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.