This is an automated email from the ASF dual-hosted git repository.
altay pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/beam.git
The following commit(s) were added to refs/heads/master by this push:
new d5810397e60 Fix example code on from-spark.md
new 170c4184ce1 Merge pull request #25633 from andreykot/patch-1
d5810397e60 is described below
commit d5810397e60564e063fa0f393daab93119ba1bc3
Author: Andrey Kot <[email protected]>
AuthorDate: Sun Feb 26 02:09:53 2023 +0100
Fix example code on from-spark.md
---
website/www/site/content/en/get-started/from-spark.md | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/website/www/site/content/en/get-started/from-spark.md
b/website/www/site/content/en/get-started/from-spark.md
index 26a615304b3..36d1fb2a045 100644
--- a/website/www/site/content/en/get-started/from-spark.md
+++ b/website/www/site/content/en/get-started/from-spark.md
@@ -312,11 +312,12 @@ with beam.Pipeline() as pipeline:
min_value = values | beam.CombineGlobally(min)
max_value = values | beam.CombineGlobally(max)
- # To access `total`, we need to pass it as a side input.
+ # To access `min_value` and `max_value`, we need to pass them as a side
input.
scaled_values = values | beam.Map(
- lambda x, min_value, max_value: x / lambda x: (x - min_value) /
(max_value - min_value),
- min_value =beam.pvalue.AsSingleton(min_value),
- max_value =beam.pvalue.AsSingleton(max_value))
+ lambda x, minimum, maximum: (x - minimum) / (maximum - minimum),
+ minimum=beam.pvalue.AsSingleton(min_value),
+ maximum=beam.pvalue.AsSingleton(max_value),
+ )
scaled_values | beam.Map(print)
{{< /highlight >}}