Class 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.

    • 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.
    • Constructor Detail

      • StarTable

        private StarTable​(Lattice lattice,
                          com.google.common.collect.ImmutableList<Table> tables)
        Creates a StarTable.
    • Method Detail

      • of

        public static StarTable of​(Lattice lattice,
                                   java.util.List<Table> tables)
        Creates a StarTable and registers it in a schema.
      • 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 interface Table
        Parameters:
        typeFactory - Type factory with which to create the type
        Returns:
        Row type
      • columnOffset

        public int columnOffset​(Table table)
        Returns the column offset of the first column of table 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