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


Java LogicalFilter.create方法代码示例

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


在下文中一共展示了LogicalFilter.create方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: visit

import org.apache.calcite.rel.logical.LogicalFilter; //导入方法依赖的package包/类
@Override
public RelNode visit(TableScan tableScan) {
  if (tableScan instanceof ConvertibleScan) {
    return ((ConvertibleScan) tableScan).convert().accept(this);
  }
  if (!(tableScan instanceof IncrementallyUpdateable)) {
    return tableScan;
  }

  final RelNode newScan = updateScan((IncrementallyUpdateable) tableScan);

  // build new filter to apply refresh condition.
  final RexBuilder rexBuilder = tableScan.getCluster().getRexBuilder();
  final RexNode inputRef = rexBuilder.makeInputRef(newScan, newScan.getRowType().getField(UPDATE_COLUMN, false, false).getIndex());
  final RexNode literal = generateLiteral(rexBuilder, tableScan.getCluster().getTypeFactory());
  final RexNode condition = tableScan.getCluster().getRexBuilder().makeCall(SqlStdOperatorTable.GREATER_THAN, ImmutableList.of(inputRef, literal));
  return LogicalFilter.create(newScan, condition);
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:19,代码来源:IncrementalUpdateUtils.java

示例3: 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

示例4: 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

示例5: onMatch

import org.apache.calcite.rel.logical.LogicalFilter; //导入方法依赖的package包/类
@Override public void onMatch(RelOptRuleCall call) {
  final Delta delta = call.rel(0);
  Util.discard(delta);
  final Filter filter = call.rel(1);
  final LogicalDelta newDelta = LogicalDelta.create(filter.getInput());
  final LogicalFilter newFilter =
      LogicalFilter.create(newDelta, filter.getCondition());
  call.transformTo(newFilter);
}
 
开发者ID:apache,项目名称:calcite,代码行数:10,代码来源:StreamRules.java

示例6: onMatch

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

  // get a conjunctions of the filter condition. For each conjunction, if it refers to ITEM or FLATTEN expression
  // then we could not pushed down. Otherwise, it's qualified to be pushed down.
  final List<RexNode> predList = RelOptUtil.conjunctions(filterRel.getCondition());

  final List<RexNode> qualifiedPredList = Lists.newArrayList();
  final List<RexNode> unqualifiedPredList = Lists.newArrayList();


  for (final RexNode pred : predList) {
    if (DrillRelOptUtil.findItemOrFlatten(pred, projRel.getProjects()) == null) {
      qualifiedPredList.add(pred);
    } else {
      unqualifiedPredList.add(pred);
    }
  }

  final RexNode qualifedPred =RexUtil.composeConjunction(filterRel.getCluster().getRexBuilder(), qualifiedPredList, true);

  if (qualifedPred == null) {
    return;
  }

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

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

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

  final RexNode unqualifiedPred = RexUtil.composeConjunction(filterRel.getCluster().getRexBuilder(), unqualifiedPredList, true);

  if (unqualifiedPred == null) {
    call.transformTo(newProjRel);
  } else {
    // if there are filters not qualified to be pushed down, then we have to put those filters on top of
    // the new Project operator.
    // Filter -- unqualified filters
    //   \
    //    Project
    //     \
    //      Filter  -- qualified filters
    Filter filterNotPushed = LogicalFilter.create(newProjRel, unqualifiedPred);
    call.transformTo(filterNotPushed);
  }
}
 
开发者ID:axbaretto,项目名称:drill,代码行数:55,代码来源:DrillPushFilterPastProjectRule.java

示例7: createFilter

import org.apache.calcite.rel.logical.LogicalFilter; //导入方法依赖的package包/类
public RelNode createFilter(RelNode input, RexNode condition) {
  return LogicalFilter.create(input, condition);
}
 
开发者ID:apache,项目名称:calcite,代码行数:4,代码来源:RelFactories.java

示例8: translate

import org.apache.calcite.rel.logical.LogicalFilter; //导入方法依赖的package包/类
public RelNode translate(Expression expression) {
  if (expression instanceof MethodCallExpression) {
    final MethodCallExpression call = (MethodCallExpression) expression;
    BuiltInMethod method = BuiltInMethod.MAP.get(call.method);
    if (method == null) {
      throw new UnsupportedOperationException(
          "unknown method " + call.method);
    }
    RelNode input;
    switch (method) {
    case SELECT:
      input = translate(call.targetExpression);
      return LogicalProject.create(input,
          toRex(input, (FunctionExpression) call.expressions.get(0)),
          (List<String>) null);

    case WHERE:
      input = translate(call.targetExpression);
      return LogicalFilter.create(input,
          toRex((FunctionExpression) call.expressions.get(0), input));

    case AS_QUERYABLE:
      return LogicalTableScan.create(cluster,
          RelOptTableImpl.create(null,
              typeFactory.createJavaType(
                  Types.toClass(
                      Types.getElementType(call.targetExpression.getType()))),
              ImmutableList.<String>of(),
              call.targetExpression));

    case SCHEMA_GET_TABLE:
      return LogicalTableScan.create(cluster,
          RelOptTableImpl.create(null,
              typeFactory.createJavaType((Class)
                  ((ConstantExpression) call.expressions.get(1)).value),
              ImmutableList.<String>of(),
              call.targetExpression));

    default:
      throw new UnsupportedOperationException(
          "unknown method " + call.method);
    }
  }
  throw new UnsupportedOperationException(
      "unknown expression type " + expression.getNodeType());
}
 
开发者ID:apache,项目名称:calcite,代码行数:47,代码来源:LixToRelTranslator.java


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