当前位置: 首页>>代码示例>>Java>>正文


Java LogicalValues类代码示例

本文整理汇总了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())
  );
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:11,代码来源:CopyWithCluster.java

示例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()));
}
 
开发者ID:apache,项目名称:calcite,代码行数:9,代码来源:SparkRules.java

示例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);
}
 
开发者ID:apache,项目名称:calcite,代码行数:8,代码来源:RelStructuredTypeFlattener.java

示例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();

}
 
开发者ID:tzolov,项目名称:calcite-sql-rewriter,代码行数:45,代码来源:JournalledInsertRule.java

示例5: DrillValuesRule

import org.apache.calcite.rel.logical.LogicalValues; //导入依赖的package包/类
private DrillValuesRule() {
  super(RelOptHelper.any(LogicalValues.class, Convention.NONE), "DrillValuesRule");
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:4,代码来源:DrillValuesRule.java

示例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));
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:7,代码来源:DrillValuesRule.java

示例7: visit

import org.apache.calcite.rel.logical.LogicalValues; //导入依赖的package包/类
@Override
public RelNode visit(LogicalValues values) {
  values.getCluster().setMetadataProvider(metadataProvider);
  return super.visit(values);
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:6,代码来源:DefaultSqlHandler.java

示例8: visit

import org.apache.calcite.rel.logical.LogicalValues; //导入依赖的package包/类
@Override
public RelNode visit(LogicalValues values) {
  return visit((RelNode) values);
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:5,代码来源:RoutingShuttle.java

示例9: ValuesRule

import org.apache.calcite.rel.logical.LogicalValues; //导入依赖的package包/类
private ValuesRule() {
  super(RelOptHelper.any(LogicalValues.class, Convention.NONE), "ValuesRule");
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:4,代码来源:ValuesRule.java

示例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));
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:7,代码来源:ValuesRule.java

示例11: BeamValuesRule

import org.apache.calcite.rel.logical.LogicalValues; //导入依赖的package包/类
private BeamValuesRule() {
  super(LogicalValues.class, Convention.NONE,
      BeamLogicalConvention.INSTANCE, "BeamValuesRule");
}
 
开发者ID:apache,项目名称:beam,代码行数:5,代码来源:BeamValuesRule.java

示例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);
	// ?
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:68,代码来源:SqlToRelConverter.java

示例13: JdbcValuesRule

import org.apache.calcite.rel.logical.LogicalValues; //导入依赖的package包/类
private JdbcValuesRule(JdbcConvention out) {
    super(LogicalValues.class, Convention.NONE, out, "JdbcValuesRule");
}
 
开发者ID:bitnine-oss,项目名称:octopus,代码行数:4,代码来源:JdbcRules.java

示例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()));
}
 
开发者ID:bitnine-oss,项目名称:octopus,代码行数:7,代码来源:JdbcRules.java

示例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);
  // ?
}
 
开发者ID:apache,项目名称:kylin,代码行数:68,代码来源:SqlToRelConverter.java


注:本文中的org.apache.calcite.rel.logical.LogicalValues类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。