Java Code Examples for org.apache.calcite.materialize.Lattice#getRowCount()
The following examples show how to use
org.apache.calcite.materialize.Lattice#getRowCount() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Profiler.java From calcite with Apache License 2.0 | 6 votes |
public double cardinality(ImmutableBitSet columnOrdinals) { final ImmutableBitSet originalOrdinals = columnOrdinals; for (;;) { final Distribution distribution = distributionMap.get(columnOrdinals); if (distribution != null) { if (columnOrdinals == originalOrdinals) { return distribution.cardinality; } else { final List<Double> cardinalityList = new ArrayList<>(); cardinalityList.add(distribution.cardinality); for (int ordinal : originalOrdinals.except(columnOrdinals)) { final Distribution d = singletonDistributionList.get(ordinal); cardinalityList.add(d.cardinality); } return Lattice.getRowCount(rowCount.rowCount, cardinalityList); } } // Clear the last bit and iterate. // Better would be to combine all of our nearest ancestors. final List<Integer> list = columnOrdinals.asList(); columnOrdinals = columnOrdinals.clear(Util.last(list)); } }
Example 2
Source File: FoodMartLatticeStatisticProvider.java From calcite with Apache License 2.0 | 5 votes |
@Override public double cardinality(List<Lattice.Column> columns) { final List<Double> cardinalityList = new ArrayList<>(); for (Lattice.Column column : columns) { cardinalityList.add((double) cardinality(column)); } return Lattice.getRowCount(lattice.getFactRowCount(), cardinalityList); }