neo4j - 在 neo4j 中导入 csv 时导致 ArrayIndexOutOfBoundsException 的原因是什么?
问题描述
我想从 twitter 导入带有推文的 csv 表。但我收到错误消息:
调用过程失败
apoc.load.csv
:原因:java.lang.ArrayIndexOutOfBoundsException:索引 4 超出长度 4 的范围
我的代码是:
CALL apoc.load.csv("conversations_until_2021_06_18.tsv", {
sep: "TAB",
arraySep: ",",
skip: 100000,
mapping: {
hashtags: {array: true},
mentions: {array: true},
ref_id: {array: true},
reply_count: {type: "int"},
retweet_count: {type: "int"},
quote_count: {type: "int"},
like_count: {type: "int"}
}
}
)
YIELD map AS tweet
CREATE (t:Tweet)
SET t = tweet
如果您遇到更严重的问题,请提供以下信息:
我正在使用 Neo4j v4.3.1,桌面 v1.4.5
一个例子:
comment_type conversatoin_id text author_id tweet_id ref_type ref_id in_reply_to_user_id created_at mentions url hashtags like_count quote_count reply_count retweet_count reply_settings
side 1234 @url https://t.co/... 345 5678 replied_to 564465 4566 2021-04-28T15:55:42.000Z ABaerbock, ArminLaschet https://twitter.com/... NaN 0 0 0 0 everyone
我的一个文件工作正常,但第二个文件会产生此错误。根据this这个问题,文件中的一行有问题。但是如何找到那条线?我不知道长度为 4 的数组在哪里。
解决方案
尝试上传大型文档时遇到了同样的问题。不幸的是,此例外不会为您提供补充信息;它只是标记文件的格式问题。
我使用了“,”分隔符,但它一直失败。结果,我分析了数据并决定使用不同的分隔符;例如,我的字段都不包含字符“>”,因此我将其用作分隔符并避免了错误。