This is an automated email from the ASF dual-hosted git repository.
lihaopeng 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 5b43969e35 [fix](profile) fix simply profile because counter may be
not same
5b43969e35 is described below
commit 5b43969e35e3559803a0efb82b8c1aa546acedf5
Author: Mryange <[email protected]>
AuthorDate: Fri Sep 15 21:11:01 2023 +0800
[fix](profile) fix simply profile because counter may be not same
---
.../java/org/apache/doris/common/util/Counter.java | 3 +++
.../apache/doris/common/util/RuntimeProfile.java | 24 ++++++++++++++--------
2 files changed, 19 insertions(+), 8 deletions(-)
diff --git a/fe/fe-core/src/main/java/org/apache/doris/common/util/Counter.java
b/fe/fe-core/src/main/java/org/apache/doris/common/util/Counter.java
index 946d8057fd..5bc4aa2ead 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/common/util/Counter.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/common/util/Counter.java
@@ -51,6 +51,9 @@ public class Counter {
}
public void addValue(Counter other) {
+ if (other == null) {
+ return;
+ }
this.value += other.value;
}
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/common/util/RuntimeProfile.java
b/fe/fe-core/src/main/java/org/apache/doris/common/util/RuntimeProfile.java
index 730d8f9686..a69ecb5d10 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/common/util/RuntimeProfile.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/common/util/RuntimeProfile.java
@@ -374,7 +374,6 @@ public class RuntimeProfile {
counter.addValue(othCounter);
}
}
- counter.setValue(0); // Because the time is not accurate, it has been
set to 0.
}
private static void removePipelineContext(RuntimeProfile src) {
@@ -432,6 +431,9 @@ public class RuntimeProfile {
private static void mergeCounter(RuntimeProfile src, String counterName,
Counter counter,
LinkedList<Counter> rhsCounter) {
+ if (rhsCounter == null) {
+ return;
+ }
if (rhsCounter.size() == 0) {
return;
}
@@ -439,15 +441,19 @@ public class RuntimeProfile {
Counter maxCounter = new Counter(counter.getType(),
counter.getValue());
Counter minCounter = new Counter(counter.getType(),
counter.getValue());
for (Counter cnt : rhsCounter) {
- if (cnt.getValue() > maxCounter.getValue()) {
- maxCounter.setValue(cnt.getValue());
- }
- if (cnt.getValue() < minCounter.getValue()) {
- minCounter.setValue(cnt.getValue());
+ if (cnt != null) {
+ if (cnt.getValue() > maxCounter.getValue()) {
+ maxCounter.setValue(cnt.getValue());
+ }
+ if (cnt.getValue() < minCounter.getValue()) {
+ minCounter.setValue(cnt.getValue());
+ }
}
}
for (Counter cnt : rhsCounter) {
- counter.addValue(cnt);
+ if (cnt != null) {
+ counter.addValue(cnt);
+ }
}
long countNumber = rhsCounter.size() + 1;
counter.divValue(countNumber);
@@ -476,7 +482,9 @@ public class RuntimeProfile {
return;
}
for (Counter cnt : rhsCounter) {
- counter.addValue(cnt);
+ if (cnt != null) {
+ counter.addValue(cnt);
+ }
}
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]