本文整理汇总了Java中org.apache.calcite.sql.SqlOperator.getKind方法的典型用法代码示例。如果您正苦于以下问题:Java SqlOperator.getKind方法的具体用法?Java SqlOperator.getKind怎么用?Java SqlOperator.getKind使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.calcite.sql.SqlOperator
的用法示例。
在下文中一共展示了SqlOperator.getKind方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: visitCall
import org.apache.calcite.sql.SqlOperator; //导入方法依赖的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));
}
示例2: visitCall
import org.apache.calcite.sql.SqlOperator; //导入方法依赖的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));
}
示例3: visit
import org.apache.calcite.sql.SqlOperator; //导入方法依赖的package包/类
public RexNode visit(SqlCall call) {
if (agg != null) {
final SqlOperator op = call.getOperator();
if (window == null
&& (op.isAggregator() || op.getKind() == SqlKind.FILTER)) {
return agg.lookupAggregates(call);
}
}
return exprConverter.convertCall(this,
new SqlCallBinding(validator, scope, call).permutedCall());
}
示例4: DrillCalciteSqlOperatorWrapper
import org.apache.calcite.sql.SqlOperator; //导入方法依赖的package包/类
public DrillCalciteSqlOperatorWrapper(SqlOperator operator, final String rename, final List<DrillFuncHolder> functions) {
super(
operator.getName(),
operator.getKind(),
operator.getLeftPrec(),
operator.getRightPrec(),
TypeInferenceUtils.getDrillSqlReturnTypeInference(
rename,
functions),
operator.getOperandTypeInference(),
Checker.ANY_CHECKER);
this.operator = operator;
}
示例5: visit
import org.apache.calcite.sql.SqlOperator; //导入方法依赖的package包/类
@Override
public SqlNode visit(SqlCall call) {
if (call instanceof SqlSelect) {
int i = 0;
for (SqlNode operand : call.getOperandList()) {
// FROM operand
if (i == 2)
nodeStack.push(State.FROM);
else
nodeStack.push(State.NOT_FROM);
i++;
if (operand == null)
continue;
operand.accept(this);
nodeStack.pop();
}
return null;
}
SqlOperator operator = call.getOperator();
if (operator != null && operator.getKind() == SqlKind.AS) {
// AS operator will be probed only if it is in FROM clause
if (nodeStack.peek() == State.FROM)
call.operand(0).accept(this);
return null;
}
return super.visit(call);
}
示例6: visit
import org.apache.calcite.sql.SqlOperator; //导入方法依赖的package包/类
public RexNode visit(SqlCall call) {
if (agg != null) {
final SqlOperator op = call.getOperator();
if (window == null
&& (op.isAggregator() || op.getKind() == SqlKind.FILTER)) {
return agg.lookupAggregates(call);
}
}
return exprConverter.convertCall(this,
new SqlCallBinding(validator, scope, call).permutedCall());
}
示例7: getFilter
import org.apache.calcite.sql.SqlOperator; //导入方法依赖的package包/类
private boolean getFilter(SqlOperator op, List<RexNode> operands,
StringBuilder s, List<String> fieldNames) {
if (!valid(op.getKind())) {
return false;
}
boolean like = false;
switch (op.getKind()) {
case NOT:
// NOT op pre-pended
s = s.append(" NOT ");
break;
case CAST:
return asd(false, operands, s, fieldNames, 0);
case LIKE:
like = true;
break;
}
for (int i = 0; i < operands.size(); i++) {
if (!asd(like, operands, s, fieldNames, i)) {
return false;
}
if (op instanceof SqlBinaryOperator && i == 0) {
s.append(" ").append(op).append(" ");
}
}
return true;
}
示例8: flattenComparison
import org.apache.calcite.sql.SqlOperator; //导入方法依赖的package包/类
private RexNode flattenComparison(
RexBuilder rexBuilder,
SqlOperator op,
List<RexNode> exprs) {
final List<Pair<RexNode, String>> flattenedExps = Lists.newArrayList();
flattenProjections(this, exprs, null, "", flattenedExps);
int n = flattenedExps.size() / 2;
boolean negate = false;
if (op.getKind() == SqlKind.NOT_EQUALS) {
negate = true;
op = SqlStdOperatorTable.EQUALS;
}
if ((n > 1) && op.getKind() != SqlKind.EQUALS) {
throw Util.needToImplement(
"inequality comparison for row types");
}
RexNode conjunction = null;
for (int i = 0; i < n; ++i) {
RexNode comparison =
rexBuilder.makeCall(
op,
flattenedExps.get(i).left,
flattenedExps.get(i + n).left);
if (conjunction == null) {
conjunction = comparison;
} else {
conjunction =
rexBuilder.makeCall(
SqlStdOperatorTable.AND,
conjunction,
comparison);
}
}
if (negate) {
return rexBuilder.makeCall(
SqlStdOperatorTable.NOT,
conjunction);
} else {
return conjunction;
}
}
示例9: isAssociative
import org.apache.calcite.sql.SqlOperator; //导入方法依赖的package包/类
/**
* Returns whether an operator is associative. AND is associative,
* which means that "(x AND y) and z" is equivalent to "x AND (y AND z)".
* We might well flatten the tree, and write "AND(x, y, z)".
*/
private static boolean isAssociative(SqlOperator op) {
return op.getKind() == SqlKind.AND
|| op.getKind() == SqlKind.OR;
}