Class Lattice.Builder

  • Enclosing class:
    Lattice

    public static class Lattice.Builder
    extends java.lang.Object
    Lattice builder.
    • Field Detail

      • baseColumns

        private final com.google.common.collect.ImmutableList<Lattice.BaseColumn> baseColumns
      • columnsByAlias

        private final com.google.common.collect.ImmutableListMultimap<java.lang.String,​Lattice.Column> columnsByAlias
      • defaultMeasureSet

        private final java.util.SortedSet<Lattice.Measure> defaultMeasureSet
      • tileListBuilder

        private final com.google.common.collect.ImmutableList.Builder<Lattice.Tile> tileListBuilder
      • columnUses

        private final com.google.common.collect.Multimap<java.lang.Integer,​java.lang.Boolean> columnUses
      • algorithm

        private boolean algorithm
      • algorithmMaxMillis

        private long algorithmMaxMillis
      • auto

        private boolean auto
      • rowCountEstimate

        private java.lang.Double rowCountEstimate
      • statisticProvider

        private java.lang.String statisticProvider
      • derivedColumnsByName

        private java.util.Map<java.lang.String,​Lattice.DerivedColumn> derivedColumnsByName
    • Method Detail

      • 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​(java.lang.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
                                                                                   java.lang.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.
      • resolveColumnByAlias

        private Lattice.Column resolveColumnByAlias​(java.lang.String name)
        Looks up a column in this lattice by alias. The alias must be unique within the lattice.
      • resolveColumn

        public Lattice.Column resolveColumn​(java.lang.Object name)
      • resolveQualifiedColumn

        private Lattice.Column resolveQualifiedColumn​(java.lang.String table,
                                                      java.lang.String column)
      • resolveMeasure

        public Lattice.Measure resolveMeasure​(java.lang.String aggName,
                                              boolean distinct,
                                              @Nullable
                                              java.lang.Object args)
      • resolveAgg

        private SqlAggFunction resolveAgg​(java.lang.String aggName)
      • addMeasure

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

        public Lattice.Column expression​(RexNode e,
                                         java.lang.String alias,
                                         java.util.List<java.lang.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