user2026504
user2026504

Reputation: 84

NullPointerException error while executing Athena query using Neptune connector

I am trying to execute query from Athena to show data from Neptune database. I am using Athena Neptune connector to connect to Neptune DB and show the data in Athena query editor.

However I get error when I run the following query

SELECT * FROM  "datasource/datacatalog".<dbname>.<tablename> limit 10;

Error Message:

 Encountered an exception[java.lang.NullPointerException] from your LambdaFunction[neptune_connector lambda function name] executed in context[S3SpillLocation{bucket='S3 bucketname', key='<file prefix name/2e6fedb0-9366-4d83-8a69-20472d7ff850/', directory=true}]

I have done so far.

  1. Created a new data catalog and database and table (manually, componenttype: vertex).
  2. Connected datacatalog with neptune connector lambda
  3. Full access to Athena,S3,Neptune and Glue has been to the role under which Neptune connector lambda runs.
  4. An existing S3 bucket name has been provided in spillbucket variable for connector lambda.

References:

  1. Amazon Athena Neptune connector - https://github.com/awslabs/aws-athena-query-federation/tree/master/athena-neptune
  2. Connecting to the data source - https://docs.aws.amazon.com/athena/latest/ug/connect-to-a-data-source-lambda.html#connect-to-a-data-source-lambda-connecting

However I am able to see table info when I run the following query but the actual select query does not work.

describe `datasource/datacatlogname`.<dbname>.<tablename>;

Cloudwatch logs:

java.lang.NullPointerException: java.lang.NullPointerException
java.lang.NullPointerException  at
com.amazonaws.athena.connectors.neptune.propertygraph.PropertyGraphHandler.executeQuery(PropertyGraphHandler.java:112)
at
com.amazonaws.athena.connectors.neptune.NeptuneRecordHandler.readWithConstraint(NeptuneRecordHandler.java:113)
at
com.amazonaws.athena.connector.lambda.handlers.RecordHandler.doReadRecords(RecordHandler.java:19 at
com.amazonaws.athena.connector.lambda.handlers.RecordHandler.doHandleRequest(RecordHandler.java:158)
at
com.amazonaws.athena.connector.lambda.handlers.CompositeHandler.handleRequest(CompositeHandler.java:138)
at
com.amazonaws.athena.connector.lambda.handlers.CompositeHandler.handleRequest(CompositeHandler.java:103)

Upvotes: 0

Views: 722

Answers (2)

user2026504
user2026504

Reputation: 84

I was able to find out the issue. When I was creating the table manually in console I was inserting separatorChar and componenttype under Serde parameters.

https://github.com/awslabs/aws-athena-query-federation/blob/master/athena-neptune/docs/aws-glue-sample-scripts/manual/sample-cli-script.sh

It should be under table properties.

enter image description here

Upvotes: 0

Abhishek Mishra
Abhishek Mishra

Reputation: 26

Check if the lambda configuration is setup properly to access the Neptune database. Make sure the lambda security group attached is properly setup to access the database

The connector is available in Serverless Application Reppository, try deploying from there

Upvotes: 0

Related Questions