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

Method GetResultSetMetadata

be/src/service/impala-hs2-server.cc:1012–1056  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1010}
1011
1012void ImpalaServer::GetResultSetMetadata(TGetResultSetMetadataResp& return_val,
1013 const TGetResultSetMetadataReq& request) {
1014 // Convert Operation id to TUniqueId and get the query exec state.
1015 TUniqueId query_id;
1016 TUniqueId op_secret;
1017 HS2_RETURN_IF_ERROR(return_val, THandleIdentifierToTUniqueId(
1018 request.operationHandle.operationId, &query_id, &op_secret),
1019 SQLSTATE_GENERAL_ERROR);
1020 VLOG_QUERY << "GetResultSetMetadata(): query_id=" << PrintId(query_id);
1021
1022 // Make query id available to the following HS2_RETURN_IF_ERROR().
1023 ScopedThreadContext scoped_tdi(GetThreadDebugInfo(), query_id);
1024
1025 QueryHandle query_handle;
1026 HS2_RETURN_IF_ERROR(
1027 return_val, GetActiveQueryHandle(query_id, &query_handle), SQLSTATE_GENERAL_ERROR);
1028
1029 ScopedSessionState session_handle(this);
1030 const TUniqueId session_id = query_handle->session_id();
1031 HS2_RETURN_IF_ERROR(return_val,
1032 session_handle.WithSession(session_id, SecretArg::Operation(op_secret, query_id)),
1033 SQLSTATE_GENERAL_ERROR);
1034 {
1035 lock_guard<mutex> l(*query_handle->lock());
1036
1037 // Convert TResultSetMetadata to TGetResultSetMetadataResp
1038 const TResultSetMetadata* result_set_md = query_handle->result_metadata();
1039 DCHECK(result_set_md != NULL);
1040 if (result_set_md->columns.size() > 0) {
1041 return_val.__isset.schema = true;
1042 return_val.schema.columns.resize(result_set_md->columns.size());
1043 for (int i = 0; i < result_set_md->columns.size(); ++i) {
1044 return_val.schema.columns[i].__set_columnName(
1045 result_set_md->columns[i].columnName);
1046 return_val.schema.columns[i].position = i;
1047 return_val.schema.columns[i].typeDesc.types.resize(1);
1048 return_val.schema.columns[i].typeDesc.types[0] =
1049 ColumnToHs2Type(result_set_md->columns[i].columnType);
1050 }
1051 }
1052 }
1053
1054 return_val.status.__set_statusCode(thrift::TStatusCode::SUCCESS_STATUS);
1055 VLOG_QUERY << "GetResultSetMetadata(): return_val=" << ThriftDebugString(return_val);
1056}
1057
1058void ImpalaServer::FetchResults(TFetchResultsResp& return_val,
1059 const TFetchResultsReq& request) {

Callers 5

test_select_nullMethod · 0.45
test_invalid_secretMethod · 0.45
result_metadataMethod · 0.45
ExecAndFetchMethod · 0.45

Calls 10

PrintIdFunction · 0.85
GetThreadDebugInfoFunction · 0.85
OperationEnum · 0.85
ThriftDebugStringFunction · 0.85
session_idMethod · 0.80
WithSessionMethod · 0.80
resizeMethod · 0.80
lockMethod · 0.45
result_metadataMethod · 0.45
sizeMethod · 0.45

Tested by 4

test_select_nullMethod · 0.36
test_invalid_secretMethod · 0.36
result_metadataMethod · 0.36