Reviewed by Aditya Kumar · Last reviewed 2026-03-24
**SQL**: SELECT product_id, store_id, sale_date, amount, SUM(amount) OVER (PARTITION BY product_id, store_id ORDER BY sale_date ROWS UNBOUNDED PRECEDING) AS cumulative_sales FROM sales. **Spark**:...
Pro-Move: 'We had duplicate sale_dates—used ROWS UNBOUNDED PRECEDING for deterministic order; RANGE was non-deterministic.' Red Flag: Using RANGE with duplicates—undefined order; use ROWS.
SQL: SELECT product_id, store_id, sale_date, amount, SUM(amount) OVER (PARTITION BY product_id, store_id ORDER BY sale_date ROWS UNBOUNDED PRECEDING) AS cumulative_sales FROM sales. Spark: Window.partitionBy('product_id','store_id').orderBy('sale_date').rowsBetween(Window.unboundedPreceding, Window.currentRow). Why: Running total for YTD, progress. Best practice: Ensure sale_date uniqueness per partition or use ROWS for determinism.
Pro-Move: 'We had duplicate sale_dates—used ROWS UNBOUNDED PRECEDING for deterministic order; RANGE was non-deterministic.' Red Flag: Using RANGE with duplicates—undefined order; use ROWS.
According to DataEngPrep.tech, this is one of the most frequently asked General/Other interview questions, reported at 1 company. DataEngPrep.tech maintains an editor-reviewed database of 1,863 data engineering interview questions across 7 categories.