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


Java RexCall.toString方法代码示例

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


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

示例1: extractEquals

import org.apache.calcite.rex.RexCall; //导入方法依赖的package包/类
private static JoinConditionInfo extractEquals(JoinDefinition joinDefinition, RexCall c) {
  List<RexNode> operands = c.getOperands();
  if (operands.size() != 2) {
    throw new IllegalArgumentException(c.toString());
  }
  RexNode opA = operands.get(0);
  RexNode opB = operands.get(1);
  RelColumnOrigin oA = getOrigin(joinDefinition, opA);
  RelColumnOrigin oB = getOrigin(joinDefinition, opB);

  if (oA == null || oB == null) {
    return null;
  }

  return new JoinConditionInfo(Origins.getColName(oA), Origins.getColName(oB))
      .setTableAList(Origins.getTable(oA))
      .setTableBList(Origins.getTable(oB));
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:19,代码来源:JoinExtractor.java

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

示例3: visitCall

import org.apache.calcite.rex.RexCall; //导入方法依赖的package包/类
@Override public String visitCall(RexCall call) {
  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);
  }
  String stdOperator = MONGO_OPERATORS.get(call.getOperator());
  if (stdOperator != null) {
    return "{" + stdOperator + ": [" + Util.commaList(strings) + "]}";
  }
  if (call.getOperator() == SqlStdOperatorTable.ITEM) {
    final RexNode op1 = call.operands.get(1);
    if (op1 instanceof RexLiteral
        && op1.getType().getSqlTypeName() == SqlTypeName.INTEGER) {
      if (!Bug.CALCITE_194_FIXED) {
        return "'" + stripQuotes(strings.get(0)) + "["
            + ((RexLiteral) op1).getValue2() + "]'";
      }
      return strings.get(0) + "[" + strings.get(1) + "]";
    }
  }
  if (call.getOperator() == SqlStdOperatorTable.CASE) {
    StringBuilder sb = new StringBuilder();
    StringBuilder finish = new StringBuilder();
    // case(a, b, c)  -> $cond:[a, b, c]
    // case(a, b, c, d) -> $cond:[a, b, $cond:[c, d, null]]
    // case(a, b, c, d, e) -> $cond:[a, b, $cond:[c, d, e]]
    for (int i = 0; i < strings.size(); i += 2) {
      sb.append("{$cond:[");
      finish.append("]}");

      sb.append(strings.get(i));
      sb.append(',');
      sb.append(strings.get(i + 1));
      sb.append(',');
      if (i == strings.size() - 3) {
        sb.append(strings.get(i + 2));
        break;
      }
      if (i == strings.size() - 2) {
        sb.append("null");
        break;
      }
    }
    sb.append(finish);
    return sb.toString();
  }
  throw new IllegalArgumentException("Translation of " + call.toString()
      + " is not supported by MongoProject");
}
 
开发者ID:apache,项目名称:calcite,代码行数:54,代码来源:MongoRules.java


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