- Newest
- Most votes
- Most comments
as an example if you have a column defined as a "double" in the schema but there's a record in your data that's an empty string, you'll get this error.
to solve this
Check Your Data Check Your Schema
or you can try another SQL server to remove spaces or other irrelevant data from the imported data
SELECT CASE
WHEN trim(column_name)='' THEN null
ELSE cast(column_name as double)
END as column_name
FROM table_name
Such error can occur when the table column with "double" data type is having an empty record value in it. Validate your data of the impacted column and replace the empty records with 0 or NULL using SQL statement syntax supported by Presto. Else, if possible you can also try changing the data type of the columns. Similar issues are highlighted in AWS knowledge center article 1 and article 2 also.
Hi Jaishu A, in my case I'm using a Crawler to update the schema from S3 json files, and in a record the attribute A is an object but in other record the attribute A is a string containing the word null. I'm using Athena for a logging solution but is very complicated to know if a new log meets the current Glue table structure because the objects into the log are created dynamically or every week add more services adding new logs with request an responses that changes the structure. I thing Athena is very restrictive with the structure and is a headache.
Relevant content
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 8 months ago
Thank you for the answer:) I tried this but I got an error because trim cannot be applied to double.