public class WordCount extends Object
Concepts: Reading/writing text files; counting a PCollection; user-defined PTransforms
To execute this pipeline locally, specify general pipeline configuration:
--project=YOUR_PROJECT_ID
and a local output file or output prefix on GCS:
--output=[YOUR_LOCAL_FILE | gs://YOUR_OUTPUT_PREFIX]
To execute this pipeline using the Dataflow service, specify pipeline configuration:
--project=YOUR_PROJECT_ID
--stagingLocation=gs://YOUR_STAGING_DIRECTORY
--runner=BlockingDataflowPipelineRunner
and an output prefix on GCS:
--output=gs://YOUR_OUTPUT_PREFIX
The input file defaults to gs://dataflow-samples/shakespeare/kinglear.txt and can be
overridden with --input.
| Modifier and Type | Class and Description |
|---|---|
static class |
WordCount.CountWords
A PTransform that converts a PCollection containing lines of text into a PCollection of
formatted word counts.
|
static interface |
WordCount.Options
Options supported by
WordCount. |
| Constructor and Description |
|---|
WordCount() |
public static void main(String[] args)