Files
doris/be/src/util/uid_util.cpp
EmmyMiao87 77a1b31baa Add show load of loadv2 (#1113)
This change include the show load of loadv2 and some bug fix of loadv2.
Firstly, the show load will perform both load and loadv2 info. According to loadv2, the ETL progress of loadv2 is N/A during the period of loading.
Secondly, the loadv2 will be created when version of property is v2.
This is a temporary property which will not influence the old broker load.
After the loadv2 is finished, the default load will be changed to loadv2.
Finally, there are some bug in LoadingTaskPlanner fixed by this change.
2019-05-09 10:27:30 +08:00

63 lines
1.7 KiB
C++

// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
#include "util/uid_util.h"
namespace doris {
std::ostream& operator<<(std::ostream& os, const UniqueId& uid) {
os << uid.to_string();
return os;
}
std::string print_id(const TUniqueId& id) {
std::stringstream out;
out << std::hex << id.hi << "-" << id.lo;
return out.str();
}
std::string print_id(const PUniqueId& id) {
std::stringstream out;
out << std::hex << id.hi() << "-" << id.lo();
return out.str();
}
bool parse_id(const std::string& s, TUniqueId* id) {
DCHECK(id != NULL);
const char* hi_part = s.c_str();
char* colon = const_cast<char*>(strchr(hi_part, '-'));
if (colon == NULL) {
return false;
}
const char* lo_part = colon + 1;
*colon = '\0';
char* error_hi = NULL;
char* error_lo = NULL;
id->hi = strtoul(hi_part, &error_hi, 16);
id->lo = strtoul(lo_part, &error_lo, 16);
bool valid = *error_hi == '\0' && *error_lo == '\0';
*colon = ':';
return valid;
}
}