Skip to content
Permalink
Browse files
docs(samples): update querypagination sample (#1209)
Based on feedback from a support case, I've made some changes to make this more clear and more accurate to what the comments indicate

Created #1207 to track this

Fixes #1207 ☕️
  • Loading branch information
ShyamShah11 committed Mar 31, 2021
1 parent 2918a5b commit 9b4f3ecc248fd6fac2b9542b14d6f343bcb8463c
Showing with 11 additions and 3 deletions.
  1. +11 −3 samples/snippets/src/main/java/com/example/bigquery/QueryPagination.java
@@ -59,15 +59,23 @@ public static void queryPagination(String datasetName, String tableName, String

// First Page
results
.iterateAll()
.forEach(row -> row.forEach(val -> System.out.printf("%s,", val.toString())));
.getValues()
.forEach(row -> row.forEach(val -> System.out.printf("%s,\n", val.toString())));

if (results.hasNextPage()) {
// Next Page
results
.getNextPage()
.getValues()
.forEach(row -> row.forEach(val -> System.out.printf("%s,\n", val.toString())));
}

if (results.hasNextPage()) {
// Remaining Pages
results
.getNextPage()
.iterateAll()
.forEach(row -> row.forEach(val -> System.out.printf("%s,", val.toString())));
.forEach(row -> row.forEach(val -> System.out.printf("%s,\n", val.toString())));
}

System.out.println("Query pagination performed successfully.");

0 comments on commit 9b4f3ec

Please sign in to comment.