本文整理汇总了Java中org.apache.calcite.rel.logical.LogicalValues类的典型用法代码示例。如果您正苦于以下问题:Java LogicalValues类的具体用法?Java LogicalValues怎么用?Java LogicalValues使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
LogicalValues类属于org.apache.calcite.rel.logical包,在下文中一共展示了LogicalValues类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: visit
import org.apache.calcite.rel.logical.LogicalValues; //导入依赖的package包/类
@Override
public RelNode visit(LogicalValues values) {
return new LogicalValues(
cluster,
copyOf(values.getTraitSet()),
copyOf(values.getRowType()),
copyOf(values.getTuples())
);
}
示例2: convert
import org.apache.calcite.rel.logical.LogicalValues; //导入依赖的package包/类
@Override public RelNode convert(RelNode rel) {
LogicalValues values = (LogicalValues) rel;
return new SparkValues(
values.getCluster(),
values.getRowType(),
values.getTuples(),
values.getTraitSet().replace(getOutTrait()));
}
示例3: rewriteRel
import org.apache.calcite.rel.logical.LogicalValues; //导入依赖的package包/类
public void rewriteRel(LogicalValues rel) {
// NOTE jvs 30-Apr-2006: UDT instances require invocation
// of a constructor method, which can't be represented
// by the tuples stored in a LogicalValues, so we don't have
// to worry about them here.
rewriteGeneric(rel);
}
示例4: doApply
import org.apache.calcite.rel.logical.LogicalValues; //导入依赖的package包/类
@Override
public RelNode doApply(LogicalTableModify tableModify, JournalledJdbcTable journalTable,
JdbcRelBuilderFactory relBuilderFactory) {
JdbcRelBuilder relBuilder = relBuilderFactory.create(
tableModify.getCluster(),
tableModify.getTable().getRelOptSchema()
);
RelNode input = tableModify.getInput();
if (input instanceof LogicalValues) {
// TODO: do we need to do anything here?
relBuilder.push(input);
}
else if (input instanceof LogicalProject) {
LogicalProject project = (LogicalProject) input;
List<RexNode> desiredFields = new ArrayList<>();
List<String> desiredNames = new ArrayList<>();
for (Pair<RexNode, String> field : project.getNamedProjects()) {
if (field.getKey() instanceof RexInputRef) {
desiredFields.add(field.getKey());
desiredNames.add(field.getValue());
}
}
relBuilder.push(project.getInput());
relBuilder.project(desiredFields, desiredNames);
}
else {
throw new IllegalStateException("Unknown Calcite INSERT structure");
}
relBuilder.insertCopying(
tableModify,
journalTable.getJournalTable()
);
return relBuilder.build();
}
示例5: DrillValuesRule
import org.apache.calcite.rel.logical.LogicalValues; //导入依赖的package包/类
private DrillValuesRule() {
super(RelOptHelper.any(LogicalValues.class, Convention.NONE), "DrillValuesRule");
}
示例6: onMatch
import org.apache.calcite.rel.logical.LogicalValues; //导入依赖的package包/类
@Override
public void onMatch(RelOptRuleCall call) {
final LogicalValues values = (LogicalValues) call.rel(0);
final RelTraitSet traits = values.getTraitSet().plus(DrillRel.DRILL_LOGICAL);
call.transformTo(new DrillValuesRel(values.getCluster(), values.getRowType(), values.getTuples(), traits));
}
示例7: visit
import org.apache.calcite.rel.logical.LogicalValues; //导入依赖的package包/类
@Override
public RelNode visit(LogicalValues values) {
values.getCluster().setMetadataProvider(metadataProvider);
return super.visit(values);
}
示例8: visit
import org.apache.calcite.rel.logical.LogicalValues; //导入依赖的package包/类
@Override
public RelNode visit(LogicalValues values) {
return visit((RelNode) values);
}
示例9: ValuesRule
import org.apache.calcite.rel.logical.LogicalValues; //导入依赖的package包/类
private ValuesRule() {
super(RelOptHelper.any(LogicalValues.class, Convention.NONE), "ValuesRule");
}
示例10: onMatch
import org.apache.calcite.rel.logical.LogicalValues; //导入依赖的package包/类
@Override
public void onMatch(RelOptRuleCall call) {
final LogicalValues values = (LogicalValues) call.rel(0);
final RelTraitSet traits = values.getTraitSet().plus(Rel.LOGICAL);
call.transformTo(new ValuesRel(values.getCluster(), values.getRowType(), values.getTuples(), traits));
}
示例11: BeamValuesRule
import org.apache.calcite.rel.logical.LogicalValues; //导入依赖的package包/类
private BeamValuesRule() {
super(LogicalValues.class, Convention.NONE,
BeamLogicalConvention.INSTANCE, "BeamValuesRule");
}
示例12: convertValuesImpl
import org.apache.calcite.rel.logical.LogicalValues; //导入依赖的package包/类
/**
* Converts a values clause (as in "INSERT INTO T(x,y) VALUES (1,2)") into a
* relational expression.
*
* @param bb Blackboard
* @param values Call to SQL VALUES operator
* @param targetRowType Target row type
*/
private void convertValuesImpl(
Blackboard bb,
SqlCall values,
RelDataType targetRowType) {
// Attempt direct conversion to LogicalValues; if that fails, deal with
// fancy stuff like sub-queries below.
RelNode valuesRel =
convertRowValues(
bb,
values,
values.getOperandList(),
true,
targetRowType);
if (valuesRel != null) {
bb.setRoot(valuesRel, true);
return;
}
final List<RelNode> unionRels = new ArrayList<>();
for (SqlNode rowConstructor1 : values.getOperandList()) {
SqlCall rowConstructor = (SqlCall) rowConstructor1;
Blackboard tmpBb = createBlackboard(bb.scope, null, false);
replaceSubQueries(tmpBb, rowConstructor,
RelOptUtil.Logic.TRUE_FALSE_UNKNOWN);
final List<Pair<RexNode, String>> exps = new ArrayList<>();
for (Ord<SqlNode> operand : Ord.zip(rowConstructor.getOperandList())) {
exps.add(
Pair.of(
tmpBb.convertExpression(operand.e),
validator.deriveAlias(operand.e, operand.i)));
}
RelNode in =
(null == tmpBb.root)
? LogicalValues.createOneRow(cluster)
: tmpBb.root;
unionRels.add(
RelOptUtil.createProject(
in,
Pair.left(exps),
Pair.right(exps),
true));
}
if (unionRels.size() == 0) {
throw new AssertionError("empty values clause");
} else if (unionRels.size() == 1) {
bb.setRoot(
unionRels.get(0),
true);
} else {
bb.setRoot(
LogicalUnion.create(unionRels, true),
true);
}
// REVIEW jvs 22-Jan-2004: should I add
// mapScopeToLux.put(validator.getScope(values),bb.root);
// ?
}
示例13: JdbcValuesRule
import org.apache.calcite.rel.logical.LogicalValues; //导入依赖的package包/类
private JdbcValuesRule(JdbcConvention out) {
super(LogicalValues.class, Convention.NONE, out, "JdbcValuesRule");
}
示例14: convert
import org.apache.calcite.rel.logical.LogicalValues; //导入依赖的package包/类
@Override
public RelNode convert(RelNode rel) {
LogicalValues values = (LogicalValues) rel;
return new JdbcValues(values.getCluster(), values.getRowType(),
values.getTuples(), values.getTraitSet().replace(getOut()));
}
示例15: convertValuesImpl
import org.apache.calcite.rel.logical.LogicalValues; //导入依赖的package包/类
/**
* Converts a values clause (as in "INSERT INTO T(x,y) VALUES (1,2)") into a
* relational expression.
*
* @param bb Blackboard
* @param values Call to SQL VALUES operator
* @param targetRowType Target row type
*/
private void convertValuesImpl(
Blackboard bb,
SqlCall values,
RelDataType targetRowType) {
// Attempt direct conversion to LogicalValues; if that fails, deal with
// fancy stuff like sub-queries below.
RelNode valuesRel =
convertRowValues(
bb,
values,
values.getOperandList(),
true,
targetRowType);
if (valuesRel != null) {
bb.setRoot(valuesRel, true);
return;
}
final List<RelNode> unionRels = new ArrayList<>();
for (SqlNode rowConstructor1 : values.getOperandList()) {
SqlCall rowConstructor = (SqlCall) rowConstructor1;
Blackboard tmpBb = createBlackboard(bb.scope, null, false);
replaceSubQueries(tmpBb, rowConstructor,
RelOptUtil.Logic.TRUE_FALSE_UNKNOWN);
final List<Pair<RexNode, String>> exps = new ArrayList<>();
for (Ord<SqlNode> operand : Ord.zip(rowConstructor.getOperandList())) {
exps.add(
Pair.of(
tmpBb.convertExpression(operand.e),
validator.deriveAlias(operand.e, operand.i)));
}
RelNode in =
(null == tmpBb.root)
? LogicalValues.createOneRow(cluster)
: tmpBb.root;
unionRels.add(
RelOptUtil.createProject(
in,
Pair.left(exps),
Pair.right(exps),
true));
}
if (unionRels.size() == 0) {
throw new AssertionError("empty values clause");
} else if (unionRels.size() == 1) {
bb.setRoot(
unionRels.get(0),
true);
} else {
bb.setRoot(
LogicalUnion.create(unionRels, true),
true);
}
// REVIEW jvs 22-Jan-2004: should I add
// mapScopeToLux.put(validator.getScope(values),bb.root);
// ?
}