diff --git a/gcloud-java-examples/src/main/java/com/google/gcloud/examples/BigQueryExample.java b/gcloud-java-examples/src/main/java/com/google/gcloud/examples/BigQueryExample.java index 773d99ffe30d..895502e3d6d5 100644 --- a/gcloud-java-examples/src/main/java/com/google/gcloud/examples/BigQueryExample.java +++ b/gcloud-java-examples/src/main/java/com/google/gcloud/examples/BigQueryExample.java @@ -98,6 +98,7 @@ */ public class BigQueryExample { + private static final int CHUNK_SIZE = 8 * 256 * 1024; private static final Map CREATE_ACTIONS = new HashMap<>(); private static final Map INFO_ACTIONS = new HashMap<>(); private static final Map LIST_ACTIONS = new HashMap<>(); @@ -677,10 +678,10 @@ void run(BigQuery bigquery, Tuple 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(); }