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?

preguntada hace 2 meses97 visualizaciones
2 Respuestas
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
EXPERTO
respondido hace 2 meses
profile picture
EXPERTO
revisado hace 2 meses
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
respondido hace 2 meses

No has iniciado sesión. Iniciar sesión para publicar una respuesta.

Una buena respuesta responde claramente a la pregunta, proporciona comentarios constructivos y fomenta el crecimiento profesional en la persona que hace la pregunta.

Pautas para responder preguntas