GitHub user wangzhewwzz added a comment to the discussion: 关于电网拓扑数据导入

你刚刚让我改成"field_mapping": { "from": "from", "to": "to" } 我已经这么改了呀 
为什么还是有问题?能不能人工解答一下?
         原始邮件
         
       
发件人:dosubot[bot] ***@***.***>
发件时间:2025年12月9日 16:59
收件人:apache/incubator-hugegraph ***@***.***>
抄送:wangzhewwzz ***@***.***>, Mention ***@***.***>
主题:Re: [apache/incubator-hugegraph] 关于电网拓扑数据导入 (Discussion #2917)




我是 AI 助手,每条回复都会结合你贴出的最新代码和报错逐行分析。

你现在遇到的 “Make sure the primary key fields [id] are not empty, or check whether 
the headers or field_mapping are configured correctly” 报错,根本原因是 struct.json 的 
field_mapping 配置和顶点主键字段不匹配。

你的配置问题:

你的顶点主键是 id(vertex_xxx.csv 里有 id 列,schema 里 primaryKeys("id")),但你 struct.json 的 
edges 里 field_mapping 写成了:
"field_mapping": { "from": "from", "to": "to" }

这会导致 loader 用 edge_connected_to.csv 的 from/to 字段去查找顶点的主键字段(id),但 loader 只会把 
from/to 的值直接作为顶点主键 id,不会再去查 vertex_xxx.csv 的其他字段。

最常见的坑:

edge_connected_to.csv 的 from/to 字段有空值、拼写错误、隐藏字符,或者和顶点 id 
不完全一致(比如有多余空格、大小写不一致),都会导致 loader 解析不到主键,报这个错。

struct.json 的 null_values 配置如果包含 "" 或 "null",而 edge_connected_to.csv 某些 from/to 
字段正好是空字符串或 "null",也会被判定为空。

edge_connected_to.csv 的 header 必须严格为 
id,from,to,label,source_label,target_label,不能有多余空格或 BOM。

排查 checklist:

检查 edge_connected_to.csv 的 from/to 列,确保所有值都和顶点 CSV 的 id 完全一致(无多余空格、无大小写问题、无空行)。

检查 struct.json 的 field_mapping,必须是: "field_mapping": { "from": "from", "to": 
"to" }
 不要有 id。

检查 struct.json 的 null_values,建议只保留 ["NULL", "null"],不要加 "",否则空字符串会被判定为 null。

检查 edge_connected_to.csv 的 header 行,确保没有 BOM、没有多余空格,且顺序和 struct.json 里 header 
完全一致。

检查所有边的 from/to 字段都不为空。

检查 struct.json 里所有 edges 配置都同步修改了 field_mapping,没有遗漏。

你可以用文本编辑器或 Excel 检查 edge_connected_to.csv 的 from/to 列,确保没有空值或格式问题。

如果还有问题,请贴出 edge_connected_to.csv 的 header 和前几行原始数据(不要做任何处理),以及 struct.json 里某个 
edges 配置的完整内容,我可以帮你定位具体是哪一行或哪一列有问题。

我会一直结合你最新贴出的内容逐条分析,不会遗漏细节。如需进一步定位,可以贴出 loader 的详细报错堆栈和数据样例。

To reply, just mention @dosu.


How did I do? Good | Irrelevant | Incorrect | Verbose | 
Hallucination | Report 🐛 | Other

   

—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you were mentioned.

GitHub link: 
https://github.com/apache/incubator-hugegraph/discussions/2917#discussioncomment-15206354

----
This is an automatically sent email for [email protected].
To unsubscribe, please send an email to: [email protected]

Reply via email to