本文整理汇总了Java中org.apache.calcite.rel.core.TableModify类的典型用法代码示例。如果您正苦于以下问题:Java TableModify类的具体用法?Java TableModify怎么用?Java TableModify使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TableModify类属于org.apache.calcite.rel.core包,在下文中一共展示了TableModify类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: insertCopying
import org.apache.calcite.rel.core.TableModify; //导入依赖的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: visit
import org.apache.calcite.rel.core.TableModify; //导入依赖的package包/类
@Override
public RelInfo visit(RelContext context, RelNode node, List<RelInfo> inputStreams)
{
/**
* Only INSERT is allowed as it representation destination for DAG processing. Other types like UPDATE, DELETE,
* MERGE does not represent the same.
*/
TableModify modify = (TableModify)node;
Preconditions.checkArgument(modify.isInsert(), "Only INSERT allowed for table modify");
ApexSQLTable table = modify.getTable().unwrap(ApexSQLTable.class);
Endpoint endpoint = table.getEndpoint();
return endpoint.populateOutputDAG(context.dag, context.typeFactory);
}
示例3: convert
import org.apache.calcite.rel.core.TableModify; //导入依赖的package包/类
@Override
public RelNode convert(RelNode rel) {
final TableModify tableModify = (TableModify) rel;
final RelNode input = tableModify.getInput();
final RelOptCluster cluster = tableModify.getCluster();
final RelTraitSet traitSet = tableModify.getTraitSet().replace(BeamLogicalConvention.INSTANCE);
final RelOptTable relOptTable = tableModify.getTable();
final Prepare.CatalogReader catalogReader = tableModify.getCatalogReader();
final RelNode convertedInput = convert(input,
input.getTraitSet().replace(BeamLogicalConvention.INSTANCE));
final TableModify.Operation operation = tableModify.getOperation();
final List<String> updateColumnList = tableModify.getUpdateColumnList();
final List<RexNode> sourceExpressionList = tableModify.getSourceExpressionList();
final boolean flattened = tableModify.isFlattened();
final Table table = tableModify.getTable().unwrap(Table.class);
switch (table.getJdbcTableType()) {
case TABLE:
case STREAM:
if (operation != TableModify.Operation.INSERT) {
throw new UnsupportedOperationException(
String.format("Streams doesn't support %s modify operation", operation));
}
return new BeamIOSinkRel(cluster, traitSet,
relOptTable, catalogReader, convertedInput, operation, updateColumnList,
sourceExpressionList, flattened);
default:
throw new IllegalArgumentException(
String.format("Unsupported table type: %s", table.getJdbcTableType()));
}
}
示例4: traverse
import org.apache.calcite.rel.core.TableModify; //导入依赖的package包/类
public final T traverse(RelNode n) throws Exception {
List<T> inputStreams = new ArrayList<>();
for (RelNode input : n.getInputs()) {
inputStreams.add(traverse(input));
}
if (n instanceof Aggregate) {
return visitAggregate((Aggregate) n, inputStreams);
} else if (n instanceof Calc) {
return visitCalc((Calc) n, inputStreams);
} else if (n instanceof Collect) {
return visitCollect((Collect) n, inputStreams);
} else if (n instanceof Correlate) {
return visitCorrelate((Correlate) n, inputStreams);
} else if (n instanceof Delta) {
return visitDelta((Delta) n, inputStreams);
} else if (n instanceof Exchange) {
return visitExchange((Exchange) n, inputStreams);
} else if (n instanceof Project) {
return visitProject((Project) n, inputStreams);
} else if (n instanceof Filter) {
return visitFilter((Filter) n, inputStreams);
} else if (n instanceof Sample) {
return visitSample((Sample) n, inputStreams);
} else if (n instanceof Sort) {
return visitSort((Sort) n, inputStreams);
} else if (n instanceof TableModify) {
return visitTableModify((TableModify) n, inputStreams);
} else if (n instanceof TableScan) {
return visitTableScan((TableScan) n, inputStreams);
} else if (n instanceof Uncollect) {
return visitUncollect((Uncollect) n, inputStreams);
} else if (n instanceof Window) {
return visitWindow((Window) n, inputStreams);
} else if (n instanceof Join) {
return visitJoin((Join) n, inputStreams);
} else {
return defaultValue(n, inputStreams);
}
}
示例5: visitChild
import org.apache.calcite.rel.core.TableModify; //导入依赖的package包/类
public Result visitChild(int i, RelNode e) {
if (e instanceof Union) {
return visitUnion((Union) e);
} else if (e instanceof Join) {
return visitJoin((Join) e);
} else if (e instanceof Filter) {
return visitFilter((Filter) e);
} else if (e instanceof Project) {
return visitProject((Project) e);
} else if (e instanceof Aggregate) {
return visitAggregate((Aggregate) e);
} else if (e instanceof TableScan) {
return visitTableScan((TableScan) e);
} else if (e instanceof Intersect) {
return visitIntersect((Intersect) e);
} else if (e instanceof Minus) {
return visitMinus((Minus) e);
} else if (e instanceof Calc) {
return visitCalc((Calc) e);
} else if (e instanceof Sort) {
return visitSort((Sort) e);
} else if (e instanceof TableModify) {
return visitTableModify((TableModify) e);
} else if (e instanceof Limit) {
return visitLimit((Limit) e);
} else {
throw new AssertionError("Need to Implement for " + e.getClass().getName()); // TODO:
}
}
示例6: toModificationRel
import org.apache.calcite.rel.core.TableModify; //导入依赖的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);
}
示例7: toModificationRel
import org.apache.calcite.rel.core.TableModify; //导入依赖的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);
}
示例8: toModificationRel
import org.apache.calcite.rel.core.TableModify; //导入依赖的package包/类
/** Creates a relational expression that modifies this table. */
TableModify toModificationRel(
RelOptCluster cluster,
RelOptTable table,
Prepare.CatalogReader catalogReader,
RelNode child,
TableModify.Operation operation,
List<String> updateColumnList,
List<RexNode> sourceExpressionList,
boolean flattened);
示例9: visit
import org.apache.calcite.rel.core.TableModify; //导入依赖的package包/类
public void visit(
RelNode p,
int ordinal,
RelNode parent) {
super.visit(p, ordinal, parent);
RelOptTable table = p.getTable();
if (table == null) {
return;
}
Mode newAccess;
// FIXME jvs 1-Feb-2006: Don't rely on object type here;
// eventually someone is going to write a rule which transforms
// to something which doesn't inherit TableModify,
// and this will break. Need to make this explicit in
// the RelNode interface.
if (p instanceof TableModify) {
newAccess = Mode.WRITE_ACCESS;
} else {
newAccess = Mode.READ_ACCESS;
}
List<String> key = getQualifiedName(table);
Mode oldAccess = accessMap.get(key);
if ((oldAccess != null) && (oldAccess != newAccess)) {
newAccess = Mode.READWRITE_ACCESS;
}
accessMap.put(key, newAccess);
}
示例10: toModificationRel
import org.apache.calcite.rel.core.TableModify; //导入依赖的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);
}
示例11: convertToDrel
import org.apache.calcite.rel.core.TableModify; //导入依赖的package包/类
/**
* Given a relNode tree for SELECT statement, convert to Dremio Logical RelNode tree.
* @param relNode
* @return
* @throws SqlUnsupportedException
* @throws RelConversionException
*/
public static Rel convertToDrel(SqlHandlerConfig config, final RelNode relNode) throws SqlUnsupportedException, RelConversionException {
try {
final RelNode convertedRelNode;
final RelTraitSet logicalTraits = relNode.getTraitSet().plus(Rel.LOGICAL);
final RelNode intermediateNode = transform(config, PlannerType.VOLCANO, PlannerPhase.LOGICAL, relNode, logicalTraits, true);
// Do Join Planning.
convertedRelNode = transform(config, PlannerType.HEP_BOTTOM_UP, PlannerPhase.JOIN_PLANNING, intermediateNode, intermediateNode.getTraitSet(), true);
FlattenRelFinder flattenFinder = new FlattenRelFinder();
final RelNode flattendPushed;
if (flattenFinder.run(convertedRelNode)) {
flattendPushed = transform(config, PlannerType.VOLCANO, PlannerPhase.FLATTEN_PUSHDOWN, convertedRelNode, convertedRelNode.getTraitSet(), true);
} else {
flattendPushed = convertedRelNode;
}
final Rel drel = (Rel) flattendPushed;
if (drel instanceof TableModify) {
throw new UnsupportedOperationException("TableModify " + drel);
} else {
final Optional<SubstitutionInfo> acceleration = findUsedMaterializations(config, drel);
if (acceleration.isPresent()) {
config.getObserver().planAccelerated(acceleration.get());
}
return drel;
}
} catch (RelOptPlanner.CannotPlanException ex) {
logger.error(ex.getMessage(), ex);
if(JoinUtils.checkCartesianJoin(relNode, Lists.<Integer>newArrayList(), Lists.<Integer>newArrayList(), Lists.<Boolean>newArrayList())) {
throw new UnsupportedRelOperatorException("This query cannot be planned possibly due to either a cartesian join or an inequality join");
} else {
throw ex;
}
}
}
示例12: toModificationRel
import org.apache.calcite.rel.core.TableModify; //导入依赖的package包/类
@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);
}
示例13: visitTableModify
import org.apache.calcite.rel.core.TableModify; //导入依赖的package包/类
public T visitTableModify(TableModify modify, List<T> inputStreams) throws Exception {
return defaultValue(modify, inputStreams);
}
示例14: visitTableModify
import org.apache.calcite.rel.core.TableModify; //导入依赖的package包/类
public Result visitTableModify(TableModify e) {
throw new AssertionError(); // TODO:
}