Package org.apache.calcite.schema.impl
Class StarTable
- java.lang.Object
-
- org.apache.calcite.schema.impl.AbstractTable
-
- org.apache.calcite.schema.impl.StarTable
-
- All Implemented Interfaces:
Table
,TranslatableTable
,Wrapper
public class StarTable extends AbstractTable implements TranslatableTable
Virtual table that is composed of two or more tables joined together.Star tables do not occur in end-user queries. They are introduced by the optimizer to help matching queries to materializations, and used only during the planning process.
When a materialization is defined, if it involves a join, it is converted to a query on top of a star table. Queries that are candidates to map onto the materialization are mapped onto the same star table.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
StarTable.StarTableScan
Relational expression that scans aStarTable
.
-
Field Summary
Fields Modifier and Type Field Description ImmutableIntList
fieldCounts
Number of fields in each table's row type.Lattice
lattice
com.google.common.collect.ImmutableList<Table>
tables
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description StarTable
add(Table table)
int
columnOffset(Table table)
Returns the column offset of the first column oftable
in this star table's output row type.Schema.TableType
getJdbcTableType()
Type of table.RelDataType
getRowType(RelDataTypeFactory typeFactory)
Returns this table's row type.static StarTable
of(Lattice lattice, java.util.List<Table> tables)
Creates a StarTable and registers it in a schema.RelNode
toRel(RelOptTable.ToRelContext context, RelOptTable table)
Converts this table into arelational expression
.-
Methods inherited from class org.apache.calcite.schema.impl.AbstractTable
getStatistic, isRolledUp, rolledUpColumnValidInsideAgg, unwrap
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.calcite.schema.Table
getStatistic, isRolledUp, rolledUpColumnValidInsideAgg
-
-
-
-
Field Detail
-
lattice
public final Lattice lattice
-
tables
public final com.google.common.collect.ImmutableList<Table> tables
-
fieldCounts
public ImmutableIntList fieldCounts
Number of fields in each table's row type.
-
-
Method Detail
-
of
public static StarTable of(Lattice lattice, java.util.List<Table> tables)
Creates a StarTable and registers it in a schema.
-
getJdbcTableType
public Schema.TableType getJdbcTableType()
Description copied from interface:Table
Type of table.- Specified by:
getJdbcTableType
in interfaceTable
- Overrides:
getJdbcTableType
in classAbstractTable
-
getRowType
public RelDataType getRowType(RelDataTypeFactory typeFactory)
Description copied from interface:Table
Returns this table's row type.This is a struct type whose fields describe the names and types of the columns in this table.
The implementer must use the type factory provided. This ensures that the type is converted into a canonical form; other equal types in the same query will use the same object.
- Specified by:
getRowType
in interfaceTable
- Parameters:
typeFactory
- Type factory with which to create the type- Returns:
- Row type
-
toRel
public RelNode toRel(RelOptTable.ToRelContext context, RelOptTable table)
Description copied from interface:TranslatableTable
Converts this table into arelational expression
.- Specified by:
toRel
in interfaceTranslatableTable
-
columnOffset
public int columnOffset(Table table)
Returns the column offset of the first column oftable
in this star table's output row type.- Parameters:
table
- Table- Returns:
- Column offset
- Throws:
java.lang.IllegalArgumentException
- if table is not in this star
-
-