Skip to content

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

@Blessness

Description

@Blessness

使用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 策略。

期待回复~

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions