• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java LogicalFilter类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: convert

import org.apache.calcite.rel.logical.LogicalFilter; //导入依赖的package包/类
public RelNode convert(RelNode rel) {
    final LogicalFilter filter = (LogicalFilter) rel;
    final RelTraitSet traitSet = filter.getTraitSet().replace(out);
    return new GremlinFilter(
            rel.getCluster(),
            traitSet,
            convert(filter.getInput(), out),
            filter.getCondition());
}
 
开发者ID:twilmes,项目名称:sql-gremlin,代码行数:10,代码来源:GremlinRules.java


示例17: onMatch

import org.apache.calcite.rel.logical.LogicalFilter; //导入依赖的package包/类
@Override
public void onMatch(RelOptRuleCall call) {
  final LogicalFilter filter = call.rel(0);
  Aggregate aggregate2 = call.rel(1);
  final Project project = call.rel(2);
  final StarTable.StarTableScan scan = call.rel(3);
  apply(call, null, filter, aggregate2, project, scan);
}
 
开发者ID:qubole,项目名称:quark,代码行数:9,代码来源:FilterAggStarRule.java


示例18: toRel

import org.apache.calcite.rel.logical.LogicalFilter; //导入依赖的package包/类
public RelNode toRel(
    RelOptTable.ToRelContext context,
    RelOptTable relOptTable) {
  // Request all fields.
  RelNode rel = new QuarkTileScan(context.getCluster(),
      this.relOptTable, this.quarkTile, this.backingTable);

  //Create a filter

  RexBuilder rexBuilder = rel.getCluster().getRexBuilder();
  List<RexNode> filterArgs = Lists.newArrayList();
  filterArgs.add(rexBuilder.makeInputRef(rel, this.quarkTile.groupingColumn));
  filterArgs.add(rexBuilder.makeLiteral(bitSetToString(this.quarkTile.groupingValue)));

  rel = LogicalFilter.create(rel, rexBuilder.makeCall(SqlStdOperatorTable.EQUALS, filterArgs));

  //Create a project list
  List<Integer> posList = Lists.newArrayList();
  for (QuarkTile.Column quarkColumn : this.quarkTile.cubeColumns) {
    posList.add(quarkColumn.cubeOrdinal);
  }

  for (Lattice.Measure measure : this.quarkTile.measures) {
    posList.add(((QuarkTile.Measure) measure).ordinal);
  }

  return RelOptUtil.createProject(rel, posList);

}
 
开发者ID:qubole,项目名称:quark,代码行数:30,代码来源:QuarkTileTable.java


示例19: onMatch

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

    RelTraitSet origTraitSet = filter.getTraitSet();
    RelTraitSet traitSet = origTraitSet.replace(OLAPRel.CONVENTION).simplify();

    OLAPFilterRel olapFilter = new OLAPFilterRel(filter.getCluster(), traitSet, convert(filter.getInput(), traitSet), filter.getCondition());
    call.transformTo(olapFilter);
}
 
开发者ID:apache,项目名称:kylin,代码行数:11,代码来源:OLAPFilterRule.java


示例20: transformToFarragoUdxRel

import org.apache.calcite.rel.logical.LogicalFilter; //导入依赖的package包/类
protected void transformToFarragoUdxRel(
      RelOptRuleCall call,
      SplunkTableScan splunkRel,
      LogicalFilter filter,
      LogicalProject topProj,
      LogicalProject bottomProj) {
    assert false;
/*
    RelNode rel =
        new EnumerableTableScan(
            udxRel.getCluster(),
            udxRel.getTable(),
            udxRel.getRowType(),
            udxRel.getServerMofId());

    rel = RelOptUtil.createCastRel(rel, udxRel.getRowType(), true);

    rel = addProjectionRule(bottomProj, rel);

    if (filter != null) {
      rel =
          new LogicalFilter(filter.getCluster(), rel, filter.getCondition());
    }

    rel = addProjectionRule(topProj, rel);

    call.transformTo(rel);
*/
  }
 
开发者ID:apache,项目名称:calcite,代码行数:30,代码来源:SplunkPushDownRule.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java MemberValuePair类代码示例发布时间:2022-05-21
下一篇:
Java MCVersion类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap