Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update KeysExample #31027

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,12 @@ public static void main(String[] args) {
PCollection<KV<String, Integer>> pairs =
pipeline.apply(
Create.of(KV.of("one", 1), KV.of("two", 2), KV.of("three", 3), KV.of("four", 4)));
// Returns only the values of the collection: PCollection<KV<K,V>> ->
// Returns only the keys of the collection: PCollection<KV<K,V>> ->
// PCollection<V>
PCollection<String> valuesOnly = pairs.apply(Keys.create());
PCollection<String> keysOnly = pairs.apply(Keys.create());
// [END main_section]
pairs.apply(ParDo.of(new LogOutput<>("PCollection element before Values.create transform: ")));
valuesOnly.apply(
keysOnly.apply(
ParDo.of(new LogOutput<>("PCollection element after Values.create transform: ")));
pipeline.run();
}
Expand Down