From 786c99accfddbf5b8d11d06a369496b91bb8f037 Mon Sep 17 00:00:00 2001 From: zhangyi51 Date: Wed, 3 Aug 2022 11:55:16 +0800 Subject: [PATCH] Fix orc data import npe fixed: #319 Co-authored-by: ss <50285938+ssisme2019@users.noreply.github.com> Change-Id: I13a0d663adead9b7ee66af62238c6769350ebdff --- .../loader/reader/file/OrcFileLineFetcher.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/hugegraph-loader/src/main/java/com/baidu/hugegraph/loader/reader/file/OrcFileLineFetcher.java b/hugegraph-loader/src/main/java/com/baidu/hugegraph/loader/reader/file/OrcFileLineFetcher.java index e5f846d54..df6e9b9ec 100644 --- a/hugegraph-loader/src/main/java/com/baidu/hugegraph/loader/reader/file/OrcFileLineFetcher.java +++ b/hugegraph-loader/src/main/java/com/baidu/hugegraph/loader/reader/file/OrcFileLineFetcher.java @@ -125,9 +125,15 @@ public Line fetch() throws IOException { } this.row = this.recordReader.next(this.row); - Object[] values = this.inspector.getStructFieldsDataAsList(this.row) - .stream().map(Object::toString) - .toArray(); + List data = this.inspector.getStructFieldsDataAsList(this.row); + Object[] values = new Object[data.size()]; + for (int i = 0; i < data.size(); i++) { + if (data.get(i) == null) { + values[i] = ""; + } else { + values[i] = data.get(i).toString(); + } + } String rawLine = StringUtils.join(values, Constants.COMMA_STR); this.increaseOffset();