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


Java SqlOperator.getKind方法代码示例

本文整理汇总了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));
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:16,代码来源:RewriteAsBinaryOperators.java

示例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));
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:16,代码来源:RewriteAsBinaryOperators.java

示例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());
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:12,代码来源:SqlToRelConverter.java

示例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;
}
 
开发者ID:axbaretto,项目名称:drill,代码行数:14,代码来源:DrillCalciteSqlOperatorWrapper.java

示例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);
}
 
开发者ID:bitnine-oss,项目名称:octopus,代码行数:33,代码来源:SqlTableIdentifierFindVisitor.java

示例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());
}
 
开发者ID:apache,项目名称:kylin,代码行数:12,代码来源:SqlToRelConverter.java

示例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;
}
 
开发者ID:apache,项目名称:calcite,代码行数:30,代码来源:SplunkPushDownRule.java

示例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;
  }
}
 
开发者ID:apache,项目名称:calcite,代码行数:42,代码来源:RelStructuredTypeFlattener.java

示例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;
}
 
开发者ID:apache,项目名称:calcite,代码行数:10,代码来源:RexUtil.java


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