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 2022/09/14 13:23:58 UTC
[GitHub] [beam] yeandy commented on a diff in pull request #23224: changes for issue #21022
yeandy commented on code in PR #23224:
URL: https://github.com/apache/beam/pull/23224#discussion_r970799969
##########
website/www/site/content/en/documentation/programming-guide.md:
##########
@@ -3757,6 +3763,12 @@ Individual nested fields can be specified using the dot operator. For example, t
{{< highlight java >}}
purchases.apply(Select.fieldNames("shippingAddress.postCode"));
{{< /highlight >}}
+
+{{< highlight py >}}
+input_pc = ... # {"userId":...,"shippingAddress":"postCode": ..., ...,"bank": ..., "purchase_amount": ...}
+output_pc = input_pc | beam.Map(lambda item: beam.Row(pcode=str(item["shippingAddress.postCode"])))
Review Comment:
Please use `Select`
##########
website/www/site/content/en/documentation/programming-guide.md:
##########
@@ -3757,6 +3763,12 @@ Individual nested fields can be specified using the dot operator. For example, t
{{< highlight java >}}
purchases.apply(Select.fieldNames("shippingAddress.postCode"));
{{< /highlight >}}
+
+{{< highlight py >}}
+input_pc = ... # {"userId":...,"shippingAddress":"postCode": ..., ...,"bank": ..., "purchase_amount": ...}
Review Comment:
```suggestion
input_pc = ... # {"user_id":...,"shipping_address":"postCode": ..., ...,"bank": ..., "purchase_amount": ...}
```
##########
website/www/site/content/en/documentation/programming-guide.md:
##########
@@ -3749,6 +3749,12 @@ the user ids from a `PCollection` of purchases one would write (using the `Selec
purchases.apply(Select.fieldNames("userId"));
{{< /highlight >}}
+{{< highlight py >}}
+input_pc = ... # {"userId":...,"bank": ..., "purchase_amount": ...}
+output_pc = input_pc | beam.Map(lambda item: beam.Row(ids=str(item["userId"])))
Review Comment:
```suggestion
input_pc = ... # {"user_id":...,"bank": ..., "purchase_amount": ...}
output_pc = input_pc | beam.Select(user_id=lambda item: str(item["user_id"]))
```
##########
website/www/site/content/en/documentation/programming-guide.md:
##########
@@ -3767,6 +3779,11 @@ shipping-address fields one would write
purchases.apply(Select.fieldNames("shippingAddress.*"));
{{< /highlight >}}
+{{< highlight py >}}
+input_pc = ... # {"userId":...,"shippingAddress":"postCode": ..., ...,"bank": ..., "purchase_amount": ...}
+output_pc = input_pc | beam.Map(lambda item: beam.Row(address=str(item["shippingAddress.*"])))
Review Comment:
Please make changes as noted in the other comments.
--
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