By using AWS re:Post, you agree to the Terms of Use
/Athena : HIVE_BAD_DATA/



I got this error after loading a parquet file from S3 into Athena. HIVE_BAD_DATA: Field metadata_file's type BINARY in parquet file s3://dil-google-books/data/dataset.parquet/part-00108-33efb610-5e72-4e37-b646-3b4ab4578bad-c000.snappy.parquet is incompatible with type boolean defined in table schema

Could you please suggest what I need to do?

  AccessDate string,
  Authors string,
  Chapter string,
  Chron string,
  City string,
  Degree string,
  Edition string,
  Encyclopedia string,
  Format string,
  ID_list string,
  Issue string,
  Pages string,
  Periodical string,
  PublicationPlace string,
  PublisherName string,
  Series string,
  SeriesNumber string,
  Title string,
  TitleType string,
  URL string,
  Volume string,
  citations string,
  id int,
  page_title string,
  r_id int,
  r_parentid int,
  sections string,
  type_of_citation string,
  updated_identifier array <string> ,
  conf_score array <double>)
tblproperties ("parquet.compress"="SNAPPY");
asked 4 months ago7 views
2 Answers

There are several versions of the HIVE_BAD_DATA error. One reason might be because The data type defined in the table definition doesn't match the actual source data and another reason might be a single field contains different types of data (for example, a boolean value for one record and a decimal value for another record).

In your case, you need to change the type in the schema to the appropriate data type (in your case it's binary).

I would suggest you format your data in AWS Glue (ETL Programming) then you can load into Athena Via Glue Data Catalog or directly from query.

Ref Links:

answered 4 months ago
reviewed 4 months ago

As per my understanding you have some files where the column is typed as binary and some where it is typed as boolean. When you type the column of the table as boolean Athena will eventually read a file where the corresponding column is boolean and throw this error, and vice versa.The solution is to make sure your files all have the same schema.

answered 4 months 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