From f74e635aa548311ba1fab0f79c25de65a590e17b Mon Sep 17 00:00:00 2001 From: xy720 <22125576+xy720@users.noreply.github.com> Date: Sat, 1 Jul 2023 17:42:46 +0800 Subject: [PATCH] [bug](proc) fix NumberFormatException in show proc '/current_queries' (#21400) If the current query is running for a very long time, the ExecTime of this query may larger than the MAX_INT value, then a NumberFormatException will be thrown when execute "show proc '/current_queries'." The query's ExecTime is long type, we should not use 'Integer.parseInt' to parse it. --- .../doris/common/proc/CurrentQueryStatementsProcNode.java | 6 +++--- .../doris/common/proc/CurrentQueryStatisticsProcDir.java | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/fe/fe-core/src/main/java/org/apache/doris/common/proc/CurrentQueryStatementsProcNode.java b/fe/fe-core/src/main/java/org/apache/doris/common/proc/CurrentQueryStatementsProcNode.java index 16d09a5afe8570..746726c90514b3 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/common/proc/CurrentQueryStatementsProcNode.java +++ b/fe/fe-core/src/main/java/org/apache/doris/common/proc/CurrentQueryStatementsProcNode.java @@ -61,9 +61,9 @@ public ProcResult fetchResult() throws AnalysisException { // sort according to ExecTime sortedRowData.sort((l1, l2) -> { - final int execTime1 = Integer.parseInt(l1.get(EXEC_TIME_INDEX)); - final int execTime2 = Integer.parseInt(l2.get(EXEC_TIME_INDEX)); - return execTime2 - execTime1; + final long execTime1 = Long.parseLong(l1.get(EXEC_TIME_INDEX)); + final long execTime2 = Long.parseLong(l2.get(EXEC_TIME_INDEX)); + return Long.compare(execTime2, execTime1); }); result.setRows(sortedRowData); return result; diff --git a/fe/fe-core/src/main/java/org/apache/doris/common/proc/CurrentQueryStatisticsProcDir.java b/fe/fe-core/src/main/java/org/apache/doris/common/proc/CurrentQueryStatisticsProcDir.java index 4c59d93bb14efa..0df36c0040f953 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/common/proc/CurrentQueryStatisticsProcDir.java +++ b/fe/fe-core/src/main/java/org/apache/doris/common/proc/CurrentQueryStatisticsProcDir.java @@ -92,9 +92,9 @@ public ProcResult fetchResult() throws AnalysisException { } // sort according to ExecTime sortedRowData.sort((l1, l2) -> { - final int execTime1 = Integer.parseInt(l1.get(EXEC_TIME_INDEX)); - final int execTime2 = Integer.parseInt(l2.get(EXEC_TIME_INDEX)); - return execTime2 - execTime1; + final long execTime1 = Long.parseLong(l1.get(EXEC_TIME_INDEX)); + final long execTime2 = Long.parseLong(l2.get(EXEC_TIME_INDEX)); + return Long.compare(execTime2, execTime1); }); result.setRows(sortedRowData); return result;