Skip to content

Instantly share code, notes, and snippets.

@sandboxws
Created December 15, 2018 03:58
Show Gist options
  • Select an option

  • Save sandboxws/5691224901842c5aaa52fd55b59e5b2b to your computer and use it in GitHub Desktop.

Select an option

Save sandboxws/5691224901842c5aaa52fd55b59e5b2b to your computer and use it in GitHub Desktop.
PCollection<KV<String, Long>> ratingsCounts = csvRows
.apply("Extract Ratings",
FlatMapElements.into(TypeDescriptors.strings())
.via(csvRow -> Arrays.asList(csvRow.split(",")[1])))
.apply("Count Ratings", Count.<String>perElement());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment