MCPcopy Create free account
hub / github.com/apache/impala / FetchAllRowsHS2

Method FetchAllRowsHS2

be/src/service/internal-server.cc:224–273  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

222} // ImpalaServer::SubmitQuery
223
224Status ImpalaServer::FetchAllRowsHS2(const TUniqueId& query_id,
225 vector<TRow>& query_results, results_columns* columns) {
226 const TResultSetMetadata* results_metadata;
227
228 QueryHandle query_handle;
229 RETURN_IF_ERROR(GetActiveQueryHandle(query_id, &query_handle));
230
231 {
232 lock_guard<mutex> l1(*query_handle->fetch_rows_lock());
233 lock_guard<mutex> l2(*query_handle->lock());
234
235 if (query_handle->num_rows_fetched() == 0) {
236 query_handle->set_fetched_rows();
237 }
238
239 results_metadata = query_handle->result_metadata();
240
241 // populate column vector if provided by the user
242 if (columns != nullptr) {
243 for (int i = 0; i < results_metadata->columns.size(); i++) {
244 // TODO: As of today, the ODBC driver does not support boolean and timestamp data
245 // type but it should. This is tracked by ODBC-189. We should verify that our
246 // boolean and timestamp type are correctly recognized when ODBC-189 is closed.
247 // TODO: Handle complex types.
248 const TColumnType& type = results_metadata->columns[i].columnType;
249 columns->emplace_back(make_pair(results_metadata->columns[i].columnName,
250 ColumnTypeToBeeswaxTypeString(type)));
251 }
252 }
253 }
254
255 int64_t block_wait_time = 30000000;
256 while (!query_handle->eos()) {
257 lock_guard<mutex> l1(*query_handle->fetch_rows_lock());
258 lock_guard<mutex> l2(*query_handle->lock());
259
260 QueryResultSet* result_set;
261 TRowSet row_set;
262
263 result_set = QueryResultSet::CreateHS2ResultSet(
264 TProtocolVersion::HIVE_CLI_SERVICE_PROTOCOL_V1, *results_metadata, &row_set,
265 false, 0);
266
267 RETURN_IF_ERROR(query_handle->FetchRows(ROWS_TO_FETCH, result_set, block_wait_time));
268 query_results.insert(query_results.cend(), row_set.rows.cbegin(),
269 row_set.rows.cend());
270 }
271
272 return Status::OK();
273} // ImpalaServer::FetchAllRowsHS2
274
275void ImpalaServer::CloseQuery(const TUniqueId& query_id) {
276 QueryHandle query_handle;

Callers 1

TESTFunction · 0.80

Calls 12

OKFunction · 0.85
fetch_rows_lockMethod · 0.80
num_rows_fetchedMethod · 0.80
set_fetched_rowsMethod · 0.80
FetchRowsMethod · 0.80
cendMethod · 0.80
cbeginMethod · 0.80
lockMethod · 0.45
result_metadataMethod · 0.45
sizeMethod · 0.45
eosMethod · 0.45
insertMethod · 0.45

Tested by 1

TESTFunction · 0.64