- Newest
- Most votes
- Most comments
The error you're encountering indicates a data type mismatch between your Parquet file and the table schema definition. The specific issue is that the field "sales" is stored as INT32 in the Parquet file, but it's defined as VARCHAR in your table schema.
There appears to be a contradiction in your Parquet metadata - while the Type is listed as "INT32", the Converted_type is listed as "UTF8" (which corresponds to a string/varchar type). This mixed typing is likely causing the confusion.
Here are some approaches to resolve this issue:
-
Update the table schema: Ensure your table definition matches the actual data type in the Parquet file. Since the field is stored as INT32, modify your table definition to use INTEGER instead of VARCHAR for the sales column.
-
Check schema consistency: Verify that all your Parquet files have consistent schemas. It's possible that different files in your dataset have different schemas, causing intermittent errors.
-
Use CAST in your query: As a temporary workaround, you can use a CAST function in your SELECT statement to convert between types.
-
Recreate the table: You could use a CREATE TABLE AS SELECT (CTAS) query to create a new table with the correct schema while converting the data types as needed.
-
Investigate your ETL process: There might be an issue in how the data is being processed or converted before being written to Parquet format. The "Converted_type" being set to "UTF8" while the main type is "INT32" suggests there might be a conversion issue in your data pipeline.
Note that Hive has had issues with Parquet type compatibility in the past. For example, Amazon EMR 6.9.0 included a backport fix for "HIVE-21987: Hive is unable to read Parquet int32 annotated with decimal," which addressed a similar type of incompatibility issue.
Sources
Incompatible Issue with timestamp | AWS re:Post
Amazon EMR 6.9.0 - Hive release notes - Amazon EMR
field data type INT32 is incompatible with type varchar defined in table schema, when selecting random samples | AWS re:Post
answered a year ago
Relevant content
asked 4 years ago
asked 3 years ago
- AWS OFFICIALUpdated 2 years ago
