QuestionQ141

VerifiedCost & Performance Optimisation

A nightly batch job is set up to ingest every data file from a cloud object-storage container, where records are organized in the nested directory structure YYYY/MM/DD. The data for each date contains all records processed by the source system on that date, although some records can be delayed while awaiting moderator approval. Each entry is a product review by a user and has this schema:

user_id STRING, review_id BIGINT, product_id BIGINT, review_timestamp TIMESTAMP, review_text STRING

The ingestion job appends all data for the preceding date to a target table, reviews_raw, whose schema is identical to the source system. The next pipeline step is a batch write that propagates all newly inserted records in reviews_raw to a table in which data is fully deduplicated, validated, and enriched.

Which solution minimizes compute costs for propagating this batch of data?

Explanation

A Structured Streaming read from an append-only Delta table processes source data incrementally. With a persistent checkpoint, the query records previously processed source offsets and resumes from that point, so a one-time trigger can run as a bounded batch while processing only new rows. This avoids rescanning historical reviews_raw data, which is particularly important because delayed approvals make timestamp-window filtering incomplete or unreliable.

Learn more

Community Discussion

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