当id策略PRIMARY_KEY时,id字段如何设置为空
运行报错:
Vertices has been imported: Exception in thread "main" java.lang.IllegalStateException: The id field must be empty or null when id strategy is PRIMARY_KEY for vertex label 'person'
at com.google.common.base.Preconditions.checkState(Preconditions.java:199)
at com.baidu.hugegraph.util.E.checkState(E.java:68)
at com.baidu.hugegraph.loader.builder.VertexBuilder.checkIdField(VertexBuilder.java:119)
at com.baidu.hugegraph.loader.builder.VertexBuilder.
麻烦按照如下步骤重试一次:
- 停掉 HugeGraphServer 服务
- 进入 mysql client,清理数据库,使用 drop database 命令
- 回到hugegraph目录,执行init-store.sh
- 启动 HugeGraphServer 服务
- 修改loader中的schema文件,确保在Id策略为PRIMARY_KEY的情况下,没有vertexlabel中含有id属性
- 删除struct.json文件中的
"id": "id"行 - 执行导入