[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.
This commit is contained in:
xy720
2023-07-01 17:42:46 +08:00
committed by GitHub
parent 1c961f2272
commit f74e635aa5
2 changed files with 6 additions and 6 deletions

View File

@ -61,9 +61,9 @@ public class CurrentQueryStatementsProcNode implements ProcNodeInterface {
// 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;

View File

@ -92,9 +92,9 @@ public class CurrentQueryStatisticsProcDir implements ProcDirInterface {
}
// 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;