A query that runs by itself in Athena fails to run when I add CREATE TABLE table_name AS on top of it due to a 'GENERIC_INTERNAL_ERROR: field ended by ';': expected ';' but got 'id' at line 1...'

0

When I run the query (I have reduced the column names and airport codes in the query to reduce your scrolling time) below in Amazon Athena it runs and I get no problems or error messages:

SELECT
 "loc id", "runway id", "icao id", "length", "width", "surface type condition", "edge light intensity"
FROM
  "runway_db_athena"."runway"
WHERE
  "loc id" IN ('09J','14A','18A','1V6','22S','2I0','2R4');

However, whenever I then try to store this result as a temporary session table so I can perform joins on it with other queries and only have to download the results of those joins using this:

CREATE TABLE dash_runs_table AS
SELECT
     "loc id", "runway id", "icao id", "length", "width", "surface type condition", "edge light intensity"
    FROM
      "runway_db_athena"."runway"
    WHERE
      "loc id" IN ('09J','14A','18A','1V6','22S','2I0','2R4');

I end up with this:

GENERIC_INTERNAL_ERROR: field ended by ';': expected ';' but got 'id' at line 1: optional binary loc id. You may need to manually clean the data at location 's3://realagnifuegos3bucket/Athena-output/create%20dash_runs_table/2023/04/16/tables/230fe35a-e3fc-4b4c-aa46-b6c88efbd8f3' before retrying. Athena will not delete data in your account. This query ran against the "runway_db_athena" database, unless qualified by the query. Please post the error message on our forum or contact customer support with Query Id: 230fe35a-e3fc-4b4c-aa46-b6c88efbd8f3

I have absolutely no idea what's going on there^^, I am still quite new to AWS, BUT, I am fairly decent with SQL, so, I went back and changed that first , after "loc id" to a ; just to see what would happen and this is the Error Message I got back this:

Only one sql statement is allowed. Got: CREATE TABLE dash_runs_table AS SELECT "loc id"; "runway id", "icao id", blah blah blah

That^ is exactly what I was expecting to get, but not what I was hoping to get because that means I REALLY don't understand the error message! How is it expecting a semicolon, but then it complains when I give it one?

p.s. For the record, I also tried out my second temp table creating query which is extremely similar and the same thing happened! Here it is:

CREATE TABLE dash_air_scheds AS
SELECT "loc id", "schedule" FROM airport_schedules
WHERE  "loc Id" IN ('09J','14A','18A','1V6','22S','2I0','2R4');

And I got the same Error Message

GENERIC_INTERNAL_ERROR: field ended by ';': expected ';' but got 'id' at line 1: optional binary loc id. You may need to manually clean the data at location 's3://realagnifuegos3bucket/Athena-output/Unsaved/2023/04/16/tables/21f94497-b6bf-4755-ba7d-43d03ed9cc17' before retrying. Athena will not delete data in your account. This query ran against the "runway_db_athena" database, unless qualified by the query. Please post the error message on our forum or contact customer support with Query Id: 21f94497-b6bf-4755-ba7d-43d03ed9cc17

profile picture
asked a year ago119 views
No Answers

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