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

Method GetQueryOptions

be/src/service/query-profile-parsing-tools.cc:693–733  ·  view source on GitHub ↗

Parses query options into a normalized key/value object.

Source from the content-addressed store, hash-verified

691
692// Parses query options into a normalized key/value object.
693Value QueryProfileToolAccessor::GetQueryOptions(Document::AllocatorType& alloc) const {
694 Value obj(rapidjson::kObjectType);
695 const Value* summary = GetSummaryPtr();
696 if (summary == nullptr) return obj;
697 static const vector<const char*> option_keys = {
698 "Query Options (set by configuration)",
699 "Query Options (set by configuration and planner)"};
700 for (const auto* option_key : option_keys) {
701 if (!summary->HasMember(option_key) || !(*summary)[option_key].IsString()) continue;
702 const Value& options_value = (*summary)[option_key];
703 const string_view options(
704 options_value.GetString(), options_value.GetStringLength());
705 size_t item_start = 0;
706 while (item_start < options.size()) {
707 const size_t comma = options.find(',', item_start);
708 const size_t item_end = comma == string_view::npos ? options.size() : comma;
709 string_view option = options.substr(item_start, item_end - item_start);
710 item_start = comma == string_view::npos ? options.size() : comma + 1;
711 if (option.empty()) continue;
712
713 const size_t eq = option.find('=');
714 if (eq == string_view::npos) continue;
715 const string_view key = TrimWhiteSpace(option.substr(0, eq));
716 const string_view value = TrimWhiteSpace(option.substr(eq + 1));
717 if (key.empty()) continue;
718
719 Value key_json(rapidjson::kStringType);
720 key_json.SetString(
721 key.data(), static_cast<rapidjson::SizeType>(key.size()), alloc);
722 if (obj.HasMember(key_json)) {
723 obj[key_json].SetString(
724 value.data(), static_cast<rapidjson::SizeType>(value.size()), alloc);
725 } else {
726 obj.AddMember(
727 MakeJsonString(key, alloc),
728 MakeJsonString(value, alloc), alloc);
729 }
730 }
731 }
732 return obj;
733}
734
735// Returns the list of queried tables from Summary metadata.
736Value QueryProfileToolAccessor::GetTablesQueried(Document::AllocatorType& alloc) const {

Callers 2

WaitOnQueuedMethod · 0.80
ExecuteToolFunction · 0.80

Calls 9

TrimWhiteSpaceFunction · 0.85
MakeJsonStringFunction · 0.85
substrMethod · 0.80
GetStringMethod · 0.45
sizeMethod · 0.45
findMethod · 0.45
emptyMethod · 0.45
dataMethod · 0.45
AddMemberMethod · 0.45

Tested by

no test coverage detected