beamcookbook

View project on GitHub

Home

Getting Started Tutorial

Setup Project

CD into tutorial folders

cd tutorials/03-elementlevelxform-count

Understand Code

Custom options class

To begin, let’s look at a customs Options class.

Open src/main/java/com/gcp/cookbook/03-elementlevelxform-count/AppOptions.java

  • line 10-13

    A default getter and setter for runtime argument. (----countbyChoice=false)

Explain Pipeline Now let’s look at the pipeline main method.

Open src/main/java/com/gcp/cookbook/getting-started/CountPipeline.java

  • line 40:

    Initializes the Pipeline with default options.

  • line 42:

    Get the Count Choice option

  • line 49:

    Populate the pipeline with a list of Integers and use the Count method to calculate the Count globally

  • line 46:

    Output the count.

  • line 46:

    Populate the pipeline with a list of Integers and use the Count method to calculate the Count per Element Category

  • line 46:

    Output the count.

Run Pipeline

mvn compile exec:java -Dexec.mainClass=com.gcp.cookbook.CountPipeline \
     -Dexec.args="--countbyChoice=false --runner=DirectRunner"