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

[BEAM-1542] Support ValueProviders in SpannerIO #3358

Closed
wants to merge 4 commits into from

Conversation

mairbek
Copy link
Contributor

@mairbek mairbek commented Jun 14, 2017

No description provided.

@mairbek
Copy link
Contributor Author

mairbek commented Jun 14, 2017

R: @jkff

@coveralls
Copy link

Coverage Status

Coverage remained the same at 70.681% when pulling e24f158 on mairbek:providers into dd9abc3 on apache:master.

Copy link
Contributor

@jkff jkff left a comment

Choose a reason for hiding this comment

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

Thanks, do you also plan to add DisplayData support? (outside the scope of this PR of course)


abstract long getBatchSizeBytes();
@Nullable
abstract ValueProvider<Long> getBatchSizeBytes();
Copy link
Contributor

Choose a reason for hiding this comment

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

Speaking of... Do you expect users to have to configure this in practice? Can SpannerIO choose a reasonable value and shield users from the temptation of "optimizing" it (which might fall out of date as Spanner implementation changes, or might be simply chosen misguidedly)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The default value of 1 MB is the optimal one. It is possible to disable batching by setting this to 0, so I think we should keep this.

Copy link
Contributor

Choose a reason for hiding this comment

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

Okay, though consider making this a simpler-to-use builder method .withoutBatching().

Also: do you expect people to actually configure this via a ValueProvider? (I don't think we have guidelines on what builder methods should have a ValueProvider overload, but if we had such a guideline, it probably wouldn't be "all of them")

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Got it. I don't think batch size would be something that we let people configure in templates. Removed the ValueProvider.

@mairbek
Copy link
Contributor Author

mairbek commented Jun 15, 2017

We populate the display data, SpannerIO.java#L248.

As long as ValueProvider implements toString it should work fine.

@jkff
Copy link
Contributor

jkff commented Jun 15, 2017

Thanks, for display data, can you add a unit test and verify that it's formatted as expected? I think other IO connectors do a bit more to format ValueProvider's into DisplayData.

@mairbek
Copy link
Contributor Author

mairbek commented Jun 19, 2017

Added display data test.

@jkff
Copy link
Contributor

jkff commented Jun 19, 2017

retest this please

@coveralls
Copy link

Coverage Status

Coverage increased (+0.02%) to 70.698% when pulling 0dfa4ce on mairbek:providers into dd9abc3 on apache:master.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.01%) to 70.691% when pulling 45d0695 on mairbek:providers into dd9abc3 on apache:master.

@asfgit asfgit closed this in 10e4764 Jun 20, 2017
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.

None yet

3 participants