QuestionQ242

VerifiedTroubleshooting and Tuning Apache Spark DataFrame API Applications.

A data engineer has found duplicate records in a Parquet table created by ingesting IoT data.

The table records use the following schema:

event_ts TIMESTAMP,  
sensor_id STRING,  
metric_value LONG,  
ingest_ts TIMESTAMP,  
source_file_path STRING  

When events are generated by each IoT sensor, they contain the fields event_ts, sensor_id, and metric value. The ingestion process appends the ingest_ts and source_file_path fields to every record. Analysis indicates that the ingestion process is creating duplicate records.

Explanation

The unique identity of an IoT event is represented by its source event fields: event_ts, sensor_id, and metric_value. Because ingest_ts and source_file_path are added during ingestion, they can vary when the same event is ingested more than once. Deduplicating on only the source event fields removes repeated ingestions of the same event.

Community Discussion

No comments yet. Be the first to start the discussion!