本文整理汇总了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));
}
示例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");
}
示例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");
}