- Newest
- Most votes
- Most comments
The issue you're experiencing is that your JSON records in each file are not properly delimited for the Glue crawler to recognize them as separate records. When Glue crawler processes JSON files, it expects each JSON object to be separated by a newline character.
In your case, the JSON objects in your files are concatenated without any delimiter between them:
{"eventType": "newTicker", "ticker": "JNJ"...}{"eventType": "newTicker", "ticker": "PFE"...}
This is a common issue when using Kinesis Data Firehose to deliver data to S3. By default, Firehose doesn't add delimiters between records.
To fix this issue, you need to configure your Kinesis Data Firehose delivery stream with a ProcessingConfiguration that adds a delimiter between records. Specifically, you need to add an AppendDelimiterToRecord processor to your Firehose configuration.
Here's how you can modify your Firehose configuration:
ProcessingConfiguration:
Enabled: True
Processors:
- Type: AppendDelimiterToRecord
After making this change, Firehose will append a newline character after each record, resulting in files that look like:
{"eventType": "newTicker", "ticker": "JNJ"...}
{"eventType": "newTicker", "ticker": "PFE"...}
With this format, the Glue crawler will be able to correctly identify each JSON object as a separate record, and your Athena queries will return the expected number of rows.
Sources
Community | Serverless statistics solution with Lambda@Edge
answered a year ago
You will need to use "Multi record deaggregation" in your destination setting for Firehose. Please refer to this documentation for more information: https://docs.aws.amazon.com/firehose/latest/dev/create-destination.html#create-destination-s3:~:text=configure%20dynamic%20partitioning.-,Multi%20record%20deaggregation,-This%20is%20the
Multi record deaggregation is specifically designed for this scenario. It "parses through the records in the Firehose stream and separating them based either on valid JSON or on the specified new line delimiter".
answered a year ago
Relevant content
- AWS OFFICIALUpdated 2 years ago

I am not using Dynamic partitioning, so this feature is not applicable here.