org.apache.calcite.schema.Statistic Java Examples
The following examples show how to use
org.apache.calcite.schema.Statistic.
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: ArrayTable.java From calcite with Apache License 2.0 | 5 votes |
public Statistic getStatistic() { final List<ImmutableBitSet> keys = new ArrayList<>(); final Content content = supplier.get(); for (Ord<Column> ord : Ord.zip(content.columns)) { if (ord.e.cardinality == content.size) { keys.add(ImmutableBitSet.of(ord.i)); } } return Statistics.of(content.size, keys, content.collations); }
Example #2
Source File: HrClusteredSchema.java From calcite with Apache License 2.0 | 5 votes |
@Override public Statistic getStatistic() { List<RelFieldCollation> collationFields = new ArrayList<>(); for (Integer key : pkColumns) { collationFields.add( new RelFieldCollation( key, RelFieldCollation.Direction.ASCENDING, RelFieldCollation.NullDirection.LAST)); } return Statistics.of(data.size(), ImmutableList.of(pkColumns), ImmutableList.of(RelCollations.of(collationFields))); }
Example #3
Source File: CompilerUtil.java From streamline with Apache License 2.0 | 5 votes |
private Statistic buildStatistic() { if (stats != null || primaryKey == -1) { return stats; } Direction dir = primaryKeyMonotonicity == INCREASING ? ASCENDING : DESCENDING; RelFieldCollation collation = new RelFieldCollation(primaryKey, dir, NullDirection.UNSPECIFIED); return Statistics.of(fields.size(), ImmutableList.of(ImmutableBitSet.of(primaryKey)), ImmutableList.of(RelCollations.of(collation))); }
Example #4
Source File: MaterializedDatasetTable.java From dremio-oss with Apache License 2.0 | 5 votes |
@Override public Statistic getStatistic() { return new StatisticImpl() { @Override public Double getRowCount() { return (double) datasetConfig.get().getReadDefinition().getScanStats().getRecordCount(); } @Override public List<RelReferentialConstraint> getReferentialConstraints() { return ImmutableList.of(); } }; }
Example #5
Source File: NamespaceTable.java From dremio-oss with Apache License 2.0 | 5 votes |
@Override public Statistic getStatistic() { return new StatisticImpl() { @Override public Double getRowCount() { return (double) dataset.getReadDefinition().getScanStats().getRecordCount(); } @Override public List<RelReferentialConstraint> getReferentialConstraints() { return ImmutableList.of(); } }; }
Example #6
Source File: MycatPhysicalTable.java From Mycat2 with GNU General Public License v3.0 | 5 votes |
@NotNull private Statistic createStatistic(Statistic parentStatistic) { return new Statistic() { @Override public Double getRowCount() { return StatisticCenter.INSTANCE.getPhysicsTableRow(backendTableInfo.getSchema(), backendTableInfo.getTable(), backendTableInfo.getTargetName()); } @Override public boolean isKey(ImmutableBitSet columns) { return parentStatistic.isKey(columns); } @Override public List<ImmutableBitSet> getKeys() { return parentStatistic.getKeys(); } @Override public List<RelReferentialConstraint> getReferentialConstraints() { return parentStatistic.getReferentialConstraints(); } @Override public List<RelCollation> getCollations() { return parentStatistic.getCollations(); } @Override public RelDistribution getDistribution() { return parentStatistic.getDistribution(); } }; }
Example #7
Source File: MycatPhysicalTable.java From Mycat2 with GNU General Public License v3.0 | 5 votes |
@Override public Statistic getStatistic() { if (statistic == null) { Statistic parentStatistic = logicTable.getStatistic(); statistic = createStatistic(parentStatistic); } return this.statistic; }
Example #8
Source File: SnapshotThreadStacksTable.java From mat-calcite-plugin with Apache License 2.0 | 5 votes |
@Override public Statistic getStatistic() { int counter = 0; for (IThreadStack threadStack : getThreadStacks()) { counter += threadStack.getStackFrames().length; } return Statistics.of(counter, ImmutableList.of(ImmutableBitSet.of(0, 1))); }
Example #9
Source File: MockCatalogReader.java From calcite with Apache License 2.0 | 5 votes |
public Statistic getStatistic() { return new Statistic() { public Double getRowCount() { return table.rowCount; } public boolean isKey(ImmutableBitSet columns) { return table.isKey(columns); } public List<ImmutableBitSet> getKeys() { return table.getKeys(); } public List<RelReferentialConstraint> getReferentialConstraints() { return table.getReferentialConstraints(); } public List<RelCollation> getCollations() { return table.collationList; } public RelDistribution getDistribution() { return table.getDistribution(); } }; }
Example #10
Source File: MycatLogicTable.java From Mycat2 with GNU General Public License v3.0 | 5 votes |
private Statistic createStatistic(ImmutableList<ImmutableBitSet> immutableBitSets) { return new Statistic() { public Double getRowCount() { return StatisticCenter.INSTANCE.getLogicTableRow(table.getSchemaName(),table.getTableName()); } public boolean isKey(ImmutableBitSet columns) { return immutableBitSets.contains(columns); } public List<ImmutableBitSet> getKeys() { return immutableBitSets; } public List<RelReferentialConstraint> getReferentialConstraints() { return ImmutableList.of(); } public List<RelCollation> getCollations() { return ImmutableList.of(); } public RelDistribution getDistribution() { return RelDistributionTraitDef.INSTANCE.getDefault(); } }; }
Example #11
Source File: ReflectiveSchema.java From calcite with Apache License 2.0 | 4 votes |
public Statistic getStatistic() { return Statistics.UNKNOWN; }
Example #12
Source File: ReflectiveSchema.java From calcite with Apache License 2.0 | 4 votes |
@Override public Statistic getStatistic() { return statistic; }
Example #13
Source File: ReflectiveSchema.java From calcite with Apache License 2.0 | 4 votes |
FieldTable(Field field, Type elementType, Enumerable<T> enumerable, Statistic statistic) { super(elementType, enumerable); this.field = field; this.statistic = statistic; }
Example #14
Source File: JsonTable.java From calcite with Apache License 2.0 | 4 votes |
public Statistic getStatistic() { return Statistics.UNKNOWN; }
Example #15
Source File: FileTable.java From calcite with Apache License 2.0 | 4 votes |
public Statistic getStatistic() { return Statistics.UNKNOWN; }
Example #16
Source File: PigTable.java From calcite with Apache License 2.0 | 4 votes |
@Override public Statistic getStatistic() { return DUMMY_STATISTICS; }
Example #17
Source File: TpcdsSchema.java From calcite with Apache License 2.0 | 4 votes |
@Override public Statistic getStatistic() { Bug.upgrade("add row count estimate to TpcdsTable, and use it"); Integer rowCount = TABLE_ROW_COUNTS.get(tpcdsTable.name()); assert rowCount != null : tpcdsTable; return Statistics.of(rowCount, ImmutableList.of()); }
Example #18
Source File: TableFunctions.java From mat-calcite-plugin with Apache License 2.0 | 4 votes |
@Override public Statistic getStatistic() { return Statistics.of(values.size(), unique ? UNIQUE_KEYS_STATISTICS : NON_UNIQUE_KEYS_STATISTICS); }
Example #19
Source File: ListTable.java From calcite with Apache License 2.0 | 4 votes |
public Statistic getStatistic() { return Statistics.of(list.size(), ImmutableList.of()); }
Example #20
Source File: AbstractTable.java From calcite with Apache License 2.0 | 4 votes |
public Statistic getStatistic() { return Statistics.UNKNOWN; }
Example #21
Source File: RelToSqlConverterStructsTest.java From calcite with Apache License 2.0 | 4 votes |
@Override public Statistic getStatistic() { return STATS; }
Example #22
Source File: FrameworksTest.java From calcite with Apache License 2.0 | 4 votes |
public Statistic getStatistic() { return Statistics.of(15D, ImmutableList.of(ImmutableBitSet.of(0)), ImmutableList.of()); }
Example #23
Source File: StreamTest.java From calcite with Apache License 2.0 | 4 votes |
public Statistic getStatistic() { return Statistics.of(100d, ImmutableList.of(), RelCollations.createSingleton(0)); }
Example #24
Source File: StreamTest.java From calcite with Apache License 2.0 | 4 votes |
public Statistic getStatistic() { return Statistics.of(200d, ImmutableList.of()); }
Example #25
Source File: StreamTest.java From calcite with Apache License 2.0 | 4 votes |
@Override public Statistic getStatistic() { return Statistics.of(200d, ImmutableList.of()); }
Example #26
Source File: CollectionTypeTest.java From calcite with Apache License 2.0 | 4 votes |
public Statistic getStatistic() { return Statistics.UNKNOWN; }
Example #27
Source File: CollectionTypeTest.java From calcite with Apache License 2.0 | 4 votes |
public Statistic getStatistic() { return Statistics.UNKNOWN; }
Example #28
Source File: KafkaStreamTable.java From calcite with Apache License 2.0 | 4 votes |
@Override public Statistic getStatistic() { return Statistics.of(100d, ImmutableList.of(), RelCollations.createSingleton(0)); }
Example #29
Source File: ViewTable.java From dremio-oss with Apache License 2.0 | 4 votes |
@Override public Statistic getStatistic() { return Statistics.UNKNOWN; }
Example #30
Source File: DrillTranslatableTable.java From Bats with Apache License 2.0 | 4 votes |
@Override public Statistic getStatistic() { return drillTable.getStatistic(); }