You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hugegraph.apache.org by zh...@apache.org on 2022/08/03 04:10:41 UTC
[incubator-hugegraph-toolchain] branch fix-orc-read-npe created (now 786c99a)
This is an automated email from the ASF dual-hosted git repository.
zhangyi89817 pushed a change to branch fix-orc-read-npe
in repository https://gitbox.apache.org/repos/asf/incubator-hugegraph-toolchain.git
at 786c99a Fix orc data import npe fixed: #319
This branch includes the following new commits:
new 786c99a Fix orc data import npe fixed: #319
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
[incubator-hugegraph-toolchain] 01/01: Fix orc data import npe fixed: #319
Posted by zh...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
zhangyi89817 pushed a commit to branch fix-orc-read-npe
in repository https://gitbox.apache.org/repos/asf/incubator-hugegraph-toolchain.git
commit 786c99accfddbf5b8d11d06a369496b91bb8f037
Author: zhangyi51 <zh...@baidu.com>
AuthorDate: Wed Aug 3 11:55:16 2022 +0800
Fix orc data import npe
fixed: #319
Co-authored-by: ss <50...@users.noreply.github.com>
Change-Id: I13a0d663adead9b7ee66af62238c6769350ebdff
---
.../hugegraph/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 e5f846d..df6e9b9 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 class OrcFileLineFetcher extends FileLineFetcher {
}
this.row = this.recordReader.next(this.row);
- Object[] values = this.inspector.getStructFieldsDataAsList(this.row)
- .stream().map(Object::toString)
- .toArray();
+ List<Object> 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();