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달 전99회 조회
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달 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠