Amazon Athena HIVE_BAD_DATA: Error Parsing a column in the table: Cannot convert value of type String to a REAL value

0

On AWS Athena, query csv data then get error as below even though just select * from table

HIVE_BAD_DATA: Error Parsing a column in the table: Cannot convert value of type String to a REAL value

by the way select count(*) from table was success. how to solve this error?

已提问 2 个月前100 查看次数
2 回答
2

This error can occur in the following scenarios:

The data type defined in the table doesn't match the source data, or a single field contains different types of data. For suggested resolutions, see My Amazon Athena query fails with the error "HIVE_BAD_DATA: Error parsing field value for field x: For input string: "12312845691"" in the AWS Knowledge Center.

Null values are present in an integer field. One workaround is to create the column with the null values as string and then use CAST to convert the field in a query, supplying a default value of 0 for nulls. For more information, see When I query CSV data in Athena, I get the error "HIVE_BAD_DATA: Error parsing field value '' for field x: For input string: """ in the AWS Knowledge Center.

profile pictureAWS
专家
已回答 2 个月前
profile picture
专家
已审核 2 个月前
0

Hi Kyamada,

You can download the csv file, then check the column that you are querying to check if in the column it has a NULL or not-like NUMBER format (ex: a123).

The problem happen because of some values in column you are using is STRING but expected to NUMBER.

profile picture
已回答 2 个月前

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则