- Newest
- Most votes
- Most comments
The issue you're experiencing with the ICEBERG_BAD_DATA error when running a MERGE INTO operation on a table filled by Amazon Data Firehose is not a documented behavior. It appears that there might be an issue with how the data is being written to the Iceberg table by Firehose.
The error message suggests that there are duplicate entries for the hidden metadata columns _pos and $row_id.pos, which are used internally by Iceberg for managing row positions. This duplication shouldn't occur under normal circumstances.
Since the CTAS operation and subsequent MERGE INTO worked without issues, it's likely that the problem lies in how Firehose is writing data to the Iceberg table. Here are a few things to consider:
-
Ensure that you have properly configured the Firehose delivery stream for Iceberg tables. Pay special attention to the DestinationTableConfiguration, particularly the UniqueKeys setting if you're performing updates or deletes.
-
Check if you have specified the correct buffering hints and processing configurations for your Firehose stream. Improper buffering or processing might lead to unexpected behavior.
-
Verify that the schema of your source data (from Kinesis and DynamoDB) matches the schema of your Iceberg table. Any mismatches could potentially cause issues.
-
If you're using a Lambda function for transformation between your source and Firehose, ensure that it's not introducing any duplicates or unexpected data.
-
Review your Firehose error logs and CloudWatch metrics to see if there are any indications of issues during data delivery.
-
Consider reaching out to AWS support, as this behavior seems unusual and might be a bug in the Firehose Iceberg integration.
To resolve the issue, you might want to try recreating the table and redelivering the data through Firehose with careful attention to the configuration. If the problem persists, using the CTAS method you've discovered as a workaround could be a temporary solution while you investigate further with AWS support.
Sources
IcebergDestinationUpdate - Amazon Data Firehose
IcebergDestinationDescription - Amazon Data Firehose
Amazon Data Firehose delivers data streams into Apache Iceberg format tables in Amazon S3 - AWS
DestinationTableConfiguration - Amazon Data Firehose
Route incoming records to different Iceberg tables - Amazon Data Firehose
answered 2 years ago
Relevant content
- AWS OFFICIALUpdated 2 months ago
- AWS OFFICIALUpdated 2 years ago
