HIVE_BAD_DATA: Error Parsing a column in the table: empty String

0

I have an error in athena when select double item.(only a specific field) at some date, there's no error but most of dates I got the error.

HIVE_BAD_DATA: Error Parsing a column in the table: empty String

I migrated data using appflow and cralwed as table using aws glue. please let me know the reason of this error and how to solve it

asked a year ago918 views
2 Answers
0

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
profile picture
EXPERT
answered a year ago
  • Thank you for the answer:) I tried this but I got an error because trim cannot be applied to double.

0

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.

AWS
SUPPORT ENGINEER
answered a year ago

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