aws / amazon-neptune-jdbc-driver

Amazon Neptune JDBC Driver by Amazon Web Services
https://aws.amazon.com/neptune/
Apache License 2.0
23 stars 13 forks source link

[BUG] Simple SQL query fails in SQL Workbench #144

Closed WithSecureSamiTikka closed 2 years ago

WithSecureSamiTikka commented 2 years ago

Describe the bug

I have the driver configured in SQL Workbench and when I try a simple query

select count(*) from File;

I get back error:

An error occurred when executing the SQL command: select count(*) from File

Error occurred during schema collection. 'java.util.concurrent.ExecutionException: shadow.io.netty.handler.codec.EncoderException: shadow.org.apache.tinkerpop.gremlin.driver.exception.ResponseException: An error occurred during serialization of this request [RequestMessage{, requestId=e3f911dc-8a81-49f0-b7b8-5f8ee32718de, op='bytecode', processor='traversal', args={gremlin=[[], [V(), label(), dedup()]], aliases={g=g}}}] - it could not be sent to the server - Reason: shadow.org.apache.tinkerpop.gremlin.driver.ser.SerializationException: java.lang.IllegalArgumentException: Unable to create serializer "shadow.org.apache.tinkerpop.shaded.kryo.serializers.FieldSerializer" for class: java.util.concurrent.atomic.AtomicLong'. 1 statement failed.

Execution time: 4.71s

To my understanding this should be a supported query type

Steps to Reproduce

Expected behavior

Expected SQL Workbench to reply 66400 as that is how many vertices with label "File" there are in my graph.

Screenshots

Environment

Additional Context

lyndonbauto commented 2 years ago

This looks like an exception from the TinkerPop serialization code, where SQL Workbench is using passing an AtomicLong (as opposed to a regular Long), which is causing an exception because it is not a serializable type. I have this on my backlog to look at and will try to take a look soon.

lyndonbauto commented 2 years ago

I looked into this in depth. This issue only exists when using OpenJDK 17 and TinkerPop 3.4.8.

So the solution seems to be to upgrade the JDBC Driver (and sql-gremlin) to 3.5.2.

I need to do proper testing before committing this change though, so I have made this ticket to track that since this exact issue was reported somewhere else as well.

See #159 going forward.

lyndonbauto commented 2 years ago

A workaround would be for you to use a different JDK or alternatively you could likely inject a different serialization protocol into TinkerPop. Please let me know if you need assistance with the latter, as I can show you how it's done.