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


Java RexCall.getOperator方法代码示例

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


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

示例1: visitCall

import org.apache.calcite.rex.RexCall; //导入方法依赖的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:skhalifa,项目名称:QDrill,代码行数:18,代码来源:DrillProjectRelBase.java

示例2: isConvertedSubq

import org.apache.calcite.rex.RexCall; //导入方法依赖的package包/类
/**
 * Determines whether a RexNode corresponds to a sub-query that's been
 * converted to a constant.
 *
 * @param rex the expression to be examined
 * @return true if the expression is a dynamic parameter, a literal, or
 * a literal that is being cast
 */
private boolean isConvertedSubq(RexNode rex) {
	if ((rex instanceof RexLiteral)
		|| (rex instanceof RexDynamicParam)) {
		return true;
	}
	if (rex instanceof RexCall) {
		RexCall call = (RexCall) rex;
		if (call.getOperator() == SqlStdOperatorTable.CAST) {
			RexNode operand = call.getOperands().get(0);
			if (operand instanceof RexLiteral) {
				return true;
			}
		}
	}
	return false;
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:25,代码来源:SqlToRelConverter.java

示例3: translateRexCall

import org.apache.calcite.rex.RexCall; //导入方法依赖的package包/类
TblColRef translateRexCall(RexCall call, ColumnRowType inputColumnRowType, String fieldName,
        Set<TblColRef> sourceCollector) {
    SqlOperator operator = call.getOperator();
    if (operator == SqlStdOperatorTable.EXTRACT_DATE) {
        return translateFirstRexInputRef(call, inputColumnRowType, fieldName, sourceCollector);
    } else if (operator instanceof SqlUserDefinedFunction) {
        if (operator.getName().equals("QUARTER")) {
            return translateFirstRexInputRef(call, inputColumnRowType, fieldName, sourceCollector);
        }
    }

    List<RexNode> children = limitTranslateScope(call.getOperands(), operator);

    for (RexNode operand : children) {
        translateRexNode(operand, inputColumnRowType, fieldName, sourceCollector);
    }
    return TblColRef.newInnerColumn(fieldName, InnerDataTypeEnum.LITERAL, call.toString());
}
 
开发者ID:apache,项目名称:kylin,代码行数:19,代码来源:OLAPProjectRel.java

示例4: isConvertedSubq

import org.apache.calcite.rex.RexCall; //导入方法依赖的package包/类
/**
 * Determines whether a RexNode corresponds to a sub-query that's been
 * converted to a constant.
 *
 * @param rex the expression to be examined
 * @return true if the expression is a dynamic parameter, a literal, or
 * a literal that is being cast
 */
private boolean isConvertedSubq(RexNode rex) {
  if ((rex instanceof RexLiteral)
      || (rex instanceof RexDynamicParam)) {
    return true;
  }
  if (rex instanceof RexCall) {
    RexCall call = (RexCall) rex;
    if (call.getOperator() == SqlStdOperatorTable.CAST) {
      RexNode operand = call.getOperands().get(0);
      if (operand instanceof RexLiteral) {
        return true;
      }
    }
  }
  return false;
}
 
开发者ID:apache,项目名称:kylin,代码行数:25,代码来源:SqlToRelConverter.java

示例5: isItem

import org.apache.calcite.rex.RexCall; //导入方法依赖的package包/类
/**
 * Returns 'string' if it is a call to item['string'], null otherwise.
 */
static String isItem(RexCall call) {
  if (call.getOperator() != SqlStdOperatorTable.ITEM) {
    return null;
  }
  final RexNode op0 = call.getOperands().get(0);
  final RexNode op1 = call.getOperands().get(1);

  if (op0 instanceof RexInputRef
      && ((RexInputRef) op0).getIndex() == 0
      && op1 instanceof RexLiteral
      && ((RexLiteral) op1).getValue2() instanceof String) {
    return (String) ((RexLiteral) op1).getValue2();
  }
  return null;
}
 
开发者ID:apache,项目名称:calcite,代码行数:19,代码来源:ElasticsearchRules.java

示例6: visitCall

import org.apache.calcite.rex.RexCall; //导入方法依赖的package包/类
@Override public String visitCall(RexCall call) {
  final String name = isItem(call);
  if (name != null) {
    return "\"" + name + "\"";
  }

  final List<String> strings = visitList(call.operands);
  if (call.getKind() == SqlKind.CAST) {
    return strings.get(0).startsWith("$") ? strings.get(0).substring(1) : strings.get(0);
  }
  if (call.getOperator() == SqlStdOperatorTable.ITEM) {
    final RexNode op1 = call.getOperands().get(1);
    if (op1 instanceof RexLiteral && op1.getType().getSqlTypeName() == SqlTypeName.INTEGER) {
      return stripQuotes(strings.get(0)) + "[" + ((RexLiteral) op1).getValue2() + "]";
    }
  }
  throw new IllegalArgumentException("Translation of " + call.toString()
    + "is not supported by ElasticsearchProject");
}
 
开发者ID:apache,项目名称:calcite,代码行数:20,代码来源:ElasticsearchRules.java

示例7: isQueryable

import org.apache.calcite.rex.RexCall; //导入方法依赖的package包/类
private boolean isQueryable() {
  if (!(getCall() instanceof RexCall)) {
    return false;
  }
  final RexCall call = (RexCall) getCall();
  if (!(call.getOperator() instanceof SqlUserDefinedTableFunction)) {
    return false;
  }
  final SqlUserDefinedTableFunction udtf =
      (SqlUserDefinedTableFunction) call.getOperator();
  if (!(udtf.getFunction() instanceof TableFunctionImpl)) {
    return false;
  }
  final TableFunctionImpl tableFunction =
      (TableFunctionImpl) udtf.getFunction();
  final Method method = tableFunction.method;
  return QueryableTable.class.isAssignableFrom(method.getReturnType());
}
 
开发者ID:apache,项目名称:calcite,代码行数:19,代码来源:EnumerableTableFunctionScan.java

示例8: visitCall

import org.apache.calcite.rex.RexCall; //导入方法依赖的package包/类
@Override
public RexNode visitCall(RexCall call) {
  SqlOperator op = call.getOperator();
  SqlKind kind = op.getKind();
  RelDataType type = call.getType();
  if (kind == SqlKind.OR || kind == SqlKind.AND) {
    if (call.getOperands().size() > 2) {
      List<RexNode> children = new ArrayList(call.getOperands());
      RexNode left = children.remove(0).accept(this);
      RexNode right = builder.makeCall(type, op, children).accept(this);
      return builder.makeCall(type, op, ImmutableList.of(left, right));
    }
  }
  return builder.makeCall(type, op, visitChildren(call));
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:16,代码来源:RewriteAsBinaryOperators.java

示例9: visitCall

import org.apache.calcite.rex.RexCall; //导入方法依赖的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: visitCall

import org.apache.calcite.rex.RexCall; //导入方法依赖的package包/类
@Override
public RexNode visitCall(final RexCall call) {
  final List<RexNode> clonedOperands = visitList(call.operands, new boolean[]{true});
  final SqlOperator sqlOperator = call.getOperator();
  return RexUtil.flatten(rexBuilder,
      rexBuilder.makeCall(
          call.getType(),
          sqlOperator,
          clonedOperands));
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:11,代码来源:PreProcessRel.java

示例11: visitCall

import org.apache.calcite.rex.RexCall; //导入方法依赖的package包/类
@Override
public RexNode visitCall(RexCall call) {
  SqlOperator op = call.getOperator();
  SqlKind kind = op.getKind();
  RelDataType type = call.getType();
  if (kind == SqlKind.OR || kind == SqlKind.AND) {
    if (call.getOperands().size() > 2) {
      List<RexNode> children = new ArrayList<>(call.getOperands());
      RexNode left = children.remove(0).accept(this);
      RexNode right = builder.makeCall(type, op, children).accept(this);
      return builder.makeCall(type, op, ImmutableList.of(left, right));
    }
  }
  return builder.makeCall(type, op, visitChildren(call));
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:16,代码来源:RewriteAsBinaryOperators.java

示例12: visitCall

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

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

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

示例13: visitCall

import org.apache.calcite.rex.RexCall; //导入方法依赖的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

示例14: visitCall

import org.apache.calcite.rex.RexCall; //导入方法依赖的package包/类
@Override
public RexNode visitCall(RexCall call) {
  final boolean isItem = call.getOperator().getSyntax() == SqlSyntax.SPECIAL && call.getOperator() == SqlStdOperatorTable.ITEM;
  if(isItem){
    return visitCandidate(call);
  }
  return super.visitCall(call);
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:9,代码来源:SchemaField.java

示例15: isItem

import org.apache.calcite.rex.RexCall; //导入方法依赖的package包/类
/** Returns 'string' if it is a call to item['string'], null otherwise. */
static String isItem(RexCall call) {
  if (call.getOperator() != SqlStdOperatorTable.ITEM) {
    return null;
  }
  final RexNode op0 = call.operands.get(0);
  final RexNode op1 = call.operands.get(1);
  if (op0 instanceof RexInputRef
      && ((RexInputRef) op0).getIndex() == 0
      && op1 instanceof RexLiteral
      && ((RexLiteral) op1).getValue2() instanceof String) {
    return (String) ((RexLiteral) op1).getValue2();
  }
  return null;
}
 
开发者ID:apache,项目名称:calcite,代码行数:16,代码来源:MongoRules.java


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