Repository: beam-site Updated Branches: refs/heads/asf-site bb4221bd8 -> aac389466
[BEAM-1695] Improve Python-SDK's programming guide Project: http://git-wip-us.apache.org/repos/asf/beam-site/repo Commit: http://git-wip-us.apache.org/repos/asf/beam-site/commit/faa12ffd Tree: http://git-wip-us.apache.org/repos/asf/beam-site/tree/faa12ffd Diff: http://git-wip-us.apache.org/repos/asf/beam-site/diff/faa12ffd Branch: refs/heads/asf-site Commit: faa12ffd7b841e01b5a7386c84a856cf4b30c9e9 Parents: bb4221b Author: Tibor Kiss <[email protected]> Authored: Thu Apr 27 14:30:11 2017 +0200 Committer: Ahmet Altay <[email protected]> Committed: Fri Apr 28 17:36:18 2017 -0700 ---------------------------------------------------------------------- src/documentation/programming-guide.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/beam-site/blob/faa12ffd/src/documentation/programming-guide.md ---------------------------------------------------------------------- diff --git a/src/documentation/programming-guide.md b/src/documentation/programming-guide.md index 93074fb..8e8b917 100644 --- a/src/documentation/programming-guide.md +++ b/src/documentation/programming-guide.md @@ -577,7 +577,7 @@ public class AverageFn extends CombineFn<Integer, AverageFn.Accum, Double> { ```py pc = ... -{% github_sample /apache/beam/blob/master/sdks/python/apache_beam/examples/snippets/snippets_test.py tag:combine_custom_average +{% github_sample /apache/beam/blob/master/sdks/python/apache_beam/examples/snippets/snippets_test.py tag:combine_custom_average_define %}``` If you are combining a `PCollection` of key-value pairs, [per-key combining](#transforms-combine-per-key) is often enough. If you need the combining strategy to change based on the key (for example, MIN for some users and MAX for other users), you can define a `KeyedCombineFn` to access the key within the combining strategy. @@ -598,7 +598,7 @@ PCollection<Integer> sum = pc.apply( # sum combines the elements in the input PCollection. # The resulting PCollection, called result, contains one value: the sum of all the elements in the input PCollection. pc = ... -{% github_sample /apache/beam/blob/master/sdks/python/apache_beam/examples/snippets/snippets_test.py tag:combine_custom_average +{% github_sample /apache/beam/blob/master/sdks/python/apache_beam/examples/snippets/snippets_test.py tag:combine_custom_average_execute %}``` ##### Global windowing: @@ -727,6 +727,7 @@ PCollection<Student> fortiethPercentile = studentsByPercentile.get(4); ```py # Provide an int value with the desired number of result partitions, and a partitioning function (partition_fn in this example). # Returns a tuple of PCollection objects containing each of the resulting partitions as individual PCollection objects. +students = ... {% github_sample /apache/beam/blob/master/sdks/python/apache_beam/examples/snippets/snippets.py tag:model_multiple_pcollections_partition %} @@ -811,7 +812,7 @@ Side inputs are useful if your `ParDo` needs to inject additional data when proc # Optional, positional, and keyword arguments are all supported. Deferred arguments are unwrapped into their actual values. # For example, using pvalue.AsIter(pcoll) at pipeline construction time results in an iterable of the actual elements of pcoll being passed into each process invocation. # In this example, side inputs are passed to a FlatMap transform as extra arguments and consumed by filter_using_length. - +words = ... {% github_sample /apache/beam/blob/master/sdks/python/apache_beam/examples/snippets/snippets_test.py tag:model_pardo_side_input %}
