本文整理汇总了Java中org.apache.calcite.util.ImmutableBitSet类的典型用法代码示例。如果您正苦于以下问题:Java ImmutableBitSet类的具体用法?Java ImmutableBitSet怎么用?Java ImmutableBitSet使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ImmutableBitSet类属于org.apache.calcite.util包,在下文中一共展示了ImmutableBitSet类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: InputSpecialOpFinder
import org.apache.calcite.util.ImmutableBitSet; //导入依赖的package包/类
public InputSpecialOpFinder(
BitSet rexRefs,
ImmutableBitSet leftFields,
ImmutableBitSet rightFields,
final ImmutableBitSet strongFields,
ExprCondition preserveExprCondition,
List<RexNode> preserveLeft,
List<RexNode> preserveRight) {
super(true);
this.rexRefs = rexRefs;
this.leftFields = leftFields;
this.rightFields = rightFields;
this.preserveExprCondition = preserveExprCondition;
this.preserveLeft = preserveLeft;
this.preserveRight = preserveRight;
this.strongFields = strongFields;
this.strong = Strong.of(strongFields);
}
示例2: JdbcAggregate
import org.apache.calcite.util.ImmutableBitSet; //导入依赖的package包/类
public JdbcAggregate(
RelOptCluster cluster,
RelTraitSet traitSet,
RelNode input,
boolean indicator,
ImmutableBitSet groupSet,
List<ImmutableBitSet> groupSets,
List<AggregateCall> aggCalls)
throws InvalidRelException {
super(cluster, traitSet, input, indicator, groupSet, groupSets, aggCalls);
assert getConvention() instanceof JdbcConvention;
assert this.groupSets.size() == 1 : "Grouping sets not supported";
assert !this.indicator;
final SqlDialect dialect = ((JdbcConvention) getConvention()).getDialect();
for (AggregateCall aggCall : aggCalls) {
if (!canImplement(aggCall.getAggregation(), dialect)) {
throw new InvalidRelException("cannot implement aggregate function "
+ aggCall.getAggregation());
}
}
}
示例3: canPush
import org.apache.calcite.util.ImmutableBitSet; //导入依赖的package包/类
private boolean canPush(Aggregate aggregate, ImmutableBitSet rCols) {
// If the filter references columns not in the group key, we cannot push
final ImmutableBitSet groupKeys =
ImmutableBitSet.range(0, aggregate.getGroupSet().cardinality());
if (!groupKeys.contains(rCols)) {
return false;
}
if (aggregate.indicator) {
// If grouping sets are used, the filter can be pushed if
// the columns referenced in the predicate are present in
// all the grouping sets.
for (ImmutableBitSet groupingSet : aggregate.getGroupSets()) {
if (!groupingSet.contains(rCols)) {
return false;
}
}
}
return true;
}
示例4: setJoinFilterRefs
import org.apache.calcite.util.ImmutableBitSet; //导入依赖的package包/类
/**
* Sets bitmaps indicating which factors and fields each join filter
* references
*/
private void setJoinFilterRefs() {
fieldsRefByJoinFilter = Maps.newHashMap();
factorsRefByJoinFilter = Maps.newHashMap();
ListIterator<RexNode> filterIter = allJoinFilters.listIterator();
while (filterIter.hasNext()) {
RexNode joinFilter = filterIter.next();
// ignore the literal filter; if necessary, we'll add it back
// later
if (joinFilter.isAlwaysTrue()) {
filterIter.remove();
}
ImmutableBitSet factorRefBitmap =
getJoinFilterFactorBitmap(joinFilter, true);
factorsRefByJoinFilter.put(joinFilter, factorRefBitmap);
}
}
示例5: get
import org.apache.calcite.util.ImmutableBitSet; //导入依赖的package包/类
public Profiler.Profile get() {
final ProfilerImpl profiler =
ProfilerImpl.builder()
.withPassSize(200)
.withMinimumSurprise(0.3D)
.build();
final List<Profiler.Column> columns = new ArrayList<>();
for (Lattice.Column column : lattice.columns) {
columns.add(new Profiler.Column(column.ordinal, column.alias));
}
final String sql =
lattice.sql(ImmutableBitSet.range(lattice.columns.size()),
false, ImmutableList.<Lattice.Measure>of());
final Table table =
new MaterializationService.DefaultTableFactory()
.createTable(lattice.rootSchema, sql,
ImmutableList.<String>of());
final ImmutableList<ImmutableBitSet> initialGroups =
ImmutableList.of();
final Enumerable<List<Comparable>> rows =
((ScannableTable) table).scan(null).select(TO_LIST);
return profiler.profile(rows, columns, initialGroups);
}
示例6: getDistinctRowCount
import org.apache.calcite.util.ImmutableBitSet; //导入依赖的package包/类
public Double getDistinctRowCount(Filter rel, RelMetadataQuery mq,
ImmutableBitSet groupKey, RexNode predicate) {
if (predicate == null || predicate.isAlwaysTrue()) {
if (groupKey.isEmpty()) {
return 1D;
}
}
// REVIEW zfong 4/18/06 - In the Broadbase code, duplicates are not
// removed from the two filter lists. However, the code below is
// doing so.
RexNode unionPreds =
RelMdUtil.unionPreds(
rel.getCluster().getRexBuilder(),
predicate,
rel.getCondition());
return mq.getDistinctRowCount(rel.getInput(), groupKey, unionPreds);
}
示例7: BindableAggregate
import org.apache.calcite.util.ImmutableBitSet; //导入依赖的package包/类
public BindableAggregate(
RelOptCluster cluster,
RelTraitSet traitSet,
RelNode input,
boolean indicator,
ImmutableBitSet groupSet,
List<ImmutableBitSet> groupSets,
List<AggregateCall> aggCalls)
throws InvalidRelException {
super(cluster, traitSet, input, indicator, groupSet, groupSets, aggCalls);
assert getConvention() instanceof BindableConvention;
for (AggregateCall aggCall : aggCalls) {
if (aggCall.isDistinct()) {
throw new InvalidRelException(
"distinct aggregation not supported");
}
AggImplementor implementor2 =
RexImpTable.INSTANCE.get(aggCall.getAggregation(), false);
if (implementor2 == null) {
throw new InvalidRelException(
"aggregation " + aggCall.getAggregation() + " not supported");
}
}
}
示例8: induce
import org.apache.calcite.util.ImmutableBitSet; //导入依赖的package包/类
public static Group induce(ImmutableBitSet groupSet,
List<ImmutableBitSet> groupSets) {
if (!ImmutableBitSet.ORDERING.isStrictlyOrdered(groupSets)) {
throw new IllegalArgumentException("must be sorted: " + groupSets);
}
if (groupSets.size() == 1 && groupSets.get(0).equals(groupSet)) {
return SIMPLE;
}
if (groupSets.size() == IntMath.pow(2, groupSet.cardinality())) {
return CUBE;
}
checkRollup:
if (groupSets.size() == groupSet.cardinality() + 1) {
ImmutableBitSet g = groupSet;
for (ImmutableBitSet bitSet : groupSets) {
if (!bitSet.equals(g)) {
break checkRollup;
}
g = g.clear(g.length() - 1);
}
assert g.isEmpty();
return ROLLUP;
}
return OTHER;
}
示例9: setAggChildKeys
import org.apache.calcite.util.ImmutableBitSet; //导入依赖的package包/类
/**
* Takes a bitmap representing a set of input references and extracts the
* ones that reference the group by columns in an aggregate.
*
* @param groupKey the original bitmap
* @param aggRel the aggregate
* @param childKey sets bits from groupKey corresponding to group by columns
*/
public static void setAggChildKeys(
ImmutableBitSet groupKey,
Aggregate aggRel,
ImmutableBitSet.Builder childKey) {
List<AggregateCall> aggCalls = aggRel.getAggCallList();
for (int bit : groupKey) {
if (bit < aggRel.getGroupCount()) {
// group by column
childKey.set(bit);
} else {
// aggregate column -- set a bit for each argument being
// aggregated
AggregateCall agg = aggCalls.get(bit
- (aggRel.getGroupCount() + aggRel.getIndicatorCount()));
for (Integer arg : agg.getArgList()) {
childKey.set(arg);
}
}
}
}
示例10: getPopulationSize
import org.apache.calcite.util.ImmutableBitSet; //导入依赖的package包/类
/** Catch-all implementation for
* {@link BuiltInMetadata.PopulationSize#getPopulationSize(ImmutableBitSet)},
* invoked using reflection.
*
* @see org.apache.calcite.rel.metadata.RelMetadataQuery#getPopulationSize(RelNode, ImmutableBitSet)
*/
public Double getPopulationSize(RelNode rel, RelMetadataQuery mq,
ImmutableBitSet groupKey) {
// if the keys are unique, return the row count; otherwise, we have
// no further information on which to return any legitimate value
// REVIEW zfong 4/11/06 - Broadbase code returns the product of each
// unique key, which would result in the population being larger
// than the total rows in the relnode
boolean uniq = RelMdUtil.areColumnsDefinitelyUnique(mq, rel, groupKey);
if (uniq) {
return mq.getRowCount(rel);
}
return null;
}
示例11: AggregateNode
import org.apache.calcite.util.ImmutableBitSet; //导入依赖的package包/类
public AggregateNode(Compiler compiler, Aggregate rel) {
super(compiler, rel);
this.dataContext = compiler.getDataContext();
ImmutableBitSet union = ImmutableBitSet.of();
if (rel.getGroupSets() != null) {
for (ImmutableBitSet group : rel.getGroupSets()) {
union = union.union(group);
groups.add(new Grouping(group));
}
}
this.unionGroups = union;
this.outputRowLength = unionGroups.cardinality()
+ (rel.indicator ? unionGroups.cardinality() : 0)
+ rel.getAggCallList().size();
ImmutableList.Builder<AccumulatorFactory> builder = ImmutableList.builder();
for (AggregateCall aggregateCall : rel.getAggCallList()) {
builder.add(getAccumulator(aggregateCall, false));
}
accumulatorFactories = builder.build();
}
示例12: getRowCount
import org.apache.calcite.util.ImmutableBitSet; //导入依赖的package包/类
@Override
public Double getRowCount(Aggregate rel) {
ImmutableBitSet groupKey = ImmutableBitSet.range(rel.getGroupCount());
if (groupKey.isEmpty()) {
return 1.0;
} else {
return super.getRowCount(rel);
}
}
示例13: getDistinctRowCount
import org.apache.calcite.util.ImmutableBitSet; //导入依赖的package包/类
@Override
public Double getDistinctRowCount(RelNode rel, ImmutableBitSet groupKey, RexNode predicate) {
if (rel instanceof DrillScanRel) {
return getDistinctRowCount((DrillScanRel) rel, groupKey, predicate);
} else {
return super.getDistinctRowCount(rel, groupKey, predicate);
}
}
示例14: copy
import org.apache.calcite.util.ImmutableBitSet; //导入依赖的package包/类
@Override
public Aggregate copy(RelTraitSet traitSet, RelNode input, boolean indicator, ImmutableBitSet groupSet, List<ImmutableBitSet> groupSets, List<AggregateCall> aggCalls) {
try {
return new DrillAggregateRel(getCluster(), traitSet, input, indicator, groupSet, groupSets, aggCalls);
} catch (InvalidRelException e) {
throw new AssertionError(e);
}
}
示例15: HashAggPrel
import org.apache.calcite.util.ImmutableBitSet; //导入依赖的package包/类
public HashAggPrel(RelOptCluster cluster,
RelTraitSet traits,
RelNode child,
boolean indicator,
ImmutableBitSet groupSet,
List<ImmutableBitSet> groupSets,
List<AggregateCall> aggCalls,
OperatorPhase phase) throws InvalidRelException {
super(cluster, traits, child, indicator, groupSet, groupSets, aggCalls, phase);
}