@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 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 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 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 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); } }
private RelNode convertDelete(SqlDelete call) { RelOptTable targetTable = getTargetTable(call); RelNode sourceRel = convertSelect(call.getSourceSelect(), false); return LogicalTableModify.create(targetTable, catalogReader, sourceRel, LogicalTableModify.Operation.DELETE, null, null, false); }
private RelNode convertDelete(SqlDelete call) { RelOptTable targetTable = getTargetTable(call); RelNode sourceRel = convertSelect(call.getSourceSelect(), false); return LogicalTableModify.create(targetTable, catalogReader, sourceRel, LogicalTableModify.Operation.DELETE, null, null, false); }
private RelNode convertDelete(SqlDelete call) { RelOptTable targetTable = getTargetTable(call); RelNode sourceRel = convertSelect(call.getSourceSelect(), false); return LogicalTableModify.create(targetTable, catalogReader, sourceRel, LogicalTableModify.Operation.DELETE, null, null, false); }
private RelNode convertDelete(SqlDelete call) { RelOptTable targetTable = getTargetTable(call); RelNode sourceRel = convertSelect(call.getSourceSelect(), false); return LogicalTableModify.create(targetTable, catalogReader, sourceRel, LogicalTableModify.Operation.DELETE, null, null, false); }
private RelNode convertUpdate(SqlUpdate call) { final SqlValidatorScope scope = validator.getWhereScope(call.getSourceSelect()); Blackboard bb = createBlackboard(scope, null, false); Builder<RexNode> rexNodeSourceExpressionListBuilder = ImmutableList.builder(); for (SqlNode n : call.getSourceExpressionList()) { RexNode rn = bb.convertExpression(n); rexNodeSourceExpressionListBuilder.add(rn); } RelOptTable targetTable = getTargetTable(call); // convert update column list from SqlIdentifier to String final List<String> targetColumnNameList = new ArrayList<>(); final RelDataType targetRowType = targetTable.getRowType(); for (SqlNode node : call.getTargetColumnList()) { SqlIdentifier id = (SqlIdentifier) node; RelDataTypeField field = SqlValidatorUtil.getTargetField( targetRowType, typeFactory, id, catalogReader, targetTable); assert field != null : "column " + id.toString() + " not found"; targetColumnNameList.add(field.getName()); } RelNode sourceRel = convertSelect(call.getSourceSelect(), false); return LogicalTableModify.create(targetTable, catalogReader, sourceRel, LogicalTableModify.Operation.UPDATE, targetColumnNameList, rexNodeSourceExpressionListBuilder.build(), false); }
private RelNode convertUpdate(SqlUpdate call) { final SqlValidatorScope scope = validator.getWhereScope(call.getSourceSelect()); Blackboard bb = createBlackboard(scope, null, false); Builder<RexNode> rexNodeSourceExpressionListBuilder = ImmutableList.builder(); for (SqlNode n : call.getSourceExpressionList()) { RexNode rn = bb.convertExpression(n); rexNodeSourceExpressionListBuilder.add(rn); } RelOptTable targetTable = getTargetTable(call); // convert update column list from SqlIdentifier to String final List<String> targetColumnNameList = new ArrayList<>(); final RelDataType targetRowType = targetTable.getRowType(); for (SqlNode node : call.getTargetColumnList()) { SqlIdentifier id = (SqlIdentifier) node; RelDataTypeField field = SqlValidatorUtil.getTargetField( targetRowType, typeFactory, id, catalogReader, targetTable); assert field != null : "column " + id.toString() + " not found"; targetColumnNameList.add(field.getName()); } RelNode sourceRel = convertSelect(call.getSourceSelect(), false); return LogicalTableModify.create(targetTable, catalogReader, sourceRel, LogicalTableModify.Operation.UPDATE, targetColumnNameList, rexNodeSourceExpressionListBuilder.build(), false); }
private RelNode convertUpdate(SqlUpdate call) { final SqlValidatorScope scope = validator.getWhereScope(call.getSourceSelect()); Blackboard bb = createBlackboard(scope, null, false); Builder<RexNode> rexNodeSourceExpressionListBuilder = ImmutableList.builder(); for (SqlNode n : call.getSourceExpressionList()) { RexNode rn = bb.convertExpression(n); rexNodeSourceExpressionListBuilder.add(rn); } RelOptTable targetTable = getTargetTable(call); // convert update column list from SqlIdentifier to String final List<String> targetColumnNameList = new ArrayList<>(); final RelDataType targetRowType = targetTable.getRowType(); for (SqlNode node : call.getTargetColumnList()) { SqlIdentifier id = (SqlIdentifier) node; RelDataTypeField field = SqlValidatorUtil.getTargetField( targetRowType, typeFactory, id, catalogReader, targetTable); assert field != null : "column " + id.toString() + " not found"; targetColumnNameList.add(field.getName()); } RelNode sourceRel = convertSelect(call.getSourceSelect(), false); return LogicalTableModify.create(targetTable, catalogReader, sourceRel, LogicalTableModify.Operation.UPDATE, targetColumnNameList, rexNodeSourceExpressionListBuilder.build(), false); }
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 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); }
RelOptUtil.createProject(join, projects, null, true); return LogicalTableModify.create(targetTable, catalogReader, massagedRel, LogicalTableModify.Operation.MERGE, targetColumnNameList, null, false);
private RelNode convertUpdate(SqlUpdate call) { final SqlValidatorScope scope = validator.getWhereScope(call.getSourceSelect()); Blackboard bb = createBlackboard(scope, null, false); Builder<RexNode> rexNodeSourceExpressionListBuilder = ImmutableList.builder(); for (SqlNode n : call.getSourceExpressionList()) { RexNode rn = bb.convertExpression(n); rexNodeSourceExpressionListBuilder.add(rn); } RelOptTable targetTable = getTargetTable(call); // convert update column list from SqlIdentifier to String final List<String> targetColumnNameList = new ArrayList<>(); final RelDataType targetRowType = targetTable.getRowType(); for (SqlNode node : call.getTargetColumnList()) { SqlIdentifier id = (SqlIdentifier) node; RelDataTypeField field = SqlValidatorUtil.getTargetField( targetRowType, typeFactory, id, catalogReader, targetTable); assert field != null : "column " + id.toString() + " not found"; targetColumnNameList.add(field.getName()); } RelNode sourceRel = convertSelect(call.getSourceSelect(), false); return LogicalTableModify.create(targetTable, catalogReader, sourceRel, LogicalTableModify.Operation.UPDATE, targetColumnNameList, rexNodeSourceExpressionListBuilder.build(), false); }
/** 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); }
/** 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); }
/** 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); }
/** 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); }