Class JsonLattice


  • public class JsonLattice
    extends java.lang.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:
    Description of schema elements
    • Field Summary

      Fields 
      Modifier and Type Field Description
      boolean algorithm
      Whether to use an optimization algorithm to suggest and populate an initial set of tiles.
      long algorithmMaxMillis
      Maximum time (in milliseconds) to run the algorithm.
      boolean auto
      Whether to materialize tiles on demand as queries are executed.
      java.util.List<JsonMeasure> defaultMeasures
      List of measures that a tile should have by default.
      java.lang.String name
      The name of this lattice.
      java.lang.Double rowCountEstimate
      Estimated number of rows.
      java.lang.Object sql
      SQL query that defines the lattice.
      java.lang.String statisticProvider
      Name of a class that provides estimates of the number of distinct values in each column.
      java.util.List<JsonTile> tiles
      List of materialized aggregates to create up front.
    • Constructor Summary

      Constructors 
      Constructor Description
      JsonLattice()  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void accept​(ModelHandler handler)  
      private static java.lang.String concatenate​(java.util.List list)
      Converts a list of strings into a multi-line string.
      java.lang.String getSql()
      Returns the SQL query as a string, concatenating a list of lines if necessary.
      java.lang.String toString()  
      (package private) static java.lang.String toString​(java.lang.Object o)
      Converts a string or a list of strings to a string.
      void visitChildren​(ModelHandler modelHandler)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • name

        public java.lang.String name
        The name of this lattice.

        Required.

      • sql

        public java.lang.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 boolean auto
        Whether to materialize tiles on demand as queries are executed.

        Optional; default is true.

      • algorithm

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

        Optional; default is false.

      • algorithmMaxMillis

        public 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 java.lang.Double rowCountEstimate
        Estimated number of rows.

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

      • statisticProvider

        public java.lang.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 java.util.List<JsonTile> tiles
        List of materialized aggregates to create up front.
      • defaultMeasures

        public java.util.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 Detail

      • JsonLattice

        public JsonLattice()
    • Method Detail

      • toString

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

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

        static java.lang.String toString​(java.lang.Object o)
        Converts a string or a list of strings to a string. The list notation is a convenient way of writing long multi-line strings in JSON.
      • concatenate

        private static java.lang.String concatenate​(java.util.List list)
        Converts a list of strings into a multi-line string.
      • visitChildren

        public void visitChildren​(ModelHandler modelHandler)