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


Java LogicalTableModify类代码示例

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


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

示例1: insertCopying

import org.apache.calcite.rel.logical.LogicalTableModify; //导入依赖的package包/类
public JdbcRelBuilder insertCopying(
		LogicalTableModify original,
		Table table
) {
	List<String> name = JdbcTableUtils.getQualifiedName(original.getTable(), table);

	push(new LogicalTableModify(
			cluster,
			original.getTraitSet(),
			relOptSchema.getTableForMember(name),
			original.getCatalogReader(),
			peek(),
			TableModify.Operation.INSERT,
			null,
			null,
			original.isFlattened()
	));
	return this;
}
 
开发者ID:tzolov,项目名称:calcite-sql-rewriter,代码行数:20,代码来源:JdbcRelBuilder.java

示例2: apply

import org.apache.calcite.rel.logical.LogicalTableModify; //导入依赖的package包/类
@Override
public RelNode apply(RelNode originalRel, JdbcRelBuilderFactory relBuilderFactory) {

	if (!(originalRel instanceof LogicalTableModify)) {
		return null;
	}

	LogicalTableModify tableModify = (LogicalTableModify) originalRel;

	if (tableModify.getOperation() != operation) {
		return null;
	}

	Table baseTable = JdbcTableUtils.getJdbcTable(tableModify);
	if (!(baseTable instanceof JournalledJdbcTable)) {
		// Not a journal table; nothing to do
		return null;
	}
	JournalledJdbcTable journalTable = (JournalledJdbcTable) baseTable;

	return doApply(tableModify, journalTable, relBuilderFactory);
}
 
开发者ID:tzolov,项目名称:calcite-sql-rewriter,代码行数:23,代码来源:AbstractForcedRule.java

示例3: createModify

import org.apache.calcite.rel.logical.LogicalTableModify; //导入依赖的package包/类
/** Creates a relational expression to modify a table or modifiable view. */
private RelNode createModify(RelOptTable targetTable, RelNode source) {
	final ModifiableTable modifiableTable =
		targetTable.unwrap(ModifiableTable.class);
	if (modifiableTable != null) {
		return modifiableTable.toModificationRel(cluster, targetTable,
			catalogReader, source, LogicalTableModify.Operation.INSERT, null,
			null, false);
	}
	final ModifiableView modifiableView =
		targetTable.unwrap(ModifiableView.class);
	if (modifiableView != null) {
		final Table delegateTable = modifiableView.getTable();
		final RelDataType delegateRowType = delegateTable.getRowType(typeFactory);
		final RelOptTable delegateRelOptTable =
			RelOptTableImpl.create(null, delegateRowType, delegateTable,
				modifiableView.getTablePath());
		final RelNode newSource =
			createSource(targetTable, source, modifiableView, delegateRowType);
		return createModify(delegateRelOptTable, newSource);
	}
	return LogicalTableModify.create(targetTable, catalogReader, source,
		LogicalTableModify.Operation.INSERT, null, null, false);
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:25,代码来源:SqlToRelConverter.java

示例4: convert

import org.apache.calcite.rel.logical.LogicalTableModify; //导入依赖的package包/类
@Override
public RelNode convert(RelNode rel) {
    final LogicalTableModify modify =
            (LogicalTableModify) rel;
    final ModifiableTable modifiableTable =
            modify.getTable().unwrap(ModifiableTable.class);
    if (modifiableTable == null
  /* || modifiableTable.getExpression(tableInSchema) == null */) {
        return null;
    }
    final RelTraitSet traitSet =
            modify.getTraitSet().replace(getOut());
    return new JdbcTableModify(
            modify.getCluster(), traitSet,
            modify.getTable(),
            modify.getCatalogReader(),
            convert(modify.getInput(), traitSet),
            modify.getOperation(),
            modify.getUpdateColumnList(),
            modify.isFlattened());
}
 
开发者ID:bitnine-oss,项目名称:octopus,代码行数:22,代码来源:JdbcRules.java

示例5: createModify

import org.apache.calcite.rel.logical.LogicalTableModify; //导入依赖的package包/类
/** Creates a relational expression to modify a table or modifiable view. */
private RelNode createModify(RelOptTable targetTable, RelNode source) {
  final ModifiableTable modifiableTable =
      targetTable.unwrap(ModifiableTable.class);
  if (modifiableTable != null) {
    return modifiableTable.toModificationRel(cluster, targetTable,
        catalogReader, source, LogicalTableModify.Operation.INSERT, null,
        null, false);
  }
  final ModifiableView modifiableView =
      targetTable.unwrap(ModifiableView.class);
  if (modifiableView != null) {
    final Table delegateTable = modifiableView.getTable();
    final RelDataType delegateRowType = delegateTable.getRowType(typeFactory);
    final RelOptTable delegateRelOptTable =
        RelOptTableImpl.create(null, delegateRowType, delegateTable,
            modifiableView.getTablePath());
    final RelNode newSource =
        createSource(targetTable, source, modifiableView, delegateRowType);
    return createModify(delegateRelOptTable, newSource);
  }
  return LogicalTableModify.create(targetTable, catalogReader, source,
      LogicalTableModify.Operation.INSERT, null, null, false);
}
 
开发者ID:apache,项目名称:kylin,代码行数:25,代码来源:SqlToRelConverter.java

示例6: mapTableModOp

import org.apache.calcite.rel.logical.LogicalTableModify; //导入依赖的package包/类
protected LogicalTableModify.Operation mapTableModOp(
    boolean isDml, SqlKind sqlKind) {
  if (!isDml) {
    return null;
  }
  switch (sqlKind) {
  case INSERT:
    return LogicalTableModify.Operation.INSERT;
  case DELETE:
    return LogicalTableModify.Operation.DELETE;
  case MERGE:
    return LogicalTableModify.Operation.MERGE;
  case UPDATE:
    return LogicalTableModify.Operation.UPDATE;
  default:
    return null;
  }
}
 
开发者ID:apache,项目名称:calcite,代码行数:19,代码来源:Prepare.java

示例7: PreparedResultImpl

import org.apache.calcite.rel.logical.LogicalTableModify; //导入依赖的package包/类
public PreparedResultImpl(
    RelDataType rowType,
    RelDataType parameterRowType,
    List<List<String>> fieldOrigins,
    List<RelCollation> collations,
    RelNode rootRel,
    LogicalTableModify.Operation tableModOp,
    boolean isDml) {
  this.rowType = Preconditions.checkNotNull(rowType);
  this.parameterRowType = Preconditions.checkNotNull(parameterRowType);
  this.fieldOrigins = Preconditions.checkNotNull(fieldOrigins);
  this.collations = ImmutableList.copyOf(collations);
  this.rootRel = Preconditions.checkNotNull(rootRel);
  this.tableModOp = tableModOp;
  this.isDml = isDml;
}
 
开发者ID:apache,项目名称:calcite,代码行数:17,代码来源:Prepare.java

示例8: convert

import org.apache.calcite.rel.logical.LogicalTableModify; //导入依赖的package包/类
@Override public RelNode convert(RelNode rel) {
  final LogicalTableModify modify =
      (LogicalTableModify) rel;
  final ModifiableTable modifiableTable =
      modify.getTable().unwrap(ModifiableTable.class);
  if (modifiableTable == null
      /* || modifiableTable.getExpression(tableInSchema) == null */) {
    return null;
  }
  final RelTraitSet traitSet =
      modify.getTraitSet().replace(out);
  return new JdbcTableModify(
      modify.getCluster(), traitSet,
      modify.getTable(),
      modify.getCatalogReader(),
      convert(modify.getInput(), traitSet),
      modify.getOperation(),
      modify.getUpdateColumnList(),
      modify.getSourceExpressionList(),
      modify.isFlattened());
}
 
开发者ID:apache,项目名称:calcite,代码行数:22,代码来源:JdbcRules.java

示例9: convert

import org.apache.calcite.rel.logical.LogicalTableModify; //导入依赖的package包/类
@Override public RelNode convert(RelNode rel) {
  final LogicalTableModify modify =
      (LogicalTableModify) rel;
  final ModifiableTable modifiableTable =
      modify.getTable().unwrap(ModifiableTable.class);
  if (modifiableTable == null) {
    return null;
  }
  final RelTraitSet traitSet =
      modify.getTraitSet().replace(EnumerableConvention.INSTANCE);
  return new EnumerableTableModify(
      modify.getCluster(), traitSet,
      modify.getTable(),
      modify.getCatalogReader(),
      convert(modify.getInput(), traitSet),
      modify.getOperation(),
      modify.getUpdateColumnList(),
      modify.getSourceExpressionList(),
      modify.isFlattened());
}
 
开发者ID:apache,项目名称:calcite,代码行数:21,代码来源:EnumerableTableModifyRule.java

示例10: createModify

import org.apache.calcite.rel.logical.LogicalTableModify; //导入依赖的package包/类
/** Creates a relational expression to modify a table or modifiable view. */
private RelNode createModify(RelOptTable targetTable, RelNode source) {
  final ModifiableTable modifiableTable =
      targetTable.unwrap(ModifiableTable.class);
  if (modifiableTable != null
      && modifiableTable == targetTable.unwrap(Table.class)) {
    return modifiableTable.toModificationRel(cluster, targetTable,
        catalogReader, source, LogicalTableModify.Operation.INSERT, null,
        null, false);
  }
  final ModifiableView modifiableView =
      targetTable.unwrap(ModifiableView.class);
  if (modifiableView != null) {
    final Table delegateTable = modifiableView.getTable();
    final RelDataType delegateRowType = delegateTable.getRowType(typeFactory);
    final RelOptTable delegateRelOptTable =
        RelOptTableImpl.create(null, delegateRowType, delegateTable,
            modifiableView.getTablePath());
    final RelNode newSource =
        createSource(targetTable, source, modifiableView, delegateRowType);
    return createModify(delegateRelOptTable, newSource);
  }
  return LogicalTableModify.create(targetTable, catalogReader, source,
      LogicalTableModify.Operation.INSERT, null, null, false);
}
 
开发者ID:apache,项目名称:calcite,代码行数:26,代码来源:SqlToRelConverter.java

示例11: testReduceCastsNullable

import org.apache.calcite.rel.logical.LogicalTableModify; //导入依赖的package包/类
@Ignore // Calcite does not support INSERT yet
@Test public void testReduceCastsNullable() throws Exception {
  HepProgram program = new HepProgramBuilder()

      // Simulate the way INSERT will insert casts to the target types
      .addRuleInstance(
          new CoerceInputsRule(LogicalTableModify.class, false,
              RelFactories.LOGICAL_BUILDER))

          // Convert projects to calcs, merge two calcs, and then
          // reduce redundant casts in merged calc.
      .addRuleInstance(ProjectToCalcRule.INSTANCE)
      .addRuleInstance(CalcMergeRule.INSTANCE)
      .addRuleInstance(ReduceExpressionsRule.CALC_INSTANCE)
      .build();
  checkPlanning(program,
      "insert into sales.depts(name) "
          + "select cast(gender as varchar(128)) from sales.emps");
}
 
开发者ID:apache,项目名称:calcite,代码行数:20,代码来源:RelOptRulesTest.java

示例12: JdbcTableModificationRule

import org.apache.calcite.rel.logical.LogicalTableModify; //导入依赖的package包/类
private JdbcTableModificationRule(JdbcConvention out) {
    super(
            LogicalTableModify.class,
            Convention.NONE,
            out,
            "JdbcTableModificationRule");
}
 
开发者ID:bitnine-oss,项目名称:octopus,代码行数:8,代码来源:JdbcRules.java

示例13: toModificationRel

import org.apache.calcite.rel.logical.LogicalTableModify; //导入依赖的package包/类
public TableModify toModificationRel(
    RelOptCluster cluster,
    RelOptTable table,
    Prepare.CatalogReader catalogReader,
    RelNode child,
    TableModify.Operation operation,
    List<String> updateColumnList,
    List<RexNode> sourceExpressionList,
    boolean flattened) {
  return LogicalTableModify.create(table, catalogReader, child, operation,
      updateColumnList, sourceExpressionList, flattened);
}
 
开发者ID:apache,项目名称:calcite,代码行数:13,代码来源:SqlCreateTable.java

示例14: JdbcTableModificationRule

import org.apache.calcite.rel.logical.LogicalTableModify; //导入依赖的package包/类
private JdbcTableModificationRule(JdbcConvention out) {
  super(
      LogicalTableModify.class,
      Convention.NONE,
      out,
      "JdbcTableModificationRule");
}
 
开发者ID:apache,项目名称:calcite,代码行数:8,代码来源:JdbcRules.java

示例15: toModificationRel

import org.apache.calcite.rel.logical.LogicalTableModify; //导入依赖的package包/类
@Override public TableModify toModificationRel(RelOptCluster cluster,
    RelOptTable table, CatalogReader catalogReader, RelNode input,
    Operation operation, List<String> updateColumnList,
    List<RexNode> sourceExpressionList, boolean flattened) {
  jdbcSchema.convention.register(cluster.getPlanner());

  return new LogicalTableModify(cluster, cluster.traitSetOf(Convention.NONE),
      table, catalogReader, input, operation, updateColumnList,
      sourceExpressionList, flattened);
}
 
开发者ID:apache,项目名称:calcite,代码行数:11,代码来源:JdbcTable.java


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