简体   繁体   English

在scala gremlin中创建属性密钥时发生IllegalArgumentException

[英]IllegalArgumentException while creating property key in scala gremlin

I am trying to create schema with the property keys defined for my keys used as properties in vertices and edges. 我试图用为我的键定义的属性键创建架构,这些键用作顶点和边中的属性。

mgmt.makePropertyKey(ID_).dataType(classOf[String]).cardinality(Cardinality.SET).make()
mgmt.makePropertyKey("age").dataType(classOf[Integer]).cardinality(Cardinality.SET).make()
mgmt.makePropertyKey("size").dataType(classOf[Integer]).cardinality(Cardinality.SET).make()
mgmt.makePropertyKey("time").dataType(classOf[Long]).cardinality(Cardinality.SET).make()

age , size , time will be property keys in the edges. agesizetime将是边缘的属性键。

Getting the below exception while creating keys, 创建密钥时出现以下异常,

java.lang.IllegalArgumentException: Not a supported data type: long java.lang.IllegalArgumentException:不支持的数据类型:long

Time property key will be long value since i am current timemillsecs in that. 时间属性键将是long值,因为我当前在其中。

Same this works when i change to 同样,当我更改为

mgmt.makePropertyKey("time").dataType(classOf[String]).cardinality(Cardinality.SET).make()

If i do that it is creating problem during graph traversal for time check. 如果我这样做,则在遍历图进行时间检查时会产生问题。 Getting some classcast exception. 获取一些classcast异常。 I couldnot give a long value to compare the time 我无法提供比较长时间的值

Am i doing something wrong. 难道我做错了什么。

它适用于java.lang.Long数据类型

 mgmt.makePropertyKey(TIME).dataType(classOf[java.lang.Long]).cardinality(Cardinality.SET).make()

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM