Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

loader(0.7.0)导入数据出错,后端是scylladb #54

Closed
Blessness opened this issue Sep 13, 2018 · 1 comment
Closed

loader(0.7.0)导入数据出错,后端是scylladb #54

Blessness opened this issue Sep 13, 2018 · 1 comment

Comments

@Blessness
Copy link

使用loader的example目录下文件导入测试,出现如下错误:

Exception in thread "main" java.lang.reflect.UndeclaredThrowableException
at com.sun.proxy.$Proxy52.create(Unknown Source)
at com.baidu.hugegraph.structure.schema.SchemaBuilder$create.call(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:117)
at Script1.run(Script1.groovy:15)
at com.baidu.hugegraph.loader.executor.GroovyExecutor.execute(GroovyExecutor.java:62)
at com.baidu.hugegraph.loader.HugeGraphLoader.createSchema(HugeGraphLoader.java:161)
at com.baidu.hugegraph.loader.HugeGraphLoader.load(HugeGraphLoader.java:104)
at com.baidu.hugegraph.loader.HugeGraphLoader.main(HugeGraphLoader.java:68)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.baidu.hugegraph.structure.schema.BuilderProxy.invoke(BuilderProxy.java:56)
... 10 more
Caused by: class java.lang.IllegalArgumentException: Not all index fields '[city]' are contained in schema properties '[age, name, addr, weight]'
at com.baidu.hugegraph.exception.ServerException.fromResponse(ServerException.java:44)
at com.baidu.hugegraph.client.RestClient.checkStatus(RestClient.java:63)
at com.baidu.hugegraph.rest.RestClient.post(RestClient.java:119)
at com.baidu.hugegraph.rest.RestClient.post(RestClient.java:79)
at com.baidu.hugegraph.rest.RestClient.post(RestClient.java:74)
at com.baidu.hugegraph.api.schema.IndexLabelAPI.create(IndexLabelAPI.java:43)
at com.baidu.hugegraph.driver.SchemaManager.addIndexLabel(SchemaManager.java:147)
at com.baidu.hugegraph.structure.schema.IndexLabel$BuilderImpl.create(IndexLabel.java:125)
at com.baidu.hugegraph.structure.schema.IndexLabel$BuilderImpl.create(IndexLabel.java:108)
... 15 more

schema.groovy 配置文件信息如下:

schema.propertyKey("name").asText().ifNotExist().create();
schema.propertyKey("age").asInt().ifNotExist().create();
schema.propertyKey("city").asText().ifNotExist().create();
schema.propertyKey("weight").asDouble().ifNotExist().create();
schema.propertyKey("lang").asText().ifNotExist().create();
schema.propertyKey("date").asText().ifNotExist().create();
schema.propertyKey("price").asDouble().ifNotExist().create();

schema.vertexLabel("person").properties("name", "age", "city").primaryKeys("name").ifNotExist().create();
schema.vertexLabel("software").properties("name", "lang", "price").primaryKeys("name").ifNotExist().create();

schema.indexLabel("personByName").onV("person").by("name").secondary().ifNotExist().create();
schema.indexLabel("personByAge").onV("person").by("age").range().ifNotExist().create();
schema.indexLabel("personByCity").onV("person").by("city").secondary().ifNotExist().create();
schema.indexLabel("personByAgeAndCity").onV("person").by("age", "city").secondary().ifNotExist().create();
schema.indexLabel("softwareByPrice").onV("software").by("price").range().ifNotExist().create();

schema.edgeLabel("knows").sourceLabel("person").targetLabel("person").properties("date", "weight").ifNotExist().create();
schema.edgeLabel("created").sourceLabel("person").targetLabel("software").properties("date", "weight").ifNotExist().create();

schema.indexLabel("createdByDate").onE("created").by("date").secondary().ifNotExist().create();
schema.indexLabel("createdByWeight").onE("created").by("weight").range().ifNotExist().create();
schema.indexLabel("knowsByWeight").onE("knows").by("weight").range().ifNotExist().create()

将index部分删除后,执行导入依然报错:
`schema.propertyKey("name").asText().ifNotExist().create();
schema.propertyKey("age").asInt().ifNotExist().create();
schema.propertyKey("city").asText().ifNotExist().create();
schema.propertyKey("weight").asDouble().ifNotExist().create();
schema.propertyKey("lang").asText().ifNotExist().create();
schema.propertyKey("date").asText().ifNotExist().create();
schema.propertyKey("price").asDouble().ifNotExist().create();

schema.vertexLabel("person").properties("name", "age", "city").primaryKeys("name").ifNotExist().create();
schema.vertexLabel("software").properties("name", "lang", "price").primaryKeys("name").ifNotExist().create();

schema.edgeLabel("knows").sourceLabel("person").targetLabel("person").properties("date", "weight").ifNotExist().create();
schema.edgeLabel("created").sourceLabel("person").targetLabel("software").properties("date", "weight").ifNotExist().create();`

Vertices has been imported:Exception in thread "main" java.lang.IllegalStateException: The id field can't be empty or null when id strategy is CUSTOMIZE
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.parser.VertexParser.checkIdField(VertexParser.java:103)
at com.baidu.hugegraph.loader.parser.VertexParser.(VertexParser.java:43)
at com.baidu.hugegraph.loader.HugeGraphLoader.loadVertices(HugeGraphLoader.java:169)
at com.baidu.hugegraph.loader.HugeGraphLoader.load(HugeGraphLoader.java:111)
at com.baidu.hugegraph.loader.HugeGraphLoader.main(HugeGraphLoader.java:68)

但scheme中并没有将VertexId使用 CUSTOMIZE 策略。

期待回复~

@Blessness
Copy link
Author

原因是之前创建过一样的scheme,但我在数据库中将数据删除了,但server有缓存,重启server后导入成功。

Linary added a commit that referenced this issue Sep 21, 2020
Change-Id: I86f0a7800e19acb6356e9e603605cb03eff1d30d
houzhizhen pushed a commit that referenced this issue Sep 22, 2020
Change-Id: I86f0a7800e19acb6356e9e603605cb03eff1d30d
zhoney added a commit to zhoney/hugegraph that referenced this issue Nov 9, 2021
* disable etcd for auth server (apache#42)

* refine MetricsAPI test for prometheus exporter (apache#43)

* upgrade hugegraph config and white api list (apache#44)

* fix rest-server.properties config item k8s.hugegraph_url (apache#46)

* fix rocksdb not close after close graph (apache#47)

* support none auth mode for k8s api (apache#50)

* feat(api): Support adamic-adar & resource-allocation algorithms (apache#10) (apache#51)

* support graph reload and ingore single graph error when start server (apache#55)

* support force delete task (apache#56)

* update reload api (apache#57)

* fix: check neighbors count & null label (apache#54)

* fixed prometheus metrics bugs


Co-authored-by: zhoney <[email protected]>
Co-authored-by: sunwei31 <[email protected]>
Co-authored-by: imbajin <[email protected]>
Co-authored-by: guoyonggang <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant