smeet07 commented on code in PR #23224:
URL: https://github.com/apache/beam/pull/23224#discussion_r984995002
##########
website/www/site/content/en/documentation/programming-guide.md:
##########
@@ -4061,6 +4203,18 @@ purchases.apply(Group.byFieldNames("userId")
.aggregateField("costCents", Top.<Long>largestLongsFn(10),
"topPurchases"));
{{< /highlight >}}
+{{< highlight python >}}
+input_pc = ... # {"user_id": ...,"item_Id": ..., "cost_cents": ...}
+output_pc = input_pc | beam.GroupBy("user_id")
+ .aggregate_field("item_id",count,"num_purchases")
+ .aggregate_field("cost_cents",sum,"total_spendcents")
Review Comment:
So I can't use count directly? (other than defining the count function)
are there any other aggregate functions that can be used which need not be
defined? I guess we can use max/min here
--
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]