Calcite - Field

Card Puncher Data Processing

About

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

RelDataType represents fields in a table (data set) - the data type of an object. Include structs and arrays

Addressing

Multiple input

Example join between the input EMP and DEPT

join       
  /   \      
EMP   DEPT

The ordinal referencing is:

  • 0=EMP
    • 0=EMPNO,
    • 1=ENAME,
    • 2=JOB,
    • 3=MGR,
    • 4=HIREDATE,
    • 5=SAL,
    • 6=COMM,
    • 7=DEPTNO]
  • 1=DEPT
    • 0=DEPTNO,
    • 1=DNAME,
    • 2=LOC

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:

  • 2 means that there are two inputs (How deep to search in the stack)
  • 0 or EMP design the input
  • 5 or SAL design the field





Discover More
Card Puncher Data Processing
Calcite - (Row|Scalar) Expression (RexNode)

Expression that return a scalar (ie one value). Many of them returns data from the stack (the complete relational expression). They implements RexNode...
Card Puncher Data Processing
Calcite - Join

in Calcite. Join is a calcite relational operator (RelNode) Example field addressing in a join between the input EMP and DEPT The ordinal referencing is: 0=EMP 0=EMPNO, 1=ENAME, 2=JOB,...
Card Puncher Data Processing
Calcite - Table

A table represents a single data set with fields. org/apache/calcite/schema/Table where: RelDataType are



Share this page:
Follow us:
Task Runner