Skip to content

[BEAM-1415] PubsubIO style guide fixes, part 1#2750

Merged
asfgit merged 8 commits intoapache:masterfrom
jkff:pubsub-style-pt1
Apr 29, 2017
Merged

[BEAM-1415] PubsubIO style guide fixes, part 1#2750
asfgit merged 8 commits intoapache:masterfrom
jkff:pubsub-style-pt1

Conversation

@jkff
Copy link
Copy Markdown
Contributor

@jkff jkff commented Apr 27, 2017

This is just renames, syntax, and AutoValue. Part 2 will be more dramatic (getting rid of Coder in both read and write).

R: @reuvenlax

@jkff jkff force-pushed the pubsub-style-pt1 branch 3 times, most recently from 48ab078 to 892feaa Compare April 27, 2017 23:35
public static <T extends Message> Read<T> readProtos(Class<T> messageClass) {
return PubsubIO.<T>read().withCoder(ProtoCoder.of(messageClass));
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add readAvros()?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

return toBuilder()
.setSubscriptionProvider(
NestedValueProvider.of(subscription, new SubscriptionTranslator()))
/* reset topic to null */
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if it's better to just fail if someone calls both fromSubscription and fromTopic, instead of current behavior of last one wins.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

return new Read<>(
name, subscription, topic, timestampLabel, coder, idLabel,
parseFn);
public Read<T> withTimestampLabel(String timestampLabel) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"label" is a remnant of the old beta PubSub API. I believe PubSub now calls these attributes instead - maybe we should rename here to be withTimestampAttribute? (and withIdAttribute)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@coveralls
Copy link
Copy Markdown

Coverage Status

Coverage decreased (-0.002%) to 69.664% when pulling 892feaa on jkff:pubsub-style-pt1 into f71395b on apache:master.

@jkff jkff force-pushed the pubsub-style-pt1 branch from 892feaa to 959f674 Compare April 28, 2017 00:40
@coveralls
Copy link
Copy Markdown

Coverage Status

Coverage increased (+0.01%) to 69.673% when pulling 959f674 on jkff:pubsub-style-pt1 into 948f7ef on apache:master.

@jkff jkff force-pushed the pubsub-style-pt1 branch from 959f674 to 7cff3e3 Compare April 28, 2017 22:12
@jkff
Copy link
Copy Markdown
Contributor Author

jkff commented Apr 28, 2017

OK, I manually confirmed (via Dataflow jobs run against a test project) that this works fine both with and without attributes.

@jkff
Copy link
Copy Markdown
Contributor Author

jkff commented Apr 29, 2017

retest this please

@coveralls
Copy link
Copy Markdown

Coverage Status

Coverage remained the same at 69.815% when pulling 8853d53 on jkff:pubsub-style-pt1 into f5e3f52 on apache:master.

}
}
if (overriddenTransform.getTimestampLabel() != null) {
if (overriddenTransform.getTimestampAttribute() != null) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please make sure doc writers know about s/label/attribute/

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup, I'll coordinate with @melap on what to do about all these style-guide-related API changes next week.

@reuvenlax
Copy link
Copy Markdown
Contributor

lgtm

@asfgit asfgit merged commit 8853d53 into apache:master Apr 29, 2017
asfgit pushed a commit that referenced this pull request Apr 29, 2017
@jkff jkff deleted the pubsub-style-pt1 branch April 29, 2017 22:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants