- Newest
- Most votes
- Most comments
Can you share the query. I suspect it contains multiple joins results in large datasets and eventually requires lot of CPU and memory. Alternatively, it's possible the partitions are not done correctly. Are you able to run other queries on the same data source.
The INTERNAL_ERROR_QUERY_ENGINE error you're experiencing is an internal Athena error that occurs on the query engine side. This type of error is not typically caused by user input but rather by an issue within Athena's system itself.
There are several possible reasons this could have happened:
-
Temporary system issue: Sometimes these errors are transient and can be resolved by simply retrying the query.
-
Query complexity: If your query is particularly complex or resource-intensive, it might be pushing the limits of Athena's query engine.
-
Data issues: There could be unexpected issues with the data you're querying, such as corrupted files or inconsistencies in the data format.
-
Service disruption: There might be ongoing issues with the Athena service in your region.
To address this issue, you can try the following steps:
-
Retry the query: As mentioned, the error might be temporary and resolve itself on a subsequent attempt.
-
Simplify the query: If possible, try breaking down your query into smaller, simpler parts to identify if a specific section is causing the issue.
-
Check your data: Ensure that all tables referenced in your query exist and have the expected structure.
-
Verify permissions: Make sure your IAM user or role has the necessary permissions to access both the source data and the query results location.
-
Check Athena service status: Look for any reported issues with Athena in your region.
If the problem persists after trying these steps, you should contact AWS support for further assistance. They have access to more detailed logs and can investigate the root cause of the internal error.
Remember, you won't be charged for queries that result in this error, so don't hesitate to retry or experiment with query modifications to resolve the issue.
Sources
ErrorCode: INTERNAL_ERROR_QUERY_ENGINE | AWS re:Post
Athena Query: Encountered INTERNAL_ERROR_QUERY_ENGINE Error | AWS re:Post
ATHENA INTERNAL_ERROR_QUERY_ENGINE | AWS re:Post
answered a year ago
Relevant content
- AWS OFFICIALUpdated 9 months ago
- AWS OFFICIALUpdated 5 months ago

i have found which sentence cause the error, but i can not resolve it.
select 'xyz' as group_by_id ,array_distinct(flatten(array_agg(adchannel_time))) as adchannel_time from db.table group by 'xyz'
i guess the function "array_distinct" may cause the error. The column "adchannel_time" 's data type is array<string> .
problems resolved, when i downgrade the complexity of the query, it will run normally