public class Lattice extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
Lattice.BaseColumn
Column in a lattice.
|
static class |
Lattice.Builder
Lattice builder.
|
static class |
Lattice.Column
Column in a lattice.
|
static class |
Lattice.DerivedColumn
Column in a lattice that is based upon a SQL expression.
|
static class |
Lattice.Measure
A measure within a
Lattice. |
static class |
Lattice.SqlWriter
The information necessary to convert a column to SQL.
|
static class |
Lattice.Tile
Materialized aggregate within a lattice.
|
static class |
Lattice.TileBuilder
Tile builder.
|
| Modifier and Type | Field and Description |
|---|---|
boolean |
algorithm |
long |
algorithmMaxMillis |
boolean |
auto |
com.google.common.collect.ImmutableList<Lattice.Column> |
columns |
com.google.common.collect.ImmutableListMultimap<Integer,Boolean> |
columnUses |
com.google.common.collect.ImmutableList<Lattice.Measure> |
defaultMeasures |
LatticeRootNode |
rootNode |
CalciteSchema |
rootSchema |
double |
rowCountEstimate |
LatticeStatisticProvider |
statisticProvider |
com.google.common.collect.ImmutableList<Lattice.Tile> |
tiles |
| Modifier and Type | Method and Description |
|---|---|
static Lattice.Builder |
builder(CalciteSchema calciteSchema,
String sql) |
Iterable<? extends Lattice.Tile> |
computeTiles() |
String |
countSql(ImmutableBitSet groupSet)
Returns a SQL query that counts the number of distinct values of the
attributes given in
groupSet. |
static Lattice |
create(CalciteSchema schema,
String sql,
boolean auto)
Creates a Lattice.
|
Lattice.SqlWriter |
createSqlWriter(SqlDialect dialect,
StringBuilder buf,
IntFunction<SqlNode> field)
Creates a context to which SQL can be generated.
|
StarTable |
createStarTable() |
int |
firstColumn(String tableAlias)
Returns the ordinal, within all of the columns in this Lattice, of the
first column in the table with a given alias.
|
double |
getFactRowCount()
Returns an estimate of the number of rows in the un-aggregated star.
|
static double |
getRowCount(double factCount,
double... columnCounts)
Returns an estimate of the number of rows in the tile with the given
dimensions.
|
static double |
getRowCount(double factCount,
List<Double> columnCounts)
Returns an estimate of the number of rows in the tile with the given
dimensions.
|
double |
getRowCount(List<Lattice.Column> columns)
Returns an estimate of the number of rows in the tile with the given
dimensions.
|
boolean |
isAlwaysMeasure(Lattice.Column column)
Returns whether every use of a column is as an argument to a measure.
|
String |
sql(ImmutableBitSet groupSet,
boolean group,
List<Lattice.Measure> aggCallList)
Generates a SQL query to populate a tile of the lattice specified by a
given set of columns and measures, optionally grouping.
|
String |
sql(ImmutableBitSet groupSet,
List<Lattice.Measure> aggCallList)
Generates a SQL query to populate a tile of the lattice specified by a
given set of columns and measures.
|
Set<LatticeTable> |
tables()
Returns the set of tables in this lattice.
|
List<Lattice.Measure> |
toMeasures(List<AggregateCall> aggCallList) |
String |
toString() |
List<String> |
uniqueColumnNames() |
public final CalciteSchema rootSchema
public final LatticeRootNode rootNode
public final com.google.common.collect.ImmutableList<Lattice.Column> columns
public final boolean auto
public final boolean algorithm
public final long algorithmMaxMillis
public final double rowCountEstimate
public final com.google.common.collect.ImmutableList<Lattice.Measure> defaultMeasures
public final com.google.common.collect.ImmutableList<Lattice.Tile> tiles
public final LatticeStatisticProvider statisticProvider
public static Lattice create(CalciteSchema schema, String sql, boolean auto)
public String sql(ImmutableBitSet groupSet, List<Lattice.Measure> aggCallList)
public String sql(ImmutableBitSet groupSet, boolean group, List<Lattice.Measure> aggCallList)
public Lattice.SqlWriter createSqlWriter(SqlDialect dialect, StringBuilder buf, IntFunction<SqlNode> field)
public String countSql(ImmutableBitSet groupSet)
groupSet.public StarTable createStarTable()
public static Lattice.Builder builder(CalciteSchema calciteSchema, String sql)
public List<Lattice.Measure> toMeasures(List<AggregateCall> aggCallList)
public Iterable<? extends Lattice.Tile> computeTiles()
public double getFactRowCount()
public double getRowCount(List<Lattice.Column> columns)
public static double getRowCount(double factCount,
double... columnCounts)
public static double getRowCount(double factCount,
List<Double> columnCounts)
public Set<LatticeTable> tables()
public int firstColumn(String tableAlias)
public boolean isAlwaysMeasure(Lattice.Column column)
For example, in the query
select sum(x + y), sum(a + b) from t group by x + y
the expression "x + y" is used once as an argument to a measure,
and once as a dimension.
Therefore, in a lattice created from that one query,
isAlwaysMeasure for the derived column corresponding to "x + y"
returns false, and for "a + b" returns true.
column - Column or derived columnCopyright © 2012-2022 Apache Software Foundation. All Rights Reserved.