Skip to content

[BEAM-2532] add a Serializable TableSchema Supplier in BigQuerySourceBase#3584

Closed
nevillelyh wants to merge 2 commits intoapache:masterfrom
nevillelyh:neville/BEAM-2532
Closed

[BEAM-2532] add a Serializable TableSchema Supplier in BigQuerySourceBase#3584
nevillelyh wants to merge 2 commits intoapache:masterfrom
nevillelyh:neville/BEAM-2532

Conversation

@nevillelyh
Copy link
Contributor

@nevillelyh nevillelyh commented Jul 18, 2017

Verified that with the fix, loading a 35GB BigQuery table with 10 n1-standard-1 workers is 4x faster than without (~10min vs 40min).

@reuvenlax
Copy link
Contributor

I suspect you'll have to add a FindBugs exception. See

<Class name="org.apache.beam.sdk.coders.AvroCoder$SerializableSchemaSupplier"/>
for an example.

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!


SerializableFunction<GenericRecord, TableRow> function =
new SerializableFunction<GenericRecord, TableRow>() {
private Supplier<TableSchema> schema = new SerializableTableSchemaSupplier(
Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm, can this be simplified by making this a Suppliers.memoize(Suppliers.compose(BigQueryHelpers::fromJsonString, Suppliers.ofInstance(jsonSchema))) ? (except the lambda has to be Java 7)

using methods from http://google.github.io/guava/releases/22.0/api/docs/com/google/common/base/Suppliers.html

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@jkff
Copy link
Contributor

jkff commented Jul 18, 2017

R: @jkff

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! I'm gonna fix the checkstyle issue and merge.

@asfgit asfgit closed this in 7fde976 Jul 19, 2017
@nevillelyh nevillelyh deleted the neville/BEAM-2532 branch July 22, 2017 06:54
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.

3 participants