Skip to content

Commit 5af88f8

Browse files
committed
chore(bigquery): add simple-path first-batch benchmarks to QueryBenchmark
1 parent f2302ca commit 5af88f8

1 file changed

Lines changed: 41 additions & 0 deletions

File tree

java-bigquery/benchmark/src/main/java/com.google.cloud.bigquery/QueryBenchmark.java

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
package com.google.cloud.bigquery;
1818

19+
import java.util.Iterator;
1920
import java.util.List;
2021
import java.util.concurrent.TimeUnit;
2122
import org.apache.arrow.vector.VectorSchemaRoot;
@@ -123,4 +124,44 @@ public void queryWithArrowZeroCopy(QueryParams queryParams, Blackhole blackhole)
123124
}
124125
}
125126
}
127+
128+
@Benchmark
129+
public void querySimplePath(QueryParams queryParams, Blackhole blackhole) throws Exception {
130+
TableResult result =
131+
bigquery.query(
132+
QueryJobConfiguration.newBuilder(queryParams.queries).setUseLegacySql(false).build());
133+
for (FieldValueList row : result.getValues()) {
134+
blackhole.consume(row);
135+
}
136+
}
137+
138+
@Benchmark
139+
public void queryWithArrowRowBasedSimplePath(QueryParams queryParams, Blackhole blackhole)
140+
throws Exception {
141+
QueryJobConfiguration config =
142+
QueryJobConfiguration.newBuilder(queryParams.queries)
143+
.setUseLegacySql(false)
144+
.setQueryResultsFormat(QueryResultsFormat.ARROW)
145+
.build();
146+
TableResult result = bigquery.query(config);
147+
for (FieldValueList row : result.getValues()) {
148+
blackhole.consume(row);
149+
}
150+
}
151+
152+
@Benchmark
153+
public void queryWithArrowZeroCopySimplePath(QueryParams queryParams, Blackhole blackhole)
154+
throws Exception {
155+
QueryJobConfiguration config =
156+
QueryJobConfiguration.newBuilder(queryParams.queries)
157+
.setUseLegacySql(false)
158+
.setQueryResultsFormat(QueryResultsFormat.ARROW)
159+
.build();
160+
try (ArrowQueryResult result = bigquery.queryArrow(config)) {
161+
Iterator<VectorSchemaRoot> it = result.iterator();
162+
if (it.hasNext()) {
163+
blackhole.consume(it.next());
164+
}
165+
}
166+
}
126167
}

0 commit comments

Comments
 (0)