Calcite - Projection relational operator

About

Features

  • name expressions using alias(expr, fieldName)

Example

final RelNode node = builder
  .scan("EMP")
  .project(builder.field("DEPTNO"), builder.field("ENAME"))
  .build();
System.out.println(RelOptUtil.toString(node));
LogicalProject(DEPTNO=[$7], ENAME=[$1])
  LogicalTableScan(table=[[scott, EMP]])

equivalent to:

SELECT ename, deptno
FROM scott.EMP;

builder.field create simple expressions that return the fields from the input relational expression (ie the TableScan) by ordinal (order)

  • ie $7 (column at the position 7)
  • and $1 (column at the position 1)

Documentation / Reference


Powered by ComboStrap