내용으로 건너뛰기

Ingestion of nested JSON data missing

0

The JSON data with a nested structure is streamed into FireHose via a direct put over to S3 through a Glue schema that is configured. It has been noticed from querying via Athena or S3 files that only the nested JSON structure is missing, rather than the first layer.

The S3 store is in parquet format; viewing the data, no nested JSON is seen.

Any ideas on how to get the nested data ingested?

질문됨 2년 전548회 조회

1개 답변
0

This issue is likely related to how the nested JSON structure is being handled during the ingestion and conversion process. Here are a few suggestions to address the problem:

  1. Check your AWS Glue Data Catalog schema: Ensure that the schema created in AWS Glue Data Catalog accurately matches the input data structure, including the nested JSON elements. For nested JSON, use a STRUCT type in the schema that mirrors the structure of your JSON data. If the schema doesn't properly represent the nested structure, the converted data will not contain attributes that are not specified in the schema.

  2. Review your Firehose configuration: Make sure that the case sensitivity setting in your Firehose configuration is appropriate. If your JSON object has capital letters and the case sensitivity is set to false, it can lead to a mismatch in JSON keys after data transformation, causing missing data in the resulting Parquet object in the S3 bucket. To fix this, set the "deserializationOption: case.insensitive" to true in the Firehose configuration.

  3. Use appropriate AWS Glue ETL techniques: If you're using AWS Glue for ETL processes, consider using the 'relationalize' function to convert nested JSON columns into separate columns in your AWS Glue ETL job. Alternatively, you can use the 'jsonPath' option in your AWS Glue ETL job configuration's format option values. Another option is to use the 'unnest' function to convert nested fields into top-level objects.

  4. Create a custom JSON classifier: If your AWS Glue crawler needs to read nested columns, create a custom classifier defined as a JSON classifier. Then, create a new AWS Glue crawler and add this custom JSON classifier to its list of classifiers.

  5. Check Firehose record format conversion: If you're using Firehose's record format conversion feature to convert JSON to Parquet, ensure that the deserializer (e.g., OpenX JSON SerDe) is configured correctly to handle your specific JSON structure, including any nested elements.

Further, If you want to handle nested json data that is retrieved successfully in athena, You can also use https://docs.aws.amazon.com/athena/latest/ug/extracting-data-from-JSON.html

By implementing these suggestions, you should be able to properly ingest and preserve the nested JSON structure in your Parquet files on S3, making the full data structure available for querying via Athena or direct S3 access.

Sources
Process JSON files in AWS Glue | AWS re:Post
Convert input data format in Amazon Data Firehose - Amazon Data Firehose
Common issues - Amazon Data Firehose

답변함 2년 전

AWS
지원 엔지니어

검토됨 2년 전

AWS
지원 엔지니어

수정됨 2년 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

관련 콘텐츠