本文整理汇总了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;
}
示例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);
}
示例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);
}
示例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());
}
示例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);
}
示例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;
}
}
示例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;
}
示例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());
}
示例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());
}
示例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);
}
示例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");
}
示例12: JdbcTableModificationRule
import org.apache.calcite.rel.logical.LogicalTableModify; //导入依赖的package包/类
private JdbcTableModificationRule(JdbcConvention out) {
super(
LogicalTableModify.class,
Convention.NONE,
out,
"JdbcTableModificationRule");
}
示例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);
}
示例14: JdbcTableModificationRule
import org.apache.calcite.rel.logical.LogicalTableModify; //导入依赖的package包/类
private JdbcTableModificationRule(JdbcConvention out) {
super(
LogicalTableModify.class,
Convention.NONE,
out,
"JdbcTableModificationRule");
}
示例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);
}