Logical Data Modeling - Field in calcite.
You can reference a field (cell) by name or ordinal.
Ordinals are zero-based.
Each operator guarantees the order in which its output fields occur.
For example, Project returns the fields in the generated by each of the scalar expressions.
Once the unique field names have been assigned, the names are immutable.
If a relational expression has passed through several rewrite rules, the field names of the resulting expression might not look much like the originals. At that point it is better to reference fields by ordinal.
RelDataType represents fields in a table (data set) - the data type of an object. Include structs and arrays
Example join between the input EMP and DEPT
join
/ \
EMP DEPT
The ordinal referencing is:
To reference the field/column SAL (the field 5 of input 0)
builder.field(2, 0, "SAL")
// or
builder.field(2, "EMP", "SAL")
// or
builder.field(2, 0, 5)
where: