|
16 | 16 |
|
17 | 17 | package com.google.cloud.bigquery; |
18 | 18 |
|
| 19 | +import java.util.Iterator; |
19 | 20 | import java.util.List; |
20 | 21 | import java.util.concurrent.TimeUnit; |
21 | 22 | import org.apache.arrow.vector.VectorSchemaRoot; |
@@ -123,4 +124,44 @@ public void queryWithArrowZeroCopy(QueryParams queryParams, Blackhole blackhole) |
123 | 124 | } |
124 | 125 | } |
125 | 126 | } |
| 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 | + } |
126 | 167 | } |
0 commit comments