Skip to content

Commit 6cc6b6d

Browse files
committed
test(bigquery): manage BigIntVector with try-with-resources in BigQueryImplTest
1 parent 262a096 commit 6cc6b6d

1 file changed

Lines changed: 4 additions & 8 deletions

File tree

‎java-bigquery/google-cloud-bigquery/src/test/java/com/google/cloud/bigquery/BigQueryImplTest.java‎

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3023,8 +3023,8 @@ void testQueryWithArrowFormatMultiplePages() throws IOException, InterruptedExce
30233023

30243024
// Prepare page 2 Arrow batch for streaming
30253025
byte[] page2BatchBytes;
3026-
try (BufferAllocator allocator = new RootAllocator(Long.MAX_VALUE)) {
3027-
BigIntVector idVector = new BigIntVector("id", allocator);
3026+
try (BufferAllocator allocator = new RootAllocator(Long.MAX_VALUE);
3027+
BigIntVector idVector = new BigIntVector("id", allocator)) {
30283028
idVector.allocateNew(1);
30293029
idVector.set(0, 2L);
30303030
idVector.setValueCount(1);
@@ -3036,8 +3036,6 @@ void testQueryWithArrowFormatMultiplePages() throws IOException, InterruptedExce
30363036
MessageSerializer.serialize(channel, recordBatch);
30373037
page2BatchBytes = out.toByteArray();
30383038
}
3039-
} finally {
3040-
idVector.close();
30413039
}
30423040
}
30433041

@@ -3116,8 +3114,8 @@ void testQueryWithArrowFormatMultiplePagesWithMaxResults()
31163114

31173115
// Prepare page 2 Arrow batch for streaming with 2 rows
31183116
byte[] page2BatchBytes;
3119-
try (BufferAllocator allocator = new RootAllocator(Long.MAX_VALUE)) {
3120-
BigIntVector idVector = new BigIntVector("id", allocator);
3117+
try (BufferAllocator allocator = new RootAllocator(Long.MAX_VALUE);
3118+
BigIntVector idVector = new BigIntVector("id", allocator)) {
31213119
idVector.allocateNew(2);
31223120
idVector.set(0, 2L);
31233121
idVector.set(1, 3L);
@@ -3130,8 +3128,6 @@ void testQueryWithArrowFormatMultiplePagesWithMaxResults()
31303128
MessageSerializer.serialize(channel, recordBatch);
31313129
page2BatchBytes = out.toByteArray();
31323130
}
3133-
} finally {
3134-
idVector.close();
31353131
}
31363132
}
31373133

0 commit comments

Comments
 (0)