Why do we get the error "GENERIC_INTERNAL_ERROR: nanos is negative" from Athena sometimes?

0

Every once in a while we see the error "GENERIC_INTERNAL_ERROR: nanos is negative" from Athena.

Simply re-running the query results in a successful response which suggests to us that this is a problem with the Athena service. If our underlying data was the problem we would be able to replicate the problem afterwards which is not the case.

An example query that randomly fails with the above error is this:

select * from [TABLE] where (date(changed) >= date '2023-08-01' and date(changed) < date '2023-08-02') or (date(created) >= date '2023-08-01' and date(created) < date '2023-08-02') order by changed, created

We have seen this with 2 queries. One with execution id "e96fae43-72d0-42e9-ae25-b1914945f656" and one with id "627fb736-fa84-41b3-80d0-e2caf205e908".

Kind regards

Daniel

asked 10 months ago246 views
1 Answer
1

Hi,

this kind of error usually comes when the date / timestamp supplied is incorrect and turns the number of corresponding nanoseconds (=nanos) to a negative number given its format.

So, I guess that you have figure out if some values of your 'changed' and 'created' are not too big for the format that you have chosen and turn corresponding values to negative ones. If possible, declare those 'changed' and 'created' as unsigned formats in order to increase the range of their possible values.

Best

Didier

profile pictureAWS
EXPERT
answered 10 months ago
  • Thanks you for the answer :)

    The columns created and changed will always hold timestamps back in time so I'm not sure how they could be too big to extract the data.

    More importantly though, how does this explain that I am able to run the query at any later point without reproducing the error?

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions