[FE][Bug] Fix overflow in RuntimeProfile.sortChildren. (#5377)

If the difference between the two times exceeds Integer.MAX_VALUE,
the compare's return value will overflow and the flow exception may be triggered when sorting profile.
This commit is contained in:
曹建华
2021-02-16 22:34:27 +08:00
committed by GitHub
parent bd72328177
commit 204fa45a48

View File

@ -369,9 +369,8 @@ public class RuntimeProfile {
@Override
public int compare(Pair<RuntimeProfile, Boolean> profile1, Pair<RuntimeProfile, Boolean> profile2)
{
long distance = profile2.first.getCounterTotalTime().getValue()
- profile1.first.getCounterTotalTime().getValue();
return (int) distance;
return Long.valueOf(profile2.first.getCounterTotalTime().getValue())
.compareTo(profile1.first.getCounterTotalTime().getValue());
}
});
}