1. A data engineer is using a StreamingQueryListener to monitor a Structured Streaming job. In the `onQueryProgress` callback, they observe that `inputRowsPerSecond` is consistently near zero while `processedRowsPerSecond` is also near zero, but the `batchDuration` metric is very high (over 45 seconds per batch). The source is a Kafka topic that is confirmed to have active producers. What does this pattern MOST LIKELY indicate?
- A. The streaming job has no active trigger configured and is defaulting to once-per-day processing
- B. The Kafka consumer group is being rebalanced repeatedly, causing the streaming source to pause consumption
- C. The bottleneck is in the stateful transformation or sink write phase—the job is spending most of each batch duration processing or writing, not reading from Kafka✓ Correct
- D. The StreamingQueryListener is capturing stale metrics from a previous query run that was not properly stopped
Explanation
When `inputRowsPerSecond` is near zero but `batchDuration` is very high, the Kafka source itself is not the bottleneck—instead, each batch is taking a long time to complete even with minimal new input. This indicates the processing logic (e.g., a complex stateful aggregation, large state store checkpoint, or slow sink write such as a Delta MERGE) is consuming most of the batch time. Option A is incorrect; Structured Streaming defaults to a continuous micro-batch trigger, not once-per-day. Option B (Kafka rebalance) would typically manifest as failed batches, exceptions in the query progress, or an `inputRowsPerSecond` of exactly zero with source lag growing—not a consistently high `batchDuration`. Option D is implausible because a stopped query would not continue emitting `onQueryProgress` events.