Class WriteToText<InputT>

  • All Implemented Interfaces:
    java.io.Serializable, org.apache.beam.sdk.transforms.display.HasDisplayData

    public class WriteToText<InputT>
    extends org.apache.beam.sdk.transforms.PTransform<org.apache.beam.sdk.values.PCollection<InputT>,​org.apache.beam.sdk.values.PDone>
    Generate, format, and write rows. Use provided information about the field names and types, as well as lambda functions that describe how to generate their values.
    See Also:
    Serialized Form
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      protected class  WriteToText.BuildRowFn
      Convert each key/score pair into a row as specified by fieldFn.
      static interface  WriteToText.FieldFn<InputT>
      A Serializable function from a DoFn.ProcessContext and BoundedWindow to the value for that field.
      protected static class  WriteToText.PerWindowFiles
      A FileBasedSink.FilenamePolicy produces a base file name for a write based on metadata about the data being written.
      protected static class  WriteToText.WriteOneFilePerWindow
      A DoFn that writes elements to files with names deterministically derived from the lower and upper bounds of their key (an IntervalWindow).
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected java.util.Map<java.lang.String,​WriteToText.FieldFn<InputT>> fieldFn  
      protected java.lang.String filenamePrefix  
      protected boolean windowed  
      • Fields inherited from class org.apache.beam.sdk.transforms.PTransform

        annotations, displayData, name, resourceHints
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      org.apache.beam.sdk.values.PDone expand​(org.apache.beam.sdk.values.PCollection<InputT> teamAndScore)  
      • Methods inherited from class org.apache.beam.sdk.transforms.PTransform

        addAnnotation, compose, compose, getAdditionalInputs, getAnnotations, getDefaultOutputCoder, getDefaultOutputCoder, getDefaultOutputCoder, getKindString, getName, getResourceHints, populateDisplayData, setDisplayData, setResourceHints, toString, validate, validate
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • filenamePrefix

        protected java.lang.String filenamePrefix
      • windowed

        protected boolean windowed
    • Constructor Detail

      • WriteToText

        public WriteToText()
      • WriteToText

        public WriteToText​(java.lang.String filenamePrefix,
                           java.util.Map<java.lang.String,​WriteToText.FieldFn<InputT>> fieldFn,
                           boolean windowed)
    • Method Detail

      • expand

        public org.apache.beam.sdk.values.PDone expand​(org.apache.beam.sdk.values.PCollection<InputT> teamAndScore)
        Specified by:
        expand in class org.apache.beam.sdk.transforms.PTransform<org.apache.beam.sdk.values.PCollection<InputT>,​org.apache.beam.sdk.values.PDone>