Dgraph4j datetime problem


(Dx Guan) #1

Seems like dgraph4j deals with datetime with a problem:

String date = "2006-01-02T15:04:05.999999999";

DgraphProto.Value value = DgraphProto.Value.newBuilder().setDatetimeVal(ByteString.copyFromUtf8(date)).build();

DgraphProto.Mutation mutation = DgraphProto.Mutation.newBuilder()
               .addSet(DgraphProto.NQuad.newBuilder()
                       .setSubject("_:user")
                       .setPredicate("birthday")
                       .setObjectValue(value)).build();
txn.mutate(mutation);
txn.commit();

Debugging with the code above, dgraph raises an error like this:

Caused by: io.grpc.StatusRuntimeException: UNKNOWN: Time.UnmarshalBinary: unsupported version
	at io.grpc.Status.asRuntimeException(Status.java:526) ~[grpc-core-1.10.0.jar:1.10.0]
	at io.grpc.stub.ClientCalls$StreamObserverToCallListenerAdapter.onClose(ClientCalls.java:419) ~[grpc-stub-1.10.0.jar:1.10.0]
	at io.grpc.ForwardingClientCallListener.onClose(ForwardingClientCallListener.java:41) ~[grpc-core-1.10.0.jar:1.10.0]
	at io.grpc.internal.CensusStatsModule$StatsClientInterceptor$1$1.onClose(CensusStatsModule.java:684) ~[grpc-core-1.10.0.jar:1.10.0]
	at io.grpc.ForwardingClientCallListener.onClose(ForwardingClientCallListener.java:41) ~[grpc-core-1.10.0.jar:1.10.0]
	at io.grpc.internal.CensusTracingModule$TracingClientInterceptor$1$1.onClose(CensusTracingModule.java:391) ~[grpc-core-1.10.0.jar:1.10.0]
	at io.grpc.internal.ClientCallImpl.closeObserver(ClientCallImpl.java:475) ~[grpc-core-1.10.0.jar:1.10.0]
	at io.grpc.internal.ClientCallImpl.access$300(ClientCallImpl.java:63) ~[grpc-core-1.10.0.jar:1.10.0]
	at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl.close(ClientCallImpl.java:557) ~[grpc-core-1.10.0.jar:1.10.0]
	at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl.access$600(ClientCallImpl.java:478) ~[grpc-core-1.10.0.jar:1.10.0]
	at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$1StreamClosed.runInContext(ClientCallImpl.java:590) ~[grpc-core-1.10.0.jar:1.10.0]
	at io.grpc.internal.ContextRunnable.run(ContextRunnable.java:37) ~[grpc-core-1.10.0.jar:1.10.0]
	at io.grpc.internal.SerializingExecutor.run(SerializingExecutor.java:123) ~[grpc-core-1.10.0.jar:1.10.0]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) ~[?:1.8.0_181]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) ~[?:1.8.0_181]
	at java.lang.Thread.run(Thread.java:748) ~[?:1.8.0_181]


(Manish R Jain) #2

@deepak: Can you have a look at this?


(Ophir Radnitz) #3

The DgraphProto.Value proto representation dgraph expects for date values is Unix epoch time as Long (so 1136214246L in your case). This is different than what the JSON representation should be for the same value which is an RFC 3339 format String.