zhiqiang-hhhh commented on code in PR #35602:
URL: https://github.com/apache/doris/pull/35602#discussion_r1619878588


##########
fe/fe-core/src/main/java/org/apache/doris/common/util/DebugUtil.java:
##########
@@ -135,6 +137,28 @@ public static String printId(final TUniqueId id) {
         return builder.toString();
     }
 
+    // id is a String generated by DebugUtil.printId(TUniqueId)
+    public static TUniqueId parseTUniqueIdFromString(String id) {
+        if (Strings.isNullOrEmpty(id)) {
+            throw new NumberFormatException("invalid query id");
+        }
+
+        String[] parts = id.split("-");
+        if (parts.length != 2) {
+            throw new NumberFormatException("invalid query id");
+        }
+
+        TUniqueId uniqueId = new TUniqueId();
+        try {
+            uniqueId.setHi(Long.parseUnsignedLong(parts[0], 16));
+            uniqueId.setLo(Long.parseUnsignedLong(parts[1], 16));
+        } catch (NumberFormatException e) {
+            throw new NumberFormatException("invalid query id:" + 
e.getMessage());

Review Comment:
   `throw new NumberFormatException("invalid id: " + id + " " + 
e.getMessage());`



##########
fe/fe-core/src/main/java/org/apache/doris/qe/StmtExecutor.java:
##########
@@ -1570,18 +1571,33 @@ private void handleKill() throws DdlException {
         int id = killStmt.getConnectionId();
         String queryId = killStmt.getQueryId();
         if (id == -1) {
+            // when killCtx == null, this means the query not in FE,
+            // then we just send kill signal to BE
             killCtx = 
context.getConnectScheduler().getContextWithQueryId(queryId);
-            if (killCtx == null) {
-                ErrorReport.reportDdlException(ErrorCode.ERR_NO_SUCH_QUERY, 
queryId);
-            }
         } else {
             killCtx = context.getConnectScheduler().getContext(id);
             if (killCtx == null) {
                 ErrorReport.reportDdlException(ErrorCode.ERR_NO_SUCH_THREAD, 
id);
             }
         }
 
-        if (context == killCtx) {
+        if (killCtx == null) {
+            TUniqueId tQueryId = DebugUtil.parseTUniqueIdFromString(queryId);

Review Comment:
   exception could be thrown, what will user see?



##########
fe/fe-core/src/main/java/org/apache/doris/common/util/DebugUtil.java:
##########
@@ -135,6 +137,28 @@ public static String printId(final TUniqueId id) {
         return builder.toString();
     }
 
+    // id is a String generated by DebugUtil.printId(TUniqueId)
+    public static TUniqueId parseTUniqueIdFromString(String id) {
+        if (Strings.isNullOrEmpty(id)) {
+            throw new NumberFormatException("invalid query id");
+        }
+
+        String[] parts = id.split("-");
+        if (parts.length != 2) {
+            throw new NumberFormatException("invalid query id");

Review Comment:
   throw new NumberFormatException("invalid id: " + id);



##########
fe/fe-core/src/main/java/org/apache/doris/common/util/DebugUtil.java:
##########
@@ -135,6 +137,28 @@ public static String printId(final TUniqueId id) {
         return builder.toString();
     }
 
+    // id is a String generated by DebugUtil.printId(TUniqueId)
+    public static TUniqueId parseTUniqueIdFromString(String id) {
+        if (Strings.isNullOrEmpty(id)) {
+            throw new NumberFormatException("invalid query id");

Review Comment:
   `throw new NumberFormatException("invalid id: " + id);`



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to