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

Method ParseQueryOptions

be/src/service/query-options.cc:1484–1520  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1482}
1483
1484Status impala::ParseQueryOptions(const string& options, TQueryOptions* query_options,
1485 QueryOptionsMask* set_query_options_mask) {
1486 if (options.length() == 0) return Status::OK();
1487 vector<string> kv_pairs;
1488 int double_quote_ct = 0;
1489 int begin = 0;
1490 int end = 0;
1491 while (end < options.length()) {
1492 if (options.at(end) == '"') {
1493 double_quote_ct = (double_quote_ct + 1) % 2;
1494 } else if (options.at(end) == ',' && double_quote_ct == 0) {
1495 // Found comma that is not within two double quotes. This is an option separator.
1496 if (begin < end) kv_pairs.push_back(options.substr(begin, end - begin));
1497 begin = end + 1;
1498 }
1499 end++;
1500 }
1501 if (begin < end) kv_pairs.push_back(options.substr(begin, end - begin));
1502 // Construct an error status which is used to aggregate errors encountered during
1503 // parsing. It is only returned if the number of error details is greater than 0.
1504 Status errorStatus = Status::Expected("Errors parsing query options");
1505 for (string& kv_string : kv_pairs) {
1506 trim(kv_string);
1507 if (kv_string.length() == 0) continue;
1508 vector<string> key_value;
1509 split(key_value, kv_string, is_any_of("="), token_compress_on);
1510 if (key_value.size() != 2) {
1511 errorStatus.MergeStatus(
1512 Status(Substitute("Invalid configuration option '$0'.", kv_string)));
1513 continue;
1514 }
1515 errorStatus.MergeStatus(SetQueryOption(
1516 key_value[0], key_value[1], query_options, set_query_options_mask));
1517 }
1518 if (errorStatus.msg().details().size() > 0) return errorStatus;
1519 return Status::OK();
1520}
1521
1522Status impala::ValidateQueryOptions(TQueryOptions* query_options) {
1523 // Validate that max_result_spooling_mem <=

Callers

nothing calls this directly

Calls 8

OKFunction · 0.85
SubstituteFunction · 0.85
push_backMethod · 0.80
substrMethod · 0.80
MergeStatusMethod · 0.80
StatusClass · 0.50
lengthMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected