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


Java LogicalFilter类代码示例

本文整理汇总了Java中org.apache.calcite.rel.logical.LogicalFilter的典型用法代码示例。如果您正苦于以下问题:Java LogicalFilter类的具体用法?Java LogicalFilter怎么用?Java LogicalFilter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


LogicalFilter类属于org.apache.calcite.rel.logical包,在下文中一共展示了LogicalFilter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onMatch

import org.apache.calcite.rel.logical.LogicalFilter; //导入依赖的package包/类
public void onMatch(RelOptRuleCall call) {
  Filter filterRel = call.rel(0);
  Project projRel = call.rel(1);

  // Don't push Filter past Project if the Filter is referencing an ITEM or a FLATTEN expression
  // from the Project.
  //\TODO: Ideally we should split up the filter conditions into ones that
  // reference the ITEM expression and ones that don't and push the latter past the Project
  if (findItemOrFlatten(filterRel.getCondition(), projRel.getProjects()) != null) {
    return;
  }

  // convert the filter to one that references the child of the project
  RexNode newCondition =
      RelOptUtil.pushFilterPastProject(filterRel.getCondition(), projRel);

  Filter newFilterRel = LogicalFilter.create(projRel.getInput(), newCondition);

  Project newProjRel =
      (Project) RelOptUtil.createProject(
          newFilterRel,
          projRel.getNamedProjects(),
          false);

  call.transformTo(newProjRel);
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:27,代码来源:DrillPushFilterPastProjectRule.java

示例2: matches

import org.apache.calcite.rel.logical.LogicalFilter; //导入依赖的package包/类
@Override
public boolean matches(RelOptRuleCall call) {
  try {

    final LogicalFilter filter = (LogicalFilter) call.rel(0);
    for (RexNode node : filter.getChildExps()) {
      if (!checkedExpressions.get(node)) {
        return false;
      }
    }
    return true;

  } catch (ExecutionException e) {
    throw new IllegalStateException("Failure while trying to evaluate pushdown.", e);
  }
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:17,代码来源:DrillJdbcRuleBase.java

示例3: visit

import org.apache.calcite.rel.logical.LogicalFilter; //导入依赖的package包/类
@Override
public RelNode visit(final LogicalFilter filter) {
  final RelBuilder relBuilder = newCalciteRelBuilderWithoutContext(filter.getCluster());
  RelNode input = filter.getInput().accept(this);
  relBuilder.push(input);

  RexNode newCondition = filter.getCondition().accept(new RexShuttle() {
    @Override
    public RexNode visitInputRef(RexInputRef inputRef) {
      return relBuilder.field(filter.getRowType().getFieldNames().get(inputRef.getIndex()));
    }
  });

  relBuilder.filter(newCondition);
  return relBuilder.build();
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:17,代码来源:IncrementalUpdateUtils.java

示例4: translate

import org.apache.calcite.rel.logical.LogicalFilter; //导入依赖的package包/类
public void translate(final LogicalFilter filter, final TranslatorContext context) {
  MessageStream<SamzaSqlRelMessage> inputStream = context.getMessageStream(filter.getInput().getId());
  Expression expr =
      context.getExpressionCompiler().compile(filter.getInputs(), Collections.singletonList(filter.getCondition()));

  MessageStream<SamzaSqlRelMessage> outputStream = inputStream.filter(message -> {
    Object[] result = new Object[1];
    expr.execute(context.getExecutionContext(), context.getDataContext(), message.getRelFieldValues().toArray(), result);
    if (result.length > 0 && result[0] instanceof Boolean) {
      boolean retVal = (Boolean) result[0];
      log.debug(
          String.format("return value for input %s is %s", Arrays.asList(message.getFieldValues()).toString(), retVal));
      return retVal;
    } else {
      log.error("return value is not boolean");
      return false;
    }
  });

  context.registerMessageStream(filter.getId(), outputStream);
}
 
开发者ID:apache,项目名称:samza,代码行数:22,代码来源:FilterTranslator.java

示例5: onMatch

import org.apache.calcite.rel.logical.LogicalFilter; //导入依赖的package包/类
public void onMatch(RelOptRuleCall call) {
  LogicalFilter filter = call.rel(0);
  MultiJoin multiJoin = call.rel(1);

  MultiJoin newMultiJoin =
      new MultiJoin(
          multiJoin.getCluster(),
          multiJoin.getInputs(),
          multiJoin.getJoinFilter(),
          multiJoin.getRowType(),
          multiJoin.isFullOuterJoin(),
          multiJoin.getOuterJoinConditions(),
          multiJoin.getJoinTypes(),
          multiJoin.getProjFields(),
          multiJoin.getJoinFieldRefCountsMap(),
          filter.getCondition());

  call.transformTo(newMultiJoin);
}
 
开发者ID:apache,项目名称:calcite,代码行数:20,代码来源:FilterMultiJoinMergeRule.java

示例6: onMatch

import org.apache.calcite.rel.logical.LogicalFilter; //导入依赖的package包/类
public void onMatch(RelOptRuleCall call) {
  SemiJoin semiJoin = call.rel(0);
  LogicalFilter filter = call.rel(1);

  RelNode newSemiJoin =
      SemiJoin.create(filter.getInput(),
          semiJoin.getRight(),
          semiJoin.getCondition(),
          semiJoin.getLeftKeys(),
          semiJoin.getRightKeys());

  final RelFactories.FilterFactory factory =
      RelFactories.DEFAULT_FILTER_FACTORY;
  RelNode newFilter =
      factory.createFilter(newSemiJoin, filter.getCondition());

  call.transformTo(newFilter);
}
 
开发者ID:apache,项目名称:calcite,代码行数:19,代码来源:SemiJoinFilterTransposeRule.java

示例7: splitCorrelatedFilterCondition

import org.apache.calcite.rel.logical.LogicalFilter; //导入依赖的package包/类
@Deprecated // to be removed before 2.0
public static RexNode splitCorrelatedFilterCondition(
    LogicalFilter filter,
    List<RexInputRef> joinKeys,
    List<RexNode> correlatedJoinKeys) {
  final List<RexNode> nonEquiList = new ArrayList<>();

  splitCorrelatedFilterCondition(
      filter,
      filter.getCondition(),
      joinKeys,
      correlatedJoinKeys,
      nonEquiList);

  // Convert the remainders into a list that are AND'ed together.
  return RexUtil.composeConjunction(
      filter.getCluster().getRexBuilder(), nonEquiList, true);
}
 
开发者ID:apache,项目名称:calcite,代码行数:19,代码来源:RelOptUtil.java

示例8: onMatch

import org.apache.calcite.rel.logical.LogicalFilter; //导入依赖的package包/类
public void onMatch(RelOptRuleCall call) {
  final LogicalFilter filter = call.rel(0);
  final LogicalProject project = call.rel(1);

  final List<RexNode> newProjects = new ArrayList<>(project.getProjects());
  newProjects.add(filter.getCondition());

  final RelOptCluster cluster = filter.getCluster();
  RelDataType newRowType =
      cluster.getTypeFactory().builder()
          .addAll(project.getRowType().getFieldList())
          .add("condition", Util.last(newProjects).getType())
          .build();
  final RelNode newProject =
      project.copy(project.getTraitSet(),
          project.getInput(),
          newProjects,
          newRowType);

  final RexInputRef newCondition =
      cluster.getRexBuilder().makeInputRef(newProject,
          newProjects.size() - 1);

  call.transformTo(LogicalFilter.create(newProject, newCondition));
}
 
开发者ID:apache,项目名称:calcite,代码行数:26,代码来源:SubstitutionVisitor.java

示例9: toRel

import org.apache.calcite.rel.logical.LogicalFilter; //导入依赖的package包/类
@Override public RelNode toRel(ToRelContext context) {
  RelNode rel = LogicalTableScan.create(context.getCluster(), fromTable);
  final RexBuilder rexBuilder = context.getCluster().getRexBuilder();
  rel = LogicalFilter.create(
      rel, getConstraint(rexBuilder, rel.getRowType()));
  final List<RelDataTypeField> fieldList =
      rel.getRowType().getFieldList();
  final List<Pair<RexNode, String>> projects =
      new AbstractList<Pair<RexNode, String>>() {
        @Override public Pair<RexNode, String> get(int index) {
          return RexInputRef.of2(mapping.get(index), fieldList);
        }

        @Override public int size() {
          return mapping.size();
        }
      };
  return LogicalProject.create(rel, Pair.left(projects),
      Pair.right(projects));
}
 
开发者ID:apache,项目名称:calcite,代码行数:21,代码来源:MockCatalogReader.java

示例10: onMatch

import org.apache.calcite.rel.logical.LogicalFilter; //导入依赖的package包/类
@Override
public void onMatch(RelOptRuleCall call) {
  final LogicalFilter filter = (LogicalFilter) call.rel(0);
  final RelNode input = filter.getInput();
  //final RelTraitSet traits = filter.getTraitSet().plus(DrillRel.DRILL_LOGICAL);
  final RelNode convertedInput = convert(input, input.getTraitSet().plus(DrillRel.DRILL_LOGICAL));
  call.transformTo(new DrillFilterRel(filter.getCluster(), convertedInput.getTraitSet(), convertedInput, filter.getCondition()));
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:9,代码来源:DrillFilterRule.java

示例11: visit

import org.apache.calcite.rel.logical.LogicalFilter; //导入依赖的package包/类
@Override
public RelNode visit(LogicalFilter filter) {
  final RelNode input = filter.getInput().accept(this);
  return new LogicalFilter(
    cluster,
    copyOf(filter.getTraitSet()),
    input,
    copyOf(filter.getCondition()),
    ImmutableSet.copyOf(filter.getVariablesSet())
  );
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:12,代码来源:CopyWithCluster.java

示例12: visit

import org.apache.calcite.rel.logical.LogicalFilter; //导入依赖的package包/类
@Override
public RelNode visit(LogicalFilter filter) {
  final RexNode condition = filter.getCondition().accept(unwrappingExpressionVisitor);
  filter = filter.copy(
      filter.getTraitSet(),
      filter.getInput(),
      condition);
  return visitChild(filter, 0, filter.getInput());
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:10,代码来源:PreProcessRel.java

示例13: onMatch

import org.apache.calcite.rel.logical.LogicalFilter; //导入依赖的package包/类
@Override
public void onMatch(RelOptRuleCall call) {
  final LogicalFilter filter = (LogicalFilter) call.rel(0);
  final RelNode input = filter.getInput();
  //final RelTraitSet traits = filter.getTraitSet().plus(Rel.LOGICAL);
  final RelNode convertedInput = convert(input, input.getTraitSet().plus(Rel.LOGICAL).simplify());
  call.transformTo(new FilterRel(filter.getCluster(), convertedInput.getTraitSet(), convertedInput, filter.getCondition()));
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:9,代码来源:FilterRule.java

示例14: visit

import org.apache.calcite.rel.logical.LogicalFilter; //导入依赖的package包/类
@Override
public RelNode visit(final LogicalFilter filter) {
	try {
		stack.push(filter);
		filter.getCondition().accept(rexVisitor(filter));
	} finally {
		stack.pop();
	}
	return super.visit(filter);
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:11,代码来源:FlinkRelDecorrelator.java

示例15: convert

import org.apache.calcite.rel.logical.LogicalFilter; //导入依赖的package包/类
public RelNode convert(RelNode rel) {
    final LogicalFilter filter = (LogicalFilter) rel;

    return new JdbcFilter(
            rel.getCluster(),
            rel.getTraitSet().replace(getOut()),
            convert(filter.getInput(),
                    filter.getInput().getTraitSet().replace(getOut())),
            filter.getCondition());
}
 
开发者ID:bitnine-oss,项目名称:octopus,代码行数:11,代码来源:JdbcRules.java


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