当前位置: 首页>>代码示例>>Java>>正文


Java ImmutableBitSet.asList方法代码示例

本文整理汇总了Java中org.apache.calcite.util.ImmutableBitSet.asList方法的典型用法代码示例。如果您正苦于以下问题:Java ImmutableBitSet.asList方法的具体用法?Java ImmutableBitSet.asList怎么用?Java ImmutableBitSet.asList使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.calcite.util.ImmutableBitSet的用法示例。


在下文中一共展示了ImmutableBitSet.asList方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: cardinality

import org.apache.calcite.util.ImmutableBitSet; //导入方法依赖的package包/类
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));
  }
}
 
开发者ID:apache,项目名称:calcite,代码行数:24,代码来源:Profiler.java

示例2: AggregationGroupByKeyFn

import org.apache.calcite.util.ImmutableBitSet; //导入方法依赖的package包/类
public AggregationGroupByKeyFn(int windowFieldIdx, ImmutableBitSet groupSet) {
  this.groupByKeys = new ArrayList<>();
  for (int i : groupSet.asList()) {
    if (i != windowFieldIdx) {
      groupByKeys.add(i);
    }
  }
}
 
开发者ID:apache,项目名称:beam,代码行数:9,代码来源:BeamAggregationTransforms.java

示例3: checkConstraint

import org.apache.calcite.util.ImmutableBitSet; //导入方法依赖的package包/类
/**
 * Validates insert values against the constraint of a modifiable view.
 *
 * @param validatorTable Table that may wrap a ModifiableViewTable
 * @param source        The values being inserted
 * @param targetRowType The target type for the view
 */
private void checkConstraint(
    SqlValidatorTable validatorTable,
    SqlNode source,
    RelDataType targetRowType) {
  final ModifiableViewTable modifiableViewTable =
      validatorTable.unwrap(ModifiableViewTable.class);
  if (modifiableViewTable != null && source instanceof SqlCall) {
    final Table table = modifiableViewTable.unwrap(Table.class);
    final RelDataType tableRowType = table.getRowType(typeFactory);
    final List<RelDataTypeField> tableFields = tableRowType.getFieldList();

    // Get the mapping from column indexes of the underlying table
    // to the target columns and view constraints.
    final Map<Integer, RelDataTypeField> tableIndexToTargetField =
        SqlValidatorUtil.getIndexToFieldMap(tableFields, targetRowType);
    final Map<Integer, RexNode> projectMap =
        RelOptUtil.getColumnConstraints(modifiableViewTable, targetRowType, typeFactory);

    // Determine columns (indexed to the underlying table) that need
    // to be validated against the view constraint.
    final ImmutableBitSet targetColumns =
        ImmutableBitSet.of(tableIndexToTargetField.keySet());
    final ImmutableBitSet constrainedColumns =
        ImmutableBitSet.of(projectMap.keySet());
    final ImmutableBitSet constrainedTargetColumns =
        targetColumns.intersect(constrainedColumns);

    // Validate insert values against the view constraint.
    final List<SqlNode> values = ((SqlCall) source).getOperandList();
    for (final int colIndex : constrainedTargetColumns.asList()) {
      final String colName = tableFields.get(colIndex).getName();
      final RelDataTypeField targetField = tableIndexToTargetField.get(colIndex);
      for (SqlNode row : values) {
        final SqlCall call = (SqlCall) row;
        final SqlNode sourceValue = call.operand(targetField.getIndex());
        final ValidationError validationError =
            new ValidationError(sourceValue,
                RESOURCE.viewConstraintNotSatisfied(colName,
                    Util.last(validatorTable.getQualifiedName())));
        RelOptUtil.validateValueAgainstConstraint(sourceValue,
            projectMap.get(colIndex), validationError);
      }
    }
  }
}
 
开发者ID:apache,项目名称:calcite,代码行数:53,代码来源:SqlValidatorImpl.java


注:本文中的org.apache.calcite.util.ImmutableBitSet.asList方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。