Depends on: Data Schema
RFCs: RFC-001, RFC-015
Abstract
This spec defines how data of a dataset is represented in memory and at rest, the system columns that all data in ODF carries to support the bitemporal event model, the changelog representation of retractions and corrections, and the rules according to which a dataset’s schema is allowed to evolve over time.In-memory and On-disk Formats
We differentiate two data formats by their purpose:- In-memory format - used when passing data around between the subsystems (e.g. when communicates with the ).
- On-disk format - used for data at rest and by query engines when querying data from the entire dataset.
- Purposefully designed for minimal overhead interoperability between data processing systems
- Minimizes copying of data
- Hardware efficient
- Supports streaming
- Fast to decode into Apache Arrow
- Space and IO efficient thanks to the built-in compression
- Efficient for querying thanks to the columnar structure and built-in basic indexing
Common Data Schema
All data in the system is guaranteed to have the following columns:
Representation:
TODO:
- We are not allowing non-UTC-adjusted timestamps yet as Parquet does not offer a way to encode the timezone, meaning we need a reliable way to pass timezone information between different engines through some other means (e.g. Parquet metadata). Having naive/local timestamps without enforcing that they are accompanied by the specific timezone would be too error-prone.
Representation of Retractions and Corrections
are differentiated from regular in the via specialop column, carrying an .
Valid operation types are:
The
retract and correct-from events must carry the same exact data fields (all fields excluding offset, op, and system_time) as the event that is being retracted.
The correct-to event carries the new values for the event being corrected. This event must immediately follow the correct-from event. This model allows data engines that operate on changelog / diff events that simultaneously carry both old and new values for event during a correction to reconstruct such events easily by sequentially reading the .
A pair of correct-from and correct-to events must belong to the same - they cannot span across slices.
The order of records in a dataset, as defined by their , is significant: a retraction or correction always follows the event it applies to, and correction pairs must stay adjacent. Records therefore must not be reordered (e.g. sorted by ) when they are processed or written, as that may produce an invalid stream.
Not every stream needs to use all operation types. The following are all valid subsets of this model:
- Append-only stream - contains only
appendevents - Retract stream - contains only
appendandretractevents, where a change of a previously published event is represented as its retraction followed by an append of the new value - Changelog stream - uses all operation types, differentiating retractions from corrections
Schema Evolution
may change when:- A different process is specified in the
- A transformation of the is changed
- A of one of the inputs of the changes