> ## Content Index
> Fetch the complete content index at: https://abundance.alloconomy.com/llms.txt
> Use this file to discover other available public pages before exploring further.

# What earns a row
- URL: https://abundance.alloconomy.com/alloconomy/de-interview-what-earns-a-row/
- Published: 2026-11-22T05:10:15.000Z
- Updated: 2026-11-22T16:30:43.000Z
- Description: A marketplace records a cart edit, an order acceptance, and a warehouse reservation for the same six books.
- Author: Sathya Narayanan
- Tags: Alloconomy, Data Engineering, Data Engineering Interview Field Guide, #web-only, #Import 2026-11-21 19:24, Grain and the star schema, #series-detail

1. [Collection · 10 seriesThe Data Engineering Interview Field Guide](https://abundance.alloconomy.com/alloconomy/data-engineering-interview-field-guide/)
2. [Series opening · 3 essaysGrain and the star schemaSeries 1 of 10](https://abundance.alloconomy.com/alloconomy/de-interview-what-earns-a-row/)
3. This essay1 of 3 · Opening

Data engineering · 3 essays

Grain and the star schema

Complete reading path · You are in Part 1 of 3
1. Part 1**What earns a row**Current essayA marketplace records a cart edit, an order acceptance, and a warehouse reservation for the same six books.
2. Part 2[Draw the first star](https://abundance.alloconomy.com/alloconomy/de-interview-draw-the-first-star/)A publisher asks for shipped units by title, warehouse region, and fiscal week.
3. Part 3[One order line in two parcels](https://abundance.alloconomy.com/alloconomy/de-interview-one-order-line-in-two-parcels/)Your first query reports twelve ordered units for a six-unit line.

## The interview prompt

A marketplace records a cart edit, an order acceptance, and a warehouse reservation for the same six books. A buyer wants tomorrow’s replenishment quantity. An operations manager wants tonight’s picking workload. Sketch the rows you would keep. Decide whether a retry or a change of mind earns a row.

## A record that survives a change of mind

Put three values on the board. At 09:00 the shopper puts eight books in a cart. At 09:03 the seller accepts six. At 09:05 the warehouse reserves four. Adding those quantities gives 18, even though only six books were ordered. The transitions are observations about different populations.

For a demand history I would start with one accepted order line per source and acceptance, retaining six units and the acceptance time. For picking, I would ask for the reservation or task stream and the warehouse responsible. Four reserved units are useful evidence of work the warehouse has taken on. Whether those units are ready to pick depends on the task definition. Two more may be owed even though there is no reservation to count.

Now let the school reduce its order to five. If the business asks “what did customers initially request?”, preserve the original acceptance and record a later reduction of one. If it asks “how many units do we owe now?”, apply the change against the obligation. A mutable current-state table supports the second question well. The first needs retained history. Ask whether the source can supply it before promising the metric.

## The model behind the answer

“Model orders” leaves the hard part open. Maya’s merchandising lead wants demand by the day customers placed their orders. Her warehouse lead wants units dispatched during each shift. Name the person who will act, the action they can take, and the event that supplies the number. The first lead can buy more field guides. The second can move a packer onto the evening shift.

The **grain** is the meaning of one row. For the first lead, use one accepted order line, with the quantity accepted and an order timestamp. For the second, use one order line represented in one dispatch event, with the quantity handed over and the dispatch timestamp. A tracking number alone may cover several order lines. Ask to see a source record that distinguishes the events you intend to count.

A useful follow-up is whether the carrier identifies each individual book. If the source records a dispatch of four copies, preserve that observation. Four synthetic book IDs would suggest a degree of traceability the warehouse never measured. [Kimball on grain](https://www.kimballgroup.com/data-warehouse-business-intelligence-resources/kimball-techniques/dimensional-modeling-techniques/grain/?ref=abundance.alloconomy.com)

## Give the agent a metric it can implement

Before handing over the ticket, write down who uses the number and the event that changes it. Give the coding agent the three bookstore records and ask it to draft a metric contract. Leave one question open for Maya: does a reduction from six to five revise original demand or change the outstanding obligation?

**Reviewer decision.** Review its proposed key by replaying the acceptance and then applying a genuine reduction. Under the original-demand definition the answer stays six both times. Under the obligation definition the results are six and five. If the specification produces one unnamed number, return it to the author before requesting SQL.

*Further reading.* [The Data Warehouse Toolkit](https://www.amazon.com/dp/1118530802?ref=abundance.alloconomy.com), 3rd ed., on declaring a business process and grain.

## One more question

A ride app shows three taps on Request and one confirmed ride. What are the legitimate counts?

Check your reasoning

Three taps can measure interface activity if each has a distinct occurrence. One accepted ride request can measure matched demand if the source identifies it. A retry carrying the same tap ID contributes nothing new. A rider who genuinely taps again produces another tap even when all three lead to one ride. A strong answer names both the decision and the event identity.

1. [Back to the series openingGrain and the star schemaSeries 1 of 10](https://abundance.alloconomy.com/alloconomy/de-interview-what-earns-a-row/)
2. [Explore the collectionThe Data Engineering Interview Field Guide](https://abundance.alloconomy.com/alloconomy/data-engineering-interview-field-guide/)

[Previous · Series map](https://abundance.alloconomy.com/alloconomy/data-engineering-interview-field-guide/) · [Next · Draw the first star](https://abundance.alloconomy.com/alloconomy/de-interview-draw-the-first-star/) · [Complete series map](https://abundance.alloconomy.com/alloconomy/data-engineering-interview-field-guide/)