Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -116,16 +116,17 @@
* {@code
* PCollection<Page> pages = ... // pages fit into memory
* PCollection<UrlVisit> urlVisits = ... // very large collection
* final PCollectionView<Map<URL, Page>> = urlToPage
* final PCollectionView<Map<URL, Page>> urlToPageView = pages
* .apply(WithKeys.of( ... )) // extract the URL from the page
* .apply(View.<URL, Page>asMap());
*
* PCollection PageVisits = urlVisits
* .apply(ParDo.withSideInputs(urlToPage)
* .apply(ParDo.withSideInputs(urlToPageView)
* .of(new DoFn<UrlVisit, PageVisit>() {
* {@literal @}Override
* void processElement(ProcessContext context) {
* UrlVisit urlVisit = context.element();
* Map<URL, Page> urlToPage = context.sideInput(urlToPageView);
* Page page = urlToPage.get(urlVisit.getUrl());
* c.output(new PageVisit(page, urlVisit.getVisitData()));
* }
Expand Down