Este contenido no está disponible en el idioma seleccionado
Trabajamos constantemente para que el contenido esté disponible en el idioma seleccionado. Gracias por tu paciencia.
Why does my Athena query fail with the error "HIVE_PARTITION_SCHEMA_MISMATCH"?
2 minutos de lectura
0
When I run my Amazon Athena query on a partitioned table, the query fails with the error "HIVE_PARTITION_SCHEMA_MISMATCH."
Short description
When you run a query on an Athena partitioned table, Athena validates the table schema and the schema of its partitions in the AWS Glue Data Catalog. The validation compares the column data types in order and makes sure that the column data types match for the columns that overlap. A new partition usually inherits the schema of the associated table. However, certain scenarios can cause the schemas to differ over time. When the data type for a column in the partition schema does not match the corresponding column data type in the table schema, your query fails with the error "HIVE_PARTITION_SCHEMA_MISMATCH."
You can resolve this error with either of the following approaches:
If you used an AWS Glue crawler to create the table, then configure the AWS Glue crawler to update the partition schema.
If you created the table manually, then use an Athena data definition language (DDL) statement to drop the affected partition and recreate the partition.
Resolution
Configure the AWS Glue crawler to update the partition schema
Run the ALTER TABLE ADD PARTITION command to recreate the dropped partition. Note: If your table uses Hive-compatible partitions, you can run the MSCK REPAIR TABLE command to recreate the dropped partition.