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


Java RexNode.accept方法代码示例

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


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

示例1: visitCall

import org.apache.calcite.rex.RexNode; //导入方法依赖的package包/类
@Override
public Boolean visitCall(RexCall call) {
  if (call.getOperator() == SqlStdOperatorTable.ITEM) {
    final RexNode op0 = call.getOperands().get(0);
    final RexNode op1 = call.getOperands().get(1);

    if (op0 instanceof RexInputRef &&
        op1 instanceof RexLiteral && ((RexLiteral) op1).getTypeName() == SqlTypeName.CHAR) {
      return true;
    } else if (op0 instanceof RexCall &&
        op1 instanceof RexLiteral && ((RexLiteral) op1).getTypeName() == SqlTypeName.CHAR) {
      return op0.accept(this);
    }
  }

  return false;
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:18,代码来源:ProjectRelBase.java

示例2: halfTree

import org.apache.calcite.rex.RexNode; //导入方法依赖的package包/类
@Test
public void halfTree(){
  final RexNode node =
      builder.makeCall(SqlStdOperatorTable.AND,
      builder.makeCall(SqlStdOperatorTable.EQUALS,
          builder.makeInputRef(factory.createSqlType(SqlTypeName.BIGINT), 0),
          builder.makeBigintLiteral(BigDecimal.ONE)
          ),
      builder.makeApproxLiteral(BigDecimal.ONE)
      );

  FindSimpleFilters finder = new FindSimpleFilters(builder);
  StateHolder holder = node.accept(finder);
  ImmutableList<RexCall> conditions = holder.getConditions();

  assertEquals(1, conditions.size());
  assertEquals(SqlKind.EQUALS, conditions.get(0).getKind());
  assertEquals(SqlKind.LITERAL, holder.getNode().getKind());
  assertTrue(holder.hasRemainingExpression());
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:21,代码来源:TestFilterFinder.java

示例3: doubleAnd

import org.apache.calcite.rex.RexNode; //导入方法依赖的package包/类
@Test
public void doubleAnd(){
  final RexNode node =
      builder.makeCall(SqlStdOperatorTable.AND,
      builder.makeCall(SqlStdOperatorTable.EQUALS,
          builder.makeInputRef(factory.createSqlType(SqlTypeName.BIGINT), 0),
          builder.makeBigintLiteral(BigDecimal.ONE)
          ),
      builder.makeCall(SqlStdOperatorTable.EQUALS,
          builder.makeInputRef(factory.createSqlType(SqlTypeName.BIGINT), 0),
          builder.makeBigintLiteral(BigDecimal.ONE)
          )
      );

  FindSimpleFilters finder = new FindSimpleFilters(builder);
  StateHolder holder = node.accept(finder);
  ImmutableList<RexCall> conditions = holder.getConditions();

  assertEquals(2, conditions.size());
  assertEquals(SqlKind.EQUALS, conditions.get(0).getKind());
  assertEquals(SqlKind.EQUALS, conditions.get(1).getKind());
  assertFalse(holder.hasRemainingExpression());
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:24,代码来源:TestFilterFinder.java

示例4: visit

import org.apache.calcite.rex.RexNode; //导入方法依赖的package包/类
@Override
public RelNode visit(LogicalJoin join) {
  RexNode node = join.getCondition();
  Set<List<String>> leftTables = getOriginTables(join.getLeft());
  Set<List<String>> rightTables = getOriginTables(join.getRight());
  InputCollector collector = new InputCollector(join);
  node.accept(collector);
  definitions.add(new JoinDefinition(join.getJoinType(), leftTables, rightTables, node, ImmutableMap.copyOf(collector.origins)));
  return super.visit(join);
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:11,代码来源:JoinExtractor.java

示例5: visitCandidate

import org.apache.calcite.rex.RexNode; //导入方法依赖的package包/类
private SchemaField visitCandidate(RexNode node){
  // build a qualified path.
  SchemaPath path = node.accept(new PathVisitor(scan.getRowType(), IndexMode.ALLOW));
  Preconditions.checkArgument(path != null, "Found an incomplete item path %s.", node);

  FieldAnnotation annotation = scan.getAnnotation(path);
  ElasticSpecialType specialType = scan.getSpecialTypeRecursive(path);
  Preconditions.checkArgument(!disallowedSpecialTypes.contains(specialType), "Unable to pushdown query, %s is of type %s.", path.getAsUnescapedPath(), specialType);
  TypedFieldId fieldId = scan.getBatchSchema().getFieldId(path);
  Preconditions.checkArgument(fieldId != null, "Unable to resolve item path %s.", node);
  CompleteType type = fieldId.getFinalType();

  return new SchemaField(fieldId.getFieldIds()[0], path, type, annotation, scan.getCluster().getTypeFactory(), specialType, isV5, isPainless);
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:15,代码来源:SchemaField.java

示例6: getColumns

import org.apache.calcite.rex.RexNode; //导入方法依赖的package包/类
public static ProjectPushInfo getColumns(RelDataType rowType, List<RexNode> projects) {
  final List<String> fieldNames = rowType.getFieldNames();
  if (fieldNames.isEmpty()) {
    return null;
  }

  RefFieldsVisitor v = new RefFieldsVisitor(rowType);
  for (RexNode exp : projects) {
    PathSegment segment = exp.accept(v);
    v.addColumn(segment);
  }

  return v.getInfo();

}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:16,代码来源:PrelUtil.java

示例7: visitCall

import org.apache.calcite.rex.RexNode; //导入方法依赖的package包/类
@Override
public Expression visitCall(RexCall call) {

  SqlSyntax syntax = call.getOperator().getSyntax();
  if (!supportedRexCall(call)) {
    throw new PredicateAnalyzerException(format("Unsupported call: [%s]", call));
  }

  switch (syntax) {
    case BINARY:
      return binary(call);
    case POSTFIX:
      return postfix(call);
    case SPECIAL:
      switch (call.getKind()) {
        case CAST:
          return cast(call);
        case LIKE:
          SqlLikeOperator likeOperator = (SqlLikeOperator) call.getOperator();
          if (!likeOperator.isNegated()) {
            return binary(call);
          }
          throw new PredicateAnalyzerException(format("Unsupported call: [%s]", call));
        default:
          throw new PredicateAnalyzerException(format("Unsupported call: [%s]", call));
      }
    case FUNCTION:
      if (call.getOperator().getName().equalsIgnoreCase("CONTAINS")) {
        List<Expression> operands = Lists.newArrayList();
        for (RexNode node : call.getOperands()) {
          final Expression nodeExpr = node.accept(this);
          operands.add(nodeExpr);
        }
        String query = convertQueryString(operands.subList(0, operands.size() - 1), operands.get(operands.size() - 1));
        return QueryExpression.create(new NamedFieldExpression(null)).queryString(query);
      }
    default:
      throw new PredicateAnalyzerException(format("Unsupported syntax [%s] for call: [%s]", syntax, call));
  }
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:41,代码来源:PredicateAnalyzer.java

示例8: visitCall

import org.apache.calcite.rex.RexNode; //导入方法依赖的package包/类
@Override
public Void visitCall(RexCall call) {
  if (call.getOperator() instanceof SqlFlattenOperator) {
    flattens.add(((SqlFlattenOperator)call.getOperator()).getIndex());
  }

  for (RexNode op : call.getOperands()) {
    op.accept(this);
  }

  return null;
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:13,代码来源:FlattenVisitors.java

示例9: visitCall

import org.apache.calcite.rex.RexNode; //导入方法依赖的package包/类
@Override
public Boolean visitCall(RexCall paramRexCall) {
  if(paramRexCall.getOperator() instanceof DrillSqlOperator){
    return false;
  }else{
    for (RexNode operand : paramRexCall.operands) {
      if (!operand.accept(this)) {
        return false;
      }
    }
  }
  return true;
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:14,代码来源:JdbcExpressionCheck.java

示例10: castANY

import org.apache.calcite.rex.RexNode; //导入方法依赖的package包/类
@Test
public void castANY(){
final RexNode node =
    builder.makeCast(
        factory.createSqlType(SqlTypeName.ANY),
        builder.makeBigintLiteral(BigDecimal.ONE)
    );

  FindSimpleFilters finder = new FindSimpleFilters(builder);
  StateHolder holder = node.accept(finder);
  ImmutableList<RexCall> conditions = holder.getConditions();

  assertEquals(0, conditions.size());
  assertEquals(builder.makeBigintLiteral(BigDecimal.ONE), holder.getNode());
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:16,代码来源:TestFilterFinder.java

示例11: render

import org.apache.calcite.rex.RexNode; //导入方法依赖的package包/类
@Override
public FunctionRender render(FunctionRenderer renderer, RexCall call) {
  List<Iterable<NullReference>> refs = new ArrayList<>();

  List<String> operands = Lists.newArrayListWithCapacity(call.getOperands().size());
  for (RexNode childCall : call.getOperands()) {
    FunctionRender r = childCall.accept(renderer.getVisitor());
    operands.add(r.getScript());
    refs.add(r.getNulls());
  }

  return new FunctionRender("( " + Joiner.on(" " + elasticName + " ").join(operands) + " )", Iterables.concat(refs));
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:14,代码来源:AndFunction.java

示例12: visitCall

import org.apache.calcite.rex.RexNode; //导入方法依赖的package包/类
@Override
public Boolean visitCall(RexCall call) {
  if (call.getOperator().getName().equalsIgnoreCase("flatten")) {
    return true;
  }

  for (RexNode op : call.getOperands()) {
    Boolean opResult = op.accept(this);
    if (opResult != null && opResult.booleanValue()) {
      return true;
    }
  }
  return false;
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:15,代码来源:MoreRelOptUtil.java

示例13: hasFlatten

import org.apache.calcite.rex.RexNode; //导入方法依赖的package包/类
public static boolean hasFlatten(Project project){
  for(RexNode n : project.getChildExps()){
    if(n.accept(new FlattenFinder())){
      return true;
    }
  }
  return false;
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:9,代码来源:FlattenVisitors.java

示例14: convert

import org.apache.calcite.rex.RexNode; //导入方法依赖的package包/类
public static RexNode convert(RexNode node, ElasticIntermediateScanPrel scan, Set<ElasticSpecialType> disallowedSpecialTypes){
  return node.accept(new SchemaingShuttle(scan, disallowedSpecialTypes));
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:4,代码来源:SchemaField.java

示例15: hasContainsCheckOrigin

import org.apache.calcite.rex.RexNode; //导入方法依赖的package包/类
public static boolean hasContainsCheckOrigin(RelNode node, RexNode rex, int index) {
  return rex.accept(new ContainsRexVisitor(true, node.getCluster().getMetadataQuery(), node, index));
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:4,代码来源:MoreRelOptUtil.java


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