public void rewriteRel(LogicalTableModify rel) { LogicalTableModify newRel = LogicalTableModify.create( rel.getTable(), rel.getCatalogReader(), getNewForOldRel(rel.getInput()), rel.getOperation(), rel.getUpdateColumnList(), rel.getSourceExpressionList(), true); setNewForOldRel(rel, newRel); }
@Override public LogicalTableModify copy(RelTraitSet traitSet, List<RelNode> inputs) { assert traitSet.containsIfApplicable(Convention.NONE); return new LogicalTableModify(getCluster(), traitSet, table, catalogReader, sole(inputs), getOperation(), getUpdateColumnList(), getSourceExpressionList(), isFlattened()); } }
@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()); } }
@Override 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); }
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; }
JdbcRelBuilderFactory relBuilderFactory) { if (!(tableModify.getInput() instanceof LogicalProject)) { throw new IllegalStateException("Unknown Calcite UPDATE structure"); LogicalProject project = (LogicalProject) tableModify.getInput(); List<RexNode> desiredFields = new ArrayList<>(); List<String> desiredNames = new ArrayList<>(); int index = tableModify.getUpdateColumnList().indexOf(field.getValue()); if (index != -1) { desiredFields.add(tableModify.getSourceExpressionList().get(index)); tableModify.getCluster(), tableModify.getTable().getRelOptSchema() );
final RelDataType rowType = modifier.getRowType(); final int fieldCount = rowType.getFieldCount(); RelNode input = modifier.getInput(); if (newInput != input) { newModifier = modifier.copy( modifier.getTraitSet(), Collections.singletonList(newInput));
tableModify.getCluster(), tableModify.getTable().getRelOptSchema() ); RelNode input = tableModify.getInput(); if (input instanceof LogicalValues) {
/** Creates a LogicalTableModify. */ public static LogicalTableModify create(RelOptTable table, Prepare.CatalogReader schema, RelNode input, Operation operation, List<String> updateColumnList, List<RexNode> sourceExpressionList, boolean flattened) { final RelOptCluster cluster = input.getCluster(); final RelTraitSet traitSet = cluster.traitSetOf(Convention.NONE); return new LogicalTableModify(cluster, traitSet, table, schema, input, operation, updateColumnList, sourceExpressionList, flattened); }
@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); }
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); } }
final RelDataType rowType = modifier.getRowType(); final int fieldCount = rowType.getFieldCount(); RelNode input = modifier.getInput(); if (newInput != input) { newModifier = modifier.copy( modifier.getTraitSet(), Collections.singletonList(newInput));
tableModify.getCluster(), tableModify.getTable().getRelOptSchema() ); RelNode input = tableModify.getInput();
/** Creates a LogicalTableModify. */ public static LogicalTableModify create(RelOptTable table, Prepare.CatalogReader schema, RelNode input, Operation operation, List<String> updateColumnList, List<RexNode> sourceExpressionList, boolean flattened) { final RelOptCluster cluster = input.getCluster(); final RelTraitSet traitSet = cluster.traitSetOf(Convention.NONE); return new LogicalTableModify(cluster, traitSet, table, schema, input, operation, updateColumnList, sourceExpressionList, flattened); }
@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()); } }
public void rewriteRel(LogicalTableModify rel) { LogicalTableModify newRel = LogicalTableModify.create( rel.getTable(), rel.getCatalogReader(), getNewForOldRel(rel.getInput()), rel.getOperation(), rel.getUpdateColumnList(), rel.getSourceExpressionList(), true); setNewForOldRel(rel, newRel); }
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); }
@Override public LogicalTableModify copy(RelTraitSet traitSet, List<RelNode> inputs) { assert traitSet.containsIfApplicable(Convention.NONE); return new LogicalTableModify(getCluster(), traitSet, table, catalogReader, sole(inputs), getOperation(), getUpdateColumnList(), getSourceExpressionList(), isFlattened()); } }
@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); }
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); }