aws/amazon-neptune-jdbc-driver

[BUG] Simple SQL query fails in SQL Workbench

WithSecureSamiTikka opened this issue · 3 comments

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

  • Is the JDBC Driver being used in a BI tool?: no
  • version of JDBC Driver: 1.1.0-all
  • language variant: SQL
  • database: Amazon Neptune
  • database engine version: 1.0.5.1
  • java version: openjdk version "17.0.1" 2021-10-19
  • java code: running SQL Workbench/J Build 128
  • sql code: select count(*) from File;

Expected behavior

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

Screenshots

Environment

  • OS: macOS Big Sur
  • Version 11.6.2
  • jdbc connection string used: jdbc:neptune:sqlgremlin://.eu-west-1.neptune.amazonaws.com;port=8182;authScheme=IAMSigV4
  • AWS credentials in ~/.aws/credentials
  • AWS_PROFILE set in environment
  • SERVICE_REGION set in environment to eu-west-1

Additional Context

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.

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.

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.