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

Method QueryToTQueryContext

be/src/service/impala-beeswax-server.cc:563–609  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

561}
562
563Status ImpalaServer::QueryToTQueryContext(const Query& query,
564 TQueryCtx* query_ctx) {
565 query_ctx->client_request.stmt = query.query;
566 VLOG_QUERY << "query: " << ThriftDebugString(query);
567 QueryOptionsMask set_query_options_mask;
568 {
569 shared_ptr<SessionState> session;
570 const TUniqueId& session_id = ThriftServer::GetThreadConnectionId();
571 // OK to skip secret validation since 'session_id' comes from connection
572 // and is trusted.
573 RETURN_IF_ERROR(GetSessionState(session_id, SecretArg::SkipSecretCheck(), &session,
574 /* mark_active= */ false));
575 DCHECK(session != nullptr);
576 {
577 // The session is created when the client connects. Depending on the underlying
578 // transport, the username may be known at that time. If the username hasn't been
579 // set yet, set it now.
580 lock_guard<mutex> l(session->lock);
581 if (session->connected_user.empty()) {
582 session->connected_user = query.hadoop_user.empty() ?
583 FLAGS_anonymous_user_name : query.hadoop_user;
584 }
585 query_ctx->client_request.query_options = session->QueryOptions();
586 set_query_options_mask = session->set_query_options_mask;
587 }
588 session->ToThrift(session_id, &query_ctx->session);
589 }
590
591 // Override default query options with Query.Configuration
592 if (query.__isset.configuration) {
593 TQueryOptions overlay;
594 QueryOptionsMask overlay_mask;
595 for (const string& option: query.configuration) {
596 RETURN_IF_ERROR(ParseQueryOptions(option, &overlay, &overlay_mask));
597 }
598 OverlayQueryOptions(overlay, overlay_mask, &query_ctx->client_request.query_options);
599 RETURN_IF_ERROR(ValidateQueryOptions(&overlay));
600 set_query_options_mask |= overlay_mask;
601 }
602
603 // Only query options not set in the session or confOverlay can be overridden by the
604 // pool options.
605 AddPoolConfiguration(query_ctx, ~set_query_options_mask);
606 VLOG_QUERY << "TClientRequest.queryOptions: "
607 << DebugQueryOptions(query_ctx->client_request.query_options);
608 return Status::OK();
609}
610
611inline void ImpalaServer::TUniqueIdToBeeswaxHandle(
612 const TUniqueId& query_id, beeswax::QueryHandle* beeswax_handle) {

Callers

nothing calls this directly

Calls 5

ThriftDebugStringFunction · 0.85
OKFunction · 0.85
QueryOptionsMethod · 0.80
emptyMethod · 0.45
ToThriftMethod · 0.45

Tested by

no test coverage detected