This is an automated email from the ASF dual-hosted git repository.
zclll pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/master by this push:
new d9f3044ecfa [fix] remove parse_id (#57240)
d9f3044ecfa is described below
commit d9f3044ecfa8fcf5326aed75be369cd0858b1f5b
Author: admiring_xm <[email protected]>
AuthorDate: Sun Oct 26 17:16:08 2025 +0800
[fix] remove parse_id (#57240)
Related PR: #55057
Problem Summary:
Remove `parse_id`, as this method modifies the string. When using the
same string, a second call to this method will fail.
Following testing, from_hex and parse_id demonstrate identical
behaviour.
```c++
parse_id(abcd-1234) = (from_hex(abcd), from_hex(1234)) = (0xabcd, 0x1234)
parse_id(0123456789abcdef-0123456789abcdef) = (from_hex(0123456789abcdef),
from_hex(0123456789abcdef)) = (0x0123456789abcdef, 0x0123456789abcdef)
```
---
be/src/service/arrow_flight/flight_sql_service.cpp | 8 +++++++-
be/src/util/uid_util.cpp | 23 ----------------------
be/src/util/uid_util.h | 5 -----
3 files changed, 7 insertions(+), 29 deletions(-)
diff --git a/be/src/service/arrow_flight/flight_sql_service.cpp
b/be/src/service/arrow_flight/flight_sql_service.cpp
index f9f6cbf56ff..1c83b7b9954 100644
--- a/be/src/service/arrow_flight/flight_sql_service.cpp
+++ b/be/src/service/arrow_flight/flight_sql_service.cpp
@@ -49,8 +49,14 @@ private:
return arrow::Status::Invalid(fmt::format("Malformed ticket, size:
{}", fields.size()));
}
+ std::vector<std::string> str = absl::StrSplit(fields[0], "-");
+ if (str.size() != 2) {
+ return arrow::Status::Invalid("Malformed ticket, missing query id:
{}", fields[0]);
+ }
+
TUniqueId queryid;
- parse_id(fields[0], &queryid);
+ from_hex(&queryid.hi, str[0]);
+ from_hex(&queryid.lo, str[1]);
TNetworkAddress result_addr;
result_addr.hostname = fields[1];
result_addr.port = std::stoi(fields[2]);
diff --git a/be/src/util/uid_util.cpp b/be/src/util/uid_util.cpp
index 4c947e017b8..17a621f35ac 100644
--- a/be/src/util/uid_util.cpp
+++ b/be/src/util/uid_util.cpp
@@ -59,29 +59,6 @@ std::string print_id(const PUniqueId& id) {
static_cast<uint64_t>(id.lo()));
}
-bool parse_id(const std::string& s, TUniqueId* id) {
- DCHECK(id != nullptr);
-
- const char* hi_part = s.c_str();
- char* colon = const_cast<char*>(strchr(hi_part, '-'));
-
- if (colon == nullptr) {
- return false;
- }
-
- const char* lo_part = colon + 1;
- *colon = '\0';
-
- char* error_hi = nullptr;
- char* error_lo = nullptr;
- 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;
-}
-
bool TUniqueId::operator<(const TUniqueId& rhs) const {
if (hi < rhs.hi) {
return true;
diff --git a/be/src/util/uid_util.h b/be/src/util/uid_util.h
index 7f300c561b0..5da4b6a9db9 100644
--- a/be/src/util/uid_util.h
+++ b/be/src/util/uid_util.h
@@ -172,11 +172,6 @@ std::string print_id(const UniqueId& id);
std::string print_id(const TUniqueId& id);
std::string print_id(const PUniqueId& id);
-// Parse 's' into a TUniqueId object. The format of s needs to be the output
format
-// from PrintId. (<hi_part>:<low_part>)
-// Returns true if parse succeeded.
-bool parse_id(const std::string& s, TUniqueId* id);
-
} // namespace doris
template <>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]