You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@beam.apache.org by GitBox <gi...@apache.org> on 2021/08/09 14:28:02 UTC

[GitHub] [beam] chamikaramj commented on a change in pull request #15269: [BEAM-12716] Update XLang Kafka taxi example to use BigQuery sink

chamikaramj commented on a change in pull request #15269:
URL: https://github.com/apache/beam/pull/15269#discussion_r685240066



##########
File path: sdks/python/apache_beam/examples/kafkataxi/kafka_taxi.py
##########
@@ -43,34 +52,43 @@ def run(bootstrap_servers, topic, with_metadata, pipeline_args):
   #                  '--num_workers', 'my-num-workers',
   #                  '--experiments', 'use_runner_v2']
 
-  pipeline_options = PipelineOptions(
-      pipeline_args, save_main_session=True, streaming=True)
   window_size = 15  # size of the Window in seconds.
 
-  def log_ride_with_metadata(record):
+  def log_ride(ride):
+    if 'timestamp' in ride:
+      logging.info(
+          'Found ride at latitude %r and longitude %r with %r '
+          'passengers at timestamp %r',
+          ride['latitude'],
+          ride['longitude'],
+          ride['passenger_count'],
+          ride['timestamp'])
+    else:
+      logging.info(
+          'Found ride at latitude %r and longitude %r with %r '
+          'passengers',
+          ride['latitude'],
+          ride['longitude'],
+          ride['passenger_count'])
+
+  def convert_kafka_record_to_dictionary(record):
+    if hasattr(record, 'value'):

Review comment:
       Let's add a comment here to clarify. ("if" condition becomes true when reading with metadata).




-- 
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: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org