Atul
Atul

Reputation: 185

AWS Athena query returns results in incorrect format when query is run again

The first time I ran the query, it returned 2 rows with columns names. I edited the table and added skip.header.line.count - 1 and reran(First time), but it returned same result with double inverted commas. Then reran again(Second time), and this changed everything.

First time Query run output: https://i.sstatic.net/k6T2O.png

Second time Query run output: https://i.sstatic.net/6Cxrf.png

Upvotes: 4

Views: 2298

Answers (1)

John Rotenstein
John Rotenstein

Reputation: 269151

The problem is that output files from Amazon Athena are being mixed-in with your source files.

To fix it, go to the Athena console and click Settings.

Then, change the Query result location to a different location that does not point to the location where you are storing the source data files.

The Query result location is where Athena stores the output of queries, in case you need the results again or want to use them as input to future queries.

Upvotes: 8

Related Questions