Q&A-4Define feature event-time, created-time, and processing-time semantics.
Answer
I separate three clocks because they answer different questions: when the fact happened, when the platform learned it, and when a job touched it. For feature work I assume a feature store with offline training and online serving, records carrying event_time, an ingestion timestamp, and a job wall clock. The choice of clock is the feature's point-in-time contract.
Event time is the timestamp from the source domain: the payment was authorized at 10:00:00, the click happened at 10:00:04. A feature at time T uses only events with event_time <= T. That is the only clock that gives reproducible training/serving features, but it needs watermarks to decide when T is complete. In Flink SQL: WATERMARK FOR event_time AS event_time - INTERVAL '5' SECOND. In Spark Structured Streaming: withWatermark("event_time", "10 minutes"). In Beam/Dataflow: withAllowedLateness(Duration.standardMinutes(10)).
Created or ingestion time is when the platform first recorded the fact: Kafka broker append time when message.timestamp.type=LogAppendTime, or a connector-assigned ingest timestamp. A feature at T uses records known by T. This is the right clock for point-in-time training when source clocks are untrusted, but it is not the business event time. Flink's ingestion-time mode is event time with source-assigned timestamps and automatic watermarks.
Processing time is the wall clock of the job. A feature at T uses whatever has arrived by T. It has no bound on event-time skew, so it is fine for monitoring and approximate alerts, not for features that must be reproducible.
The mechanism that makes event time usable is the watermark. Take a 5-second delay and a 5-second tumbling window over event_time:
- e1
event_time=10:00:00arrives. Max seen is 10:00:00, watermark is 09:59:55. Window[10:00:00,10:00:05)has not fired. - e2
event_time=10:00:04arrives. Watermark is 09:59:59. - e3
event_time=10:00:02arrives. It is above the watermark, so it is accepted. Watermark stays 09:59:59. - e4
event_time=10:00:10arrives. Watermark becomes 10:00:05, which passes the window end, so the window fires with count 3: e1, e2, e3. - e5
event_time=10:00:03arrives after that. It is below the watermark, so it is late: dropped or sent to a side output. The window already emitted 3.
That trace is the trade-off. Event time buys correctness at the cost of waiting for the watermark and holding state. Processing time buys latency but joins drift: if stream A's 10:00:00 event arrives at processing 10:00:00 and stream B's 10:00:00 event arrives at processing 10:00:30, a processing-time join on a 5-second window misses B; a 30-second processing-time window matches records 30 seconds apart in event time. Ingestion time sits in between: it does not trust source clocks, but it is still bounded by platform append and watermark policy.
Failure modes I would watch:
- Temporal leakage. Training rows use a feature computed after the label event. Detection:
max(feature_created_time) > label_event_timefor any row. Cost: offline AUC looks good, online drops. - Silent late drops. Flink's
numLateRecordsDroppedmetric is above zero, or feature counts are lower than a batch backfill. Cost: the model sees stale counts. - Clock skew. One host's clock is 5 minutes fast, so its
event_timejumps the watermark and drops valid data. Detection: compareevent_time - ingest_timeper host; alert when p99 exceeds the watermark delay. - Processing-time join drift. Matched pairs have large event-time skew. Detection: histogram
abs(a.event_time - b.event_time)for joined records.
| Semantics | Timestamp source | Bound on lateness | Reproducible | Typical use |
|---|---|---|---|---|
| Event time | record payload | watermark delay | yes | training/serving features |
| Created/ingestion | Kafka LogAppendTime or connector | platform append + watermark | mostly | point-in-time when source clocks untrusted |
| Processing time | job wall clock | none | no | monitoring, approximate alerts |
If the feature feeds training and serving, I use event time or ingestion time with a point-in-time join and an explicit late-data policy. If it only drives a dashboard, processing time is cheaper and faster.
Curated: · Written: · Reviewed:
Log in free to save your progress and keep bookmarks and notes for a quick revision before your interview.