Skip to content

Commit

Permalink
Increase chunk size in bigquery example's file upload
Browse files Browse the repository at this point in the history
  • Loading branch information
mziccard committed Jan 21, 2016
1 parent eb11d49 commit c62a0f4
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@
*/
public class BigQueryExample {

private static final int CHUNK_SIZE = 8 * 256 * 1024;
private static final Map<String, BigQueryAction> CREATE_ACTIONS = new HashMap<>();
private static final Map<String, BigQueryAction> INFO_ACTIONS = new HashMap<>();
private static final Map<String, BigQueryAction> LIST_ACTIONS = new HashMap<>();
Expand Down Expand Up @@ -677,10 +678,10 @@ void run(BigQuery bigquery, Tuple<LoadConfiguration, String> configuration) thro
try (FileChannel fileChannel = FileChannel.open(Paths.get(configuration.y()))) {
WriteChannel writeChannel = bigquery.writer(configuration.x());
long position = 0;
long written = fileChannel.transferTo(position, 256 * 1024, writeChannel);
long written = fileChannel.transferTo(position, CHUNK_SIZE, writeChannel);
while (written > 0) {
position += written;
written = fileChannel.transferTo(position, 256 * 1024, writeChannel);
written = fileChannel.transferTo(position, CHUNK_SIZE, writeChannel);
}
writeChannel.close();
}
Expand Down

0 comments on commit c62a0f4

Please sign in to comment.