[英]How to use java `OffsetDateTime` in apache tinkerpop gremlin?
The application can be accessed from a different timezone
, so I am trying to store date time using class java.time.OffsetDateTime
.该应用程序可以从different timezone
访问,因此我尝试使用 class java.time.OffsetDateTime
存储日期时间。
startTime: "1996-12-19T16:39:57-08:00",
endTime: "1996-12-19T16:39:57-08:00"
The application/API receives the time in the above format using OffsetDateTime
and I am trying to save the same in AWS Neptune using Apache gremlin but I am getting the following error,应用程序/API 使用OffsetDateTime
以上述格式接收时间,我正在尝试使用 Apache gremlin 将其保存在 AWS Neptune 中,但出现以下错误,
org.apache.tinkerpop.gremlin.driver.exception.ResponseException: {"detailedMessage":"Unsupported property value type: java.time.OffsetDateTime","code":"UnsupportedOperationException","requestId":"81e402b0-90ab-4c6d-8839-23542da3437b"}
at org.apache.tinkerpop.gremlin.driver.Handler$GremlinResponseHandler.channelRead0(Handler.java:245) ~[gremlin-driver-3.6.1.jar:3.6.1]
at org.apache.tinkerpop.gremlin.driver.Handler$GremlinResponseHandler.channelRead0(Handler.java:200) ~[gremlin-driver-3.6.1.jar:3.6.1]
at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:99) ~[netty-transport-4.1.79.Final.jar:4.1.79.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) ~[netty-transport-4.1.79.Final.jar:4.1.79.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) ~[netty-transport-4.1.79.Final.jar:4.1.79.Final]
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357) ~[netty-transport-4.1.79.Final.jar:4.1.79.Final]
at org.apache.tinkerpop.gremlin.driver.Handler$GremlinSaslAuthenticationHandler.channelRead0(Handler.java:126) ~[gremlin-driver-3.6.1.jar:3.6.1]
at org.apache.tinkerpop.gremlin.driver.Handler$GremlinSaslAuthenticationHandler.channelRead0(Handler.java:68) ~[gremlin-driver-3.6.1.jar:3.6.1]
at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:99) ~[netty-transport-4.1.79.Final.jar:4.1.79.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) ~[netty-transport-4.1.79.Final.jar:4.1.79.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) ~[netty-transport-4.1.79.Final.jar:4.1.79.Final]
OffsetDateTime
is not supported in Gremlin/Neptune? Gremlin/Neptune 不支持OffsetDateTime
? then how to store, and retrieve in an efficient way from the database?那么如何有效地从数据库中存储和检索呢?
Amazon Neptune is designed to work with any programming language. Amazon Neptune 旨在与任何编程语言一起使用。 As such you cannot store arbitrary Java types/objects into Neptune.因此,您不能将任意 Java 类型/对象存储到 Neptune 中。 You can use the native Date
types and they will be converted by the Gremlin GLVs into the appropriate serialization.您可以使用本机Date
类型,它们将由 Gremlin GLV 转换为适当的序列化。 To store dates you really have two main options.要存储日期,您实际上有两个主要选择。
datetime
helper for text queries.存储 Date 类型或使用datetime
帮助器进行文本查询。Using real Dates should be slightly more performant (on Neptune).使用真正的 Dates 应该稍微提高性能(在 Neptune 上)。
If you need to store additional TZ information, you will most likely want to store that as an additional property on a node or edge.如果您需要存储额外的 TZ 信息,您很可能希望将其作为附加属性存储在节点或边上。
More information on Neptune's support for dates when using Gremlin, can be found here .有关 Neptune 在使用 Gremlin 时对日期的支持的更多信息,请参见此处。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.