damccorm commented on code in PR #37789:
URL: https://github.com/apache/beam/pull/37789#discussion_r2962268304


##########
website/www/site/content/en/documentation/patterns/side-inputs.md:
##########
@@ -48,7 +48,40 @@ For instance, the following code sample uses a `Map` to 
create a `DoFn`. The `Ma
 {{< /highlight >}}
 
 {{< highlight py >}}
-No sample present.
+import apache_beam as beam
+from apache_beam.options.pipeline_options import PipelineOptions
+
+class FetchSideInput(beam.DoFn):
+    def process(self, element):
+        # simulate fetching external data
+        yield {"threshold": 10}
+
+def run():
+    with beam.Pipeline(options=PipelineOptions()) as p:
+
+        main_input = (
+            p
+            | "CreateMainInput" >> beam.Create([1, 5, 10, 20])

Review Comment:
   We should use a streaming source here - I'd recommend trying to replicate 
https://github.com/apache/beam/blob/180f3a6bdb5c929c252cba3b62cf7bba800f58b0/examples/java/src/main/java/org/apache/beam/examples/snippets/Snippets.java#L888



##########
website/www/site/content/en/documentation/patterns/side-inputs.md:
##########
@@ -48,7 +48,40 @@ For instance, the following code sample uses a `Map` to 
create a `DoFn`. The `Ma
 {{< /highlight >}}
 
 {{< highlight py >}}
-No sample present.
+import apache_beam as beam
+from apache_beam.options.pipeline_options import PipelineOptions
+
+class FetchSideInput(beam.DoFn):
+    def process(self, element):
+        # simulate fetching external data
+        yield {"threshold": 10}
+
+def run():
+    with beam.Pipeline(options=PipelineOptions()) as p:
+
+        main_input = (
+            p
+            | "CreateMainInput" >> beam.Create([1, 5, 10, 20])
+        )
+
+        side_input = (
+            p
+            | "GenerateSignal" >> beam.Create([None])

Review Comment:
   Same thing here, this should be a streaming source like 
https://github.com/apache/beam/blob/180f3a6bdb5c929c252cba3b62cf7bba800f58b0/examples/java/src/main/java/org/apache/beam/examples/snippets/Snippets.java#L888



##########
website/www/site/content/en/documentation/patterns/side-inputs.md:
##########
@@ -48,7 +48,40 @@ For instance, the following code sample uses a `Map` to 
create a `DoFn`. The `Ma
 {{< /highlight >}}
 
 {{< highlight py >}}
-No sample present.
+import apache_beam as beam

Review Comment:
   We should put this in the samples directory like
   
   
https://github.com/apache/beam/blob/180f3a6bdb5c929c252cba3b62cf7bba800f58b0/website/www/site/content/en/documentation/patterns/side-inputs.md?plain=1#L79
   
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to