Class BeamWordCount.CountWords

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

    public static final class BeamWordCount.CountWords
    extends org.apache.beam.sdk.transforms.PTransform<org.apache.beam.sdk.values.PCollection<java.lang.String>,​org.apache.beam.sdk.values.PCollection<org.apache.beam.sdk.values.KV<java.lang.String,​java.lang.Long>>>
    A PTransform that converts a PCollection containing lines of text into a PCollection of formatted word counts.

    Concept #3: This is a custom composite transform that bundles two transforms (ParDo and Count) as a reusable PTransform subclass. Using composite transforms allows for easy reuse, modular testing, and an improved monitoring experience.

    See Also:
    Serialized Form
    • Field Summary

      • Fields inherited from class org.apache.beam.sdk.transforms.PTransform

        name
    • Constructor Summary

      Constructors 
      Constructor Description
      CountWords()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      org.apache.beam.sdk.values.PCollection<org.apache.beam.sdk.values.KV<java.lang.String,​java.lang.Long>> expand​(org.apache.beam.sdk.values.PCollection<java.lang.String> lines)  
      • Methods inherited from class org.apache.beam.sdk.transforms.PTransform

        compose, compose, getAdditionalInputs, getDefaultOutputCoder, getDefaultOutputCoder, getDefaultOutputCoder, getKindString, getName, populateDisplayData, toString, validate
      • Methods inherited from class java.lang.Object

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

      • CountWords

        public CountWords()
    • Method Detail

      • expand

        public org.apache.beam.sdk.values.PCollection<org.apache.beam.sdk.values.KV<java.lang.String,​java.lang.Long>> expand​(org.apache.beam.sdk.values.PCollection<java.lang.String> lines)
        Specified by:
        expand in class org.apache.beam.sdk.transforms.PTransform<org.apache.beam.sdk.values.PCollection<java.lang.String>,​org.apache.beam.sdk.values.PCollection<org.apache.beam.sdk.values.KV<java.lang.String,​java.lang.Long>>>