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

已提問 1 年前檢視次數 975 次
2 個答案
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
專家
已回答 1 年前
  • 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
支援工程師
已回答 1 年前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南