Class JsonLattice

java.lang.Object
org.apache.calcite.model.JsonLattice

public class JsonLattice extends Object
Element that describes a star schema and provides a framework for defining, recognizing, and recommending materialized views at various levels of aggregation.

Occurs within JsonSchema.lattices.

See Also:
  • Field Details

    • name

      public final String name
      The name of this lattice.

      Required.

    • sql

      public final Object sql
      SQL query that defines the lattice.

      Must be a string or a list of strings (which are concatenated into a multi-line SQL string, separated by newlines).

      The structure of the SQL statement, and in particular the order of items in the FROM clause, defines the fact table, dimension tables, and join paths for this lattice.

    • auto

      public final boolean auto
      Whether to materialize tiles on demand as queries are executed.

      Optional; default is true.

    • algorithm

      public final boolean algorithm
      Whether to use an optimization algorithm to suggest and populate an initial set of tiles.

      Optional; default is false.

    • algorithmMaxMillis

      public final long algorithmMaxMillis
      Maximum time (in milliseconds) to run the algorithm.

      Optional; default is -1, meaning no timeout.

      When the timeout is reached, Calcite uses the best result that has been obtained so far.

    • rowCountEstimate

      public final @Nullable Double rowCountEstimate
      Estimated number of rows.

      If null, Calcite will a query to find the real value.

    • statisticProvider

      public final @Nullable String statisticProvider
      Name of a class that provides estimates of the number of distinct values in each column.

      The class must implement the LatticeStatisticProvider interface.

      Or, you can use a class name plus a static field, for example "org.apache.calcite.materialize.Lattices#CACHING_SQL_STATISTIC_PROVIDER".

      If not set, Calcite will generate and execute a SQL query to find the real value, and cache the results.

    • tiles

      public final List<JsonTile> tiles
      List of materialized aggregates to create up front.
    • defaultMeasures

      public final List<JsonMeasure> defaultMeasures
      List of measures that a tile should have by default.

      A tile can define its own measures, including measures not in this list.

      Optional. The default list is just "count(*)".

  • Constructor Details

  • Method Details

    • accept

      public void accept(ModelHandler handler)
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getSql

      public String getSql()
      Returns the SQL query as a string, concatenating a list of lines if necessary.
    • visitChildren

      public void visitChildren(ModelHandler modelHandler)