Skip to content

Commit 7fa9f77

Browse files
committed
chore: Use long for expectedRowCount
1 parent 66f7fcb commit 7fa9f77

File tree

4 files changed

+15
-16
lines changed

4 files changed

+15
-16
lines changed

samples/snippets/src/main/java/com/example/bigquerystorage/ExportOpenTelemetry.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,11 +105,11 @@ public static void exportToOpenTelemetry(String projectId, String datasetName, S
105105

106106
// Final cleanup for the stream during worker teardown.
107107
writer.cleanup();
108-
verifyExpectedRowCount(parentTable, 12);
108+
verifyExpectedRowCount(parentTable, 12L);
109109
System.out.println("Appended records successfully.");
110110
}
111111

112-
private static void verifyExpectedRowCount(TableName parentTable, int expectedRowCount)
112+
private static void verifyExpectedRowCount(TableName parentTable, long expectedRowCount)
113113
throws InterruptedException {
114114
String queryRowCount =
115115
"SELECT COUNT(*) FROM `"
@@ -122,8 +122,8 @@ private static void verifyExpectedRowCount(TableName parentTable, int expectedRo
122122
QueryJobConfiguration queryConfig = QueryJobConfiguration.newBuilder(queryRowCount).build();
123123
BigQuery bigquery = BigQueryOptions.getDefaultInstance().getService();
124124
TableResult results = bigquery.query(queryConfig);
125-
int countRowsActual =
126-
Integer.parseInt(results.getValues().iterator().next().get("f0_").getStringValue());
125+
long countRowsActual =
126+
Long.parseLong(results.getValues().iterator().next().get("f0_").getStringValue());
127127
if (countRowsActual != expectedRowCount) {
128128
throw new RuntimeException(
129129
"Unexpected row count. Expected: " + expectedRowCount + ". Actual: " + countRowsActual);

samples/snippets/src/main/java/com/example/bigquerystorage/WriteToDefaultStream.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -106,11 +106,11 @@ public static void writeToDefaultStream(String projectId, String datasetName, St
106106

107107
// Final cleanup for the stream during worker teardown.
108108
writer.cleanup();
109-
verifyExpectedRowCount(parentTable, 12);
109+
verifyExpectedRowCount(parentTable, 12L);
110110
System.out.println("Appended records successfully.");
111111
}
112112

113-
private static void verifyExpectedRowCount(TableName parentTable, int expectedRowCount)
113+
private static void verifyExpectedRowCount(TableName parentTable, long expectedRowCount)
114114
throws InterruptedException {
115115
String queryRowCount =
116116
"SELECT COUNT(*) FROM `"
@@ -123,8 +123,8 @@ private static void verifyExpectedRowCount(TableName parentTable, int expectedRo
123123
QueryJobConfiguration queryConfig = QueryJobConfiguration.newBuilder(queryRowCount).build();
124124
BigQuery bigquery = BigQueryOptions.getDefaultInstance().getService();
125125
TableResult results = bigquery.query(queryConfig);
126-
int countRowsActual =
127-
Integer.parseInt(results.getValues().iterator().next().get("f0_").getStringValue());
126+
long countRowsActual =
127+
Long.parseLong(results.getValues().iterator().next().get("f0_").getStringValue());
128128
if (countRowsActual != expectedRowCount) {
129129
throw new RuntimeException(
130130
"Unexpected row count. Expected: " + expectedRowCount + ". Actual: " + countRowsActual);

samples/snippets/src/main/java/com/example/bigquerystorage/WriteToDefaultStreamTimestampJson.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,11 +88,11 @@ public static void writeToDefaultStream(String projectId, String datasetName, St
8888

8989
// Final cleanup for the stream during worker teardown.
9090
writer.cleanup();
91-
verifyExpectedRowCount(parentTable, 20);
91+
verifyExpectedRowCount(parentTable, 20L);
9292
System.out.println("Appended records successfully.");
9393
}
9494

95-
private static void verifyExpectedRowCount(TableName parentTable, int expectedRowCount)
95+
private static void verifyExpectedRowCount(TableName parentTable, long expectedRowCount)
9696
throws InterruptedException {
9797
String queryRowCount =
9898
"SELECT COUNT(*) FROM `"
@@ -105,8 +105,8 @@ private static void verifyExpectedRowCount(TableName parentTable, int expectedRo
105105
QueryJobConfiguration queryConfig = QueryJobConfiguration.newBuilder(queryRowCount).build();
106106
BigQuery bigquery = BigQueryOptions.getDefaultInstance().getService();
107107
TableResult results = bigquery.query(queryConfig);
108-
int countRowsActual =
109-
Integer.parseInt(results.getValues().iterator().next().get("f0_").getStringValue());
108+
long countRowsActual =
109+
Long.parseLong(results.getValues().iterator().next().get("f0_").getStringValue());
110110
if (countRowsActual != expectedRowCount) {
111111
throw new RuntimeException(
112112
"Unexpected row count. Expected: " + expectedRowCount + ". Actual: " + countRowsActual);

samples/snippets/src/main/java/com/example/bigquerystorage/WriteToDefaultStreamWithArrow.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -180,8 +180,8 @@ private static void verifyExpectedRowCount(TableName parentTable, long expectedR
180180
BigQuery bigquery =
181181
BigQueryOptions.newBuilder().setProjectId(parentTable.getProject()).build().getService();
182182
TableResult results = bigquery.query(queryConfig);
183-
int countRowsActual =
184-
Integer.parseInt(results.getValues().iterator().next().get("f0_").getStringValue());
183+
long countRowsActual =
184+
Long.parseLong(results.getValues().iterator().next().get("f0_").getStringValue());
185185
if (countRowsActual != expectedRowCount) {
186186
throw new RuntimeException(
187187
"Unexpected row count. Expected: " + expectedRowCount + ". Actual: " + countRowsActual);
@@ -216,8 +216,7 @@ private static class DataWriter {
216216

217217
private final AtomicInteger recreateCount = new AtomicInteger(0);
218218

219-
private StreamWriter createStreamWriter(String streamName, Schema arrowSchema)
220-
throws DescriptorValidationException, IOException, InterruptedException {
219+
private StreamWriter createStreamWriter(String streamName, Schema arrowSchema) throws IOException {
221220
// Configure in-stream automatic retry settings.
222221
// Error codes that are immediately retried:
223222
// * ABORTED, UNAVAILABLE, CANCELLED, INTERNAL, DEADLINE_EXCEEDED

0 commit comments

Comments
 (0)