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


Java RelOptCluster类代码示例

本文整理汇总了Java中org.apache.calcite.plan.RelOptCluster的典型用法代码示例。如果您正苦于以下问题:Java RelOptCluster类的具体用法?Java RelOptCluster怎么用?Java RelOptCluster使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: toRel

import org.apache.calcite.plan.RelOptCluster; //导入依赖的package包/类
@Override
public RelNode toRel(final RelOptTable.ToRelContext context, final RelOptTable relOptTable) {
  // this value has been set upon creating PlannerSettings in QueryContext
  final RelOptCluster cluster = context.getCluster();
  final RelOptPlanner planner = cluster.getPlanner();
  final CalciteCatalogReader catalog = planner.getContext().unwrap(CalciteCatalogReader.class);
  final LogicalPlanDeserializer deserializer = KryoLogicalPlanSerializers.forDeserialization(cluster, catalog, registry);
  try {
    final RelNode node = deserializer.deserialize(layout.getLogicalPlan().toByteArray());
    if (layout.getIncremental()) {
      RelShuttle shuttle = getMaterializationShuttle(layout);
      return node.accept(shuttle);
    } else {
      return node;
    }
  } catch (KryoDeserializationException e) {
    accelerationManager.replanlayout(layout.getId().getId());
    throw e;
  }
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:21,代码来源:MaterializationStoragePlugin.java

示例2: DrillScanRel

import org.apache.calcite.plan.RelOptCluster; //导入依赖的package包/类
/** Creates a DrillScan. */
public DrillScanRel(final RelOptCluster cluster, final RelTraitSet traits,
    final RelOptTable table, final RelDataType rowType, final List<SchemaPath> columns) {
  super(DRILL_LOGICAL, cluster, traits, table);
  this.settings = PrelUtil.getPlannerSettings(cluster.getPlanner());
  this.rowType = rowType;
  if (columns == null) { // planner asks to scan all of the columns
    this.columns =  ColumnList.all();
  } else if (columns.size() == 0) { // planner asks to skip all of the columns
    this.columns = ColumnList.none();
  } else { // planner asks to scan some columns
    this.columns  = ColumnList.some(columns);
  }
  try {
    this.groupScan = drillTable.getGroupScan().clone(this.columns);
  } catch (final IOException e) {
    throw new DrillRuntimeException("Failure creating scan.", e);
  }
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:20,代码来源:DrillScanRel.java

示例3: ProjectRelBase

import org.apache.calcite.plan.RelOptCluster; //导入依赖的package包/类
protected ProjectRelBase(Convention convention,
                              RelOptCluster cluster,
                              RelTraitSet traits,
                              RelNode child,
                              List<? extends RexNode> exps,
                              RelDataType rowType) {
  super(cluster, traits, child, exps, rowType, Flags.BOXED);
  assert getConvention() == convention;
  nonSimpleFieldCount = this.getRowType().getFieldCount() - getSimpleFieldCount();

  boolean foundContains = false;
  int i = 0;
  for (RexNode rex : this.getChildExps()) {
    if (ContainsRexVisitor.hasContainsCheckOrigin(this, rex, i)) {
      foundContains = true;
      break;
    }
    i++;
  }
  this.hasContains = foundContains;
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:22,代码来源:ProjectRelBase.java

示例4: JdbcPrel

import org.apache.calcite.plan.RelOptCluster; //导入依赖的package包/类
public JdbcPrel(RelOptCluster cluster, RelTraitSet traitSet, JdbcIntermediatePrel prel) {
  super(cluster, traitSet);
  final RelNode input = prel.getInput();
  rows = input.getRows();
  convention = (DrillJdbcConvention) input.getTraitSet().getTrait(ConventionTraitDef.INSTANCE);

  // generate sql for tree.
  final SqlDialect dialect = convention.getPlugin().getDialect();
  final JdbcImplementor jdbcImplementor = new JdbcImplementor(
      dialect,
      (JavaTypeFactory) getCluster().getTypeFactory());
  final JdbcImplementor.Result result =
      jdbcImplementor.visitChild(0, input.accept(new SubsetRemover()));
  sql = result.asQuery().toSqlString(dialect).getSql();
  rowType = input.getRowType();
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:17,代码来源:JdbcPrel.java

示例5: setupMocks

import org.apache.calcite.plan.RelOptCluster; //导入依赖的package包/类
@Before
@SuppressWarnings("ResultOfMethodCallIgnored") // Mockito syntax
public void setupMocks() {
	relBuilder = Mockito.mock(JdbcRelBuilder.class);
	journalTable = Mockito.mock(JdbcTable.class);
	relOptTable = Mockito.mock(RelOptTable.class);
	context = Mockito.mock(RelOptTable.ToRelContext.class);

	JdbcRelBuilderFactory relBuilderFactory = Mockito.mock(JdbcRelBuilderFactory.class);
	RelOptCluster relOptCluster = Mockito.mock(RelOptCluster.class);
	JournalledJdbcSchema schema = Mockito.mock(JournalledJdbcSchema.class);
	RelOptSchema relOptSchema = Mockito.mock(RelOptSchema.class);
	RexInputRef versionField = Mockito.mock(RexInputRef.class);
	RexInputRef subsequentVersionField = Mockito.mock(RexInputRef.class);

	Mockito.doReturn(Schema.TableType.TABLE).when(journalTable).getJdbcTableType();
	table = new JournalledJdbcTable("theView", schema, journalTable, new String[] {"key1", "key2"});
	table.relBuilderFactory = relBuilderFactory;

	Mockito.doReturn("myV").when(schema).getVersionField();
	Mockito.doReturn("mySV").when(schema).getSubsequentVersionField();
	Mockito.doReturn(relOptCluster).when(context).getCluster();
	Mockito.doReturn(relBuilder).when(relBuilderFactory).create(Mockito.same(relOptCluster), Mockito.same(relOptSchema));
	Mockito.doReturn(Mockito.mock(RelOptPlanner.class)).when(relOptCluster).getPlanner();
	Mockito.doReturn(relOptSchema).when(relOptTable).getRelOptSchema();
	Mockito.doReturn(ImmutableList.of("theSchema", "theView")).when(relOptTable).getQualifiedName();
	Mockito.doReturn(new SqlIdentifier(
			ImmutableList.of("wrongSchema", "theJournal"),
			null,
			new SqlParserPos(0, 0),
			null
	)).when(journalTable).tableName();
	Mockito.doReturn(versionField).when(relBuilder).field(Mockito.eq("myV"));
	Mockito.doReturn(subsequentVersionField).when(relBuilder).field(Mockito.eq("mySV"));
}
 
开发者ID:tzolov,项目名称:calcite-sql-rewriter,代码行数:36,代码来源:JournalledJdbcTableTest.java

示例6: DrillWindowRel

import org.apache.calcite.plan.RelOptCluster; //导入依赖的package包/类
/**
 * Creates a window relational expression.
 *
 * @param cluster Cluster
 * @param traits
 * @param child   Input relational expression
 * @param rowType Output row type
 * @param groups Windows
 */
public DrillWindowRel(
    RelOptCluster cluster,
    RelTraitSet traits,
    RelNode child,
    List<RexLiteral> constants,
    RelDataType rowType,
    List<Group> groups) {
  super(cluster, traits, child, constants, rowType, groups);
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:19,代码来源:DrillWindowRel.java

示例7: OldScanRelBase

import org.apache.calcite.plan.RelOptCluster; //导入依赖的package包/类
/**
 * Creates an <code>AbstractRelNode</code>.
 *
 * @param cluster
 * @param traitSet
 */
public OldScanRelBase(RelOptCluster cluster, RelTraitSet traitSet, RelOptTable relOptTable, RelDataType rowType, GroupScan groupScan, double discountRowCount) {
  super(cluster, traitSet, relOptTable);
  this.rowType = Preconditions.checkNotNull(rowType);
  this.groupScan = Preconditions.checkNotNull(groupScan);
  Preconditions.checkArgument(discountRowCount >= 0 && discountRowCount <= 1, "rowCountDiscount cannot be set to " + discountRowCount);
  this.rowCountDiscount = discountRowCount;
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:14,代码来源:OldScanRelBase.java

示例8: DrillJoinRel

import org.apache.calcite.plan.RelOptCluster; //导入依赖的package包/类
/** Creates a DrillJoinRel.
 * We do not throw InvalidRelException in Logical planning phase. It's up to the post-logical planning check or physical planning
 * to detect the unsupported join type, and throw exception.
 * */
public DrillJoinRel(RelOptCluster cluster, RelTraitSet traits, RelNode left, RelNode right, RexNode condition,
    JoinRelType joinType)  {
  super(cluster, traits, left, right, condition, joinType);
  assert traits.contains(DrillRel.DRILL_LOGICAL);
  RelOptUtil.splitJoinCondition(left, right, condition, leftKeys, rightKeys);
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:11,代码来源:DrillJoinRel.java

示例9: DrillValuesRel

import org.apache.calcite.plan.RelOptCluster; //导入依赖的package包/类
protected DrillValuesRel(RelOptCluster cluster, RelDataType rowType, ImmutableList<ImmutableList<RexLiteral>> tuples, RelTraitSet traits) {
  super(cluster, traits);
  assert getConvention() == DRILL_LOGICAL;
  verifyRowType(tuples, rowType);

  this.rowType = rowType;
  this.rowCount = tuples.size();

  try{
    this.options = new JSONOptions(convertToJsonNode(rowType, tuples), JsonLocation.NA);
  }catch(IOException e){
    throw new DrillRuntimeException("Failure while attempting to encode ValuesRel in JSON.", e);
  }

}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:16,代码来源:DrillValuesRel.java

示例10: JoinRel

import org.apache.calcite.plan.RelOptCluster; //导入依赖的package包/类
public JoinRel(RelOptCluster cluster, RelTraitSet traits, RelNode left, RelNode right, RexNode condition,
    JoinRelType joinType, List<Integer> leftKeys, List<Integer> rightKeys) throws InvalidRelException {
  super(cluster, traits, left, right, condition, joinType);
  assert traits.contains(Rel.LOGICAL);

  assert (leftKeys != null && rightKeys != null);
  this.leftKeys = leftKeys;
  this.rightKeys = rightKeys;
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:10,代码来源:JoinRel.java

示例11: ParquetScanPrel

import org.apache.calcite.plan.RelOptCluster; //导入依赖的package包/类
private ParquetScanPrel(RelOptCluster cluster, RelTraitSet traitSet, RelOptTable table, StoragePluginId pluginId,
                       TableMetadata dataset, List<SchemaPath> projectedColumns, double observedRowcountAdjustment,
                        List<FilterCondition> conditions,
                        List<GlobalDictionaryFieldInfo> globalDictionaryEncodedColumns,
                        RelDataType relDataType) {
  super(cluster, traitSet, table, pluginId, dataset, projectedColumns, observedRowcountAdjustment);
  this.conditions = conditions;
  this.globalDictionaryEncodedColumns = globalDictionaryEncodedColumns;
  this.cachedRelDataType = relDataType;
  if (relDataType != null) {
    rowType = relDataType;
  }
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:14,代码来源:ParquetScanPrel.java

示例12: asNodes

import org.apache.calcite.plan.RelOptCluster; //导入依赖的package包/类
private static List<RexInputRef> asNodes(final RelOptCluster cluster, Iterable<Integer> indices){
  final RexBuilder builder = cluster.getRexBuilder();
  final RelDataTypeFactory factory = cluster.getTypeFactory();

  return FluentIterable.from(indices).transform(new Function<Integer, RexInputRef>(){
    @Override
    public RexInputRef apply(Integer input) {
      return builder.makeInputRef(factory.createTypeWithNullability(factory.createSqlType(SqlTypeName.ANY), true), input);
    }}).toList();
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:11,代码来源:FilterFlattenTransposeRule.java

示例13: toRel

import org.apache.calcite.plan.RelOptCluster; //导入依赖的package包/类
@Override
public RelNode toRel(final RelOptTable.ToRelContext context, final RelOptTable relOptTable) {
  // this value has been set upon creating PlannerSettings in QueryContext
  final RelOptCluster cluster = context.getCluster();
  final RelOptPlanner planner = cluster.getPlanner();
  final CalciteCatalogReader catalog = planner.getContext().unwrap(CalciteCatalogReader.class);

  final LogicalPlanSerializer serializer = KryoLogicalPlanSerializers.forSerialization(cluster);
  final byte[] planBytes = serializer.serialize(plan);
  final LogicalPlanDeserializer deserializer = KryoLogicalPlanSerializers.forDeserialization(cluster, catalog, registry);
  final RelNode newPlan = deserializer.deserialize(planBytes);
  return newPlan;
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:14,代码来源:MaterializationTestStoragePlugin.java

示例14: HashToMergeExchangePrel

import org.apache.calcite.plan.RelOptCluster; //导入依赖的package包/类
public HashToMergeExchangePrel(RelOptCluster cluster, RelTraitSet traitSet, RelNode input,
                               List<DistributionField> fields,
                               RelCollation collation,
                               int numEndPoints) {
  super(cluster, traitSet, input);
  this.distFields = fields;
  this.collation = collation;
  this.numEndPoints = numEndPoints;
  assert input.getConvention() == Prel.DRILL_PHYSICAL;
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:11,代码来源:HashToMergeExchangePrel.java

示例15: createProject

import org.apache.calcite.plan.RelOptCluster; //导入依赖的package包/类
@Override
public RelNode createProject(RelNode child,
                             List<? extends RexNode> childExprs, List<String> fieldNames) {
  final RelOptCluster cluster = child.getCluster();
  final RelDataType rowType = RexUtil.createStructType(cluster.getTypeFactory(), childExprs, fieldNames, SqlValidatorUtil.F_SUGGESTER);
  final RelNode project = ProjectRel.create(
      cluster,
      child.getTraitSet().plus(Rel.LOGICAL),
      RelOptRule.convert(child, child.getTraitSet().plus(Rel.LOGICAL).simplify()),
      childExprs,
      rowType);

  return project;
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:15,代码来源:DremioRelFactories.java


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