Skip to content
Permalink
Browse files
Fix npe because missing edge mapping struct (#213)
Change-Id: I79e0c2a2d3e232cd2a5adb945214cbe3cbfe3b43
  • Loading branch information
Linary committed May 18, 2021
1 parent 05967f0 commit 5f9aa9b96e11a4761fc0df7e75e10d70ee690835
Showing 2 changed files with 9 additions and 3 deletions.
@@ -164,6 +164,7 @@ private void loadInputs() {
Printer.printRealtimeProgress(this.context);
LoadOptions options = this.context.options();
LoadSummary summary = this.context.summary();
summary.initMetrics(this.mapping);

summary.startTotalTimer();
try {
@@ -28,6 +28,7 @@

import com.baidu.hugegraph.loader.constant.ElemType;
import com.baidu.hugegraph.loader.mapping.InputStruct;
import com.baidu.hugegraph.loader.mapping.LoadMapping;
import com.baidu.hugegraph.util.InsertionOrderUtil;

public final class LoadSummary {
@@ -53,14 +54,18 @@ public LoadSummary() {
this.inputMetricsMap = InsertionOrderUtil.newMap();
}

public void initMetrics(LoadMapping mapping) {
for (InputStruct struct : mapping.structs()) {
this.inputMetricsMap.put(struct.id(), new LoadMetrics(struct));
}
}

public Map<String, LoadMetrics> inputMetricsMap() {
return this.inputMetricsMap;
}

public LoadMetrics metrics(InputStruct struct) {
return this.inputMetricsMap.computeIfAbsent(struct.id(), k -> {
return new LoadMetrics(struct);
});
return this.inputMetricsMap.get(struct.id());
}

public long vertexLoaded() {

0 comments on commit 5f9aa9b

Please sign in to comment.