Unable to execute Amazon Athena User Defined Functions query from Sagemaker R kernel

0

I am trying to run an athena query in a Sagemaker R Kernel notebook. The query uses an external UDF function. This query works on athena console but gives the following error in the notebook.

Error in dbSendQuery(conn, statement, ...): Unable to retrieve JDBC result set
  JDBC ERROR: [Simba][JDBC](11300) A ResultSet was expected but not generated from query <query>. Query not executed. 

When I remove the following part of the query which uses external function, it works.

USING EXTERNAL FUNCTION get_hash_asin(page_id VARCHAR)
RETURNS INT 
LAMBDA '{arn}'

I have also added necessary lambda:invokeFunction permission to IAM user and notebook's role using the ref: https://docs.aws.amazon.com/athena/latest/ug/udf-iam-access.html

I am using RJDBC library for running queries using the ref: https://aws.amazon.com/blogs/machine-learning/accessing-data-sources-from-amazon-sagemaker-r-kernels/

How do I resolve this issue?

gefragt vor 5 Monaten189 Aufrufe
1 Antwort
0

Hi, can you try using dbSendUpdate(conn, statement, ...)?

RJDBC pre-dates the more recent DBI specification and uses a different function to access this functionality: RJDBC::dbSendUpdate(con, query), can find more info here.


*If you find this to be useful, please consider accepting answer.

AWS
avelizf
beantwortet vor 5 Monaten
  • Can you explain why we should use sendUpdate instead of getQuery? The query does not have update statements just select statements where I want to apply the external func to all cells and retrieve data. Also using dbSendUpdate does not return the result.

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen