Class Lattice.Builder

java.lang.Object
org.apache.calcite.materialize.Lattice.Builder
Enclosing class:
Lattice

public static class Lattice.Builder extends Object
Lattice builder.
  • Constructor Details

    • Builder

      public Builder(org.apache.calcite.materialize.LatticeSpace space, CalciteSchema schema, String sql)
  • Method Details

    • auto

      public Lattice.Builder auto(boolean auto)
      Sets the "auto" attribute (default true).
    • algorithm

      public Lattice.Builder algorithm(boolean algorithm)
      Sets the "algorithm" attribute (default false).
    • algorithmMaxMillis

      public Lattice.Builder algorithmMaxMillis(long algorithmMaxMillis)
      Sets the "algorithmMaxMillis" attribute (default -1).
    • rowCountEstimate

      public Lattice.Builder rowCountEstimate(double rowCountEstimate)
      Sets the "rowCountEstimate" attribute (default null).
    • statisticProvider

      public Lattice.Builder statisticProvider(@Nullable String statisticProvider)
      Sets the "statisticProvider" attribute.

      If not set, the lattice will use Lattices.CACHED_SQL.

    • build

      public Lattice build()
      Builds a lattice.
    • resolveArgs

      public com.google.common.collect.ImmutableList<Lattice.Column> resolveArgs(@Nullable Object args)
      Resolves the arguments of a JsonMeasure. They must either be null, a string, or a list of strings. Throws if the structure is invalid, or if any of the columns do not exist in the lattice.
    • resolveColumn

      public Lattice.Column resolveColumn(Object name)
    • resolveMeasure

      public Lattice.Measure resolveMeasure(String aggName, boolean distinct, @Nullable Object args)
    • addMeasure

      public boolean addMeasure(Lattice.Measure measure)
      Adds a measure, if it does not already exist. Returns false if an identical measure already exists.
    • addTile

      public void addTile(Lattice.Tile tile)
    • column

      public Lattice.Column column(int table, int column)
    • expression

      public Lattice.Column expression(RexNode e, String alias, List<String> tableAliases)
      Adds a lattice column based on a SQL expression, or returns a column based on the same expression seen previously.
    • use

      public void use(Lattice.Column column, boolean measure)
      Records a use of a column.
      Parameters:
      column - Column
      measure - Whether this use is as an argument to a measure; e.g. "sum(x + y)" is a measure use of the expression "x + y"; "group by x + y" is not