This is an automated email from the ASF dual-hosted git repository.
dockerzhang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/inlong.git
The following commit(s) were added to refs/heads/master by this push:
new 9da24ebbf [INLONG-6813][Sort] MetricStateUtils threw NPE when write to
es and no dirtyRecordsOut counter (#6814)
9da24ebbf is described below
commit 9da24ebbf51079a65f047a31d1b659955a182fc7
Author: wangpeix <[email protected]>
AuthorDate: Tue Dec 13 10:01:52 2022 +0800
[INLONG-6813][Sort] MetricStateUtils threw NPE when write to es and no
dirtyRecordsOut counter (#6814)
Co-authored-by: wangpeix <[email protected]>
---
.../java/org/apache/inlong/sort/base/util/MetricStateUtils.java | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git
a/inlong-sort/sort-connectors/base/src/main/java/org/apache/inlong/sort/base/util/MetricStateUtils.java
b/inlong-sort/sort-connectors/base/src/main/java/org/apache/inlong/sort/base/util/MetricStateUtils.java
index 76656c6ae..7f9aac88f 100644
---
a/inlong-sort/sort-connectors/base/src/main/java/org/apache/inlong/sort/base/util/MetricStateUtils.java
+++
b/inlong-sort/sort-connectors/base/src/main/java/org/apache/inlong/sort/base/util/MetricStateUtils.java
@@ -222,8 +222,12 @@ public class MetricStateUtils {
Map<String, Long> metricDataMap = new HashMap<>();
metricDataMap.put(NUM_RECORDS_OUT,
sinkMetricData.getNumRecordsOut().getCount());
metricDataMap.put(NUM_BYTES_OUT,
sinkMetricData.getNumBytesOut().getCount());
- metricDataMap.put(DIRTY_RECORDS_OUT,
sinkMetricData.getDirtyRecordsOut().getCount());
- metricDataMap.put(DIRTY_BYTES_OUT,
sinkMetricData.getDirtyBytesOut().getCount());
+ if (sinkMetricData.getDirtyRecordsOut() != null) {
+ metricDataMap.put(DIRTY_RECORDS_OUT,
sinkMetricData.getDirtyRecordsOut().getCount());
+ }
+ if (sinkMetricData.getDirtyBytesOut() != null) {
+ metricDataMap.put(DIRTY_BYTES_OUT,
sinkMetricData.getDirtyBytesOut().getCount());
+ }
MetricState metricState = new MetricState(subtaskIndex, metricDataMap);
metricStateListState.add(metricState);
}