Athena Dynamodb ClassCastException

0

Error while fetching the data from dynamo db from athena

Error: GENERIC_USER_ERROR: Encountered an exception[java.lang.ClassCastException] from your LambdaFunction[arn:aws:lambda:ap-south-1:<Account_id>:function:dynamodbdata] executed in context[S3SpillLocation{bucket='<bucket>', key='athena-spill/d38cdaf7-7fb2-48b9-acc8-9139de2fe525/821dc5fc-f893-40f9-b25e-96b832e55c4a', directory=true}] with message[class java.lang.String cannot be cast to class java.math.BigDecimal (java.lang.String and java.math.BigDecimal are in module java.base of loader 'bootstrap')]

Tried using the try_cast but still seeing the issue

query id: 0a47ace5-b8fc-46cb-8ff5-23194925882e

demandé il y a un an231 vues
1 réponse
0

The error message suggests that the issue is related to a type conversion error when casting a java.lang.String to a java.math.BigDecimal. This can happen when the data types in the DynamoDB table do not match the data types specified in the Athena schema.

To resolve this issue, you may need to update the Athena schema to reflect the correct data types. You can use the CAST or TRY_CAST function in Athena to cast the data to the correct data type.

For example, if you have a column named my_column in your Athena schema that is supposed to be a DECIMAL data type, you could use the following query to cast the data to the correct type:

vbnet Copy code SELECT TRY_CAST(my_column as DECIMAL) FROM my_table; If you have already tried using TRY_CAST and are still experiencing issues, it's possible that there are other data type mismatches in your schema that are causing the issue. You may need to review the schema and data types in your DynamoDB table to ensure that they are consistent with the data types specified in the Athena schema.

AWS
répondu il y a un an

Vous n'êtes pas connecté. Se connecter pour publier une réponse.

Une bonne réponse répond clairement à la question, contient des commentaires constructifs et encourage le développement professionnel de la personne qui pose la question.

Instructions pour répondre aux questions