Skip to content

Instantly share code, notes, and snippets.

@brunoripa
Created January 30, 2018 14:49
Show Gist options
  • Save brunoripa/a14e4f8417631fae04d73aa0e3936c81 to your computer and use it in GitHub Desktop.
Save brunoripa/a14e4f8417631fae04d73aa0e3936c81 to your computer and use it in GitHub Desktop.
timings = (
rows |
apache_beam.ParDo(CollectTimings()) |
"Grouping timings" >> apache_beam.GroupByKey() |
"Calculating average" >> apache_beam.CombineValues(
apache_beam.combiners.MeanCombineFn()
)
)
users = (
rows |
apache_beam.ParDo(CollectUsers()) |
"Grouping users" >> apache_beam.GroupByKey() |
"Counting users" >> apache_beam.CombineValues(
apache_beam.combiners.CountCombineFn()
)
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment