本文整理汇总了Java中org.apache.calcite.sql.SqlBinaryOperator类的典型用法代码示例。如果您正苦于以下问题:Java SqlBinaryOperator类的具体用法?Java SqlBinaryOperator怎么用?Java SqlBinaryOperator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SqlBinaryOperator类属于org.apache.calcite.sql包,在下文中一共展示了SqlBinaryOperator类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: popOpStackAndBuildFilter
import org.apache.calcite.sql.SqlBinaryOperator; //导入依赖的package包/类
private void popOpStackAndBuildFilter() {
// Parsing a special expression; handled holistically by the parent
if (holisticExpression > 0) {
return;
}
OpState currentOp = opStack.pop();
int size = currentOp.getChildren().size();
RexNode newFilter = null;
if (size >= 1) {
if (size == 1 && currentOp.getOp() instanceof SqlBinaryOperator) {
/* The only operator for which we allow partial pushes is AND.
* For all other operators we clear the children if one of the
* children is a no push.
*/
newFilter = currentOp.getChildren().get(0);
} else {
newFilter = builder.makeCall(currentOp.getOp(), currentOp.getChildren());
}
}
if (newFilter != null) {
// add this new filter to my parent boolean operator's children
if (!opStack.isEmpty()) {
OpState parentOp = opStack.peek();
parentOp.addChild(newFilter);
} else {
resultCondition = newFilter;
}
}
}
开发者ID:dremio,项目名称:dremio-oss,代码行数:31,代码来源:FindPartitionConditions.java
示例2: popOpStackAndBuildFilter
import org.apache.calcite.sql.SqlBinaryOperator; //导入依赖的package包/类
private void popOpStackAndBuildFilter() {
// Parsing a special expression; handled holistically by the parent
if (holisticExpression > 0) {
return;
}
OpState currentOp = opStack.pop();
int size = currentOp.getChildren().size();
RexNode newFilter = null;
if (size >= 1) {
if (size == 1 && currentOp.getOp() instanceof SqlBinaryOperator) {
/* The only operator for which we allow partial pushes is AND.
* For all other operators we clear the children if one of the
* children is a no push.
*/
if (currentOp.getOp().getKind() == SqlKind.AND) {
newFilter = currentOp.getChildren().get(0);
for (OpState opState : opStack) {
if (opState.getOp().getKind() == SqlKind.NOT) {
//AND under NOT should not get pushed
newFilter = null;
}
}
}
} else {
newFilter = builder.makeCall(currentOp.getOp(), currentOp.getChildren());
}
}
if (newFilter != null) {
// add this new filter to my parent boolean operator's children
if (!opStack.isEmpty()) {
OpState parentOp = opStack.peek();
parentOp.addChild(newFilter);
} else {
resultCondition = newFilter;
}
}
}
开发者ID:axbaretto,项目名称:drill,代码行数:40,代码来源:FindPartitionConditions.java
示例3: getOperator
import org.apache.calcite.sql.SqlBinaryOperator; //导入依赖的package包/类
public static Operator getOperator(SqlBinaryOperator sqlBinaryOperator) {
Operator operator = operatorTable.get(sqlBinaryOperator);
if (operator == null) {
throw new UnsupportedOperationException("Operator " + sqlBinaryOperator.getName() + " is not supported");
}
return operator;
}
开发者ID:hortonworks,项目名称:streamline,代码行数:8,代码来源:BinaryOperatorTable.java
示例4: buildTable
import org.apache.calcite.sql.SqlBinaryOperator; //导入依赖的package包/类
private static ImmutableMap<SqlBinaryOperator, Operator> buildTable() {
return ImmutableMap.<SqlBinaryOperator, Operator>builder()
.put(SqlStdOperatorTable.GREATER_THAN, Operator.GREATER_THAN)
.put(SqlStdOperatorTable.LESS_THAN, Operator.LESS_THAN)
.put(SqlStdOperatorTable.GREATER_THAN_OR_EQUAL, Operator.GREATER_THAN_EQUALS_TO)
.put(SqlStdOperatorTable.LESS_THAN_OR_EQUAL, Operator.LESS_THAN_EQUALS_TO)
.put(SqlStdOperatorTable.EQUALS, Operator.EQUALS)
.put(SqlStdOperatorTable.NOT_EQUALS, Operator.NOT_EQUAL)
.put(SqlStdOperatorTable.AND, Operator.AND)
.put(SqlStdOperatorTable.OR, Operator.OR)
.build();
}
开发者ID:hortonworks,项目名称:streamline,代码行数:13,代码来源:BinaryOperatorTable.java
示例5: visit
import org.apache.calcite.sql.SqlBinaryOperator; //导入依赖的package包/类
@Override
public Expression visit(SqlCall call) {
SqlOperator sqlOperator = call.getOperator();
if (sqlOperator instanceof SqlBinaryOperator) {
return visitBinaryOperator((SqlBinaryOperator) sqlOperator, call.getOperandList().get(0),
call.getOperandList().get(1));
} else if (sqlOperator instanceof SqlSpecialOperator) {
return visitSqlSpecialOperator((SqlSpecialOperator) sqlOperator, call.getOperandList());
} else if (sqlOperator instanceof SqlFunction) {
SqlFunction sqlFunction = (SqlFunction) sqlOperator;
if (sqlFunction instanceof SqlAggFunction) {
return visitAggregateFunction(sqlFunction.getName(), call.getOperandList());
} else if (sqlFunction instanceof SqlUnresolvedFunction) {
String udfName = sqlFunction.getName().toUpperCase();
if (catalogUdfs.containsKey(udfName)) {
Udf udfInfo = catalogUdfs.get(udfName);
if (udfInfo.isAggregate()) {
return visitUserDefinedAggregateFunction(udfInfo, call.getOperandList());
} else {
return visitUserDefinedFunction(udfInfo, call.getOperandList());
}
} else {
throw new UnsupportedOperationException("Unknown built-in or User defined function '" + udfName + "'");
}
} else {
return visitFunction(sqlFunction.getName(), call.getOperandList());
}
} else {
throw new UnsupportedOperationException("Operator " + sqlOperator.getName() + " is not supported");
}
}
开发者ID:hortonworks,项目名称:streamline,代码行数:32,代码来源:ExpressionGenerator.java
示例6: getFilter
import org.apache.calcite.sql.SqlBinaryOperator; //导入依赖的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
示例7: visitBinaryOperator
import org.apache.calcite.sql.SqlBinaryOperator; //导入依赖的package包/类
private Expression visitBinaryOperator(SqlBinaryOperator binaryOperator, SqlNode left, SqlNode right) {
Operator operator = BinaryOperatorTable.getOperator(binaryOperator);
return new BinaryExpression(operator, left.accept(this), right.accept(this));
}
开发者ID:hortonworks,项目名称:streamline,代码行数:5,代码来源:ExpressionGenerator.java
示例8: binary
import org.apache.calcite.sql.SqlBinaryOperator; //导入依赖的package包/类
private RexNode binary(Expression expression, SqlBinaryOperator op) {
BinaryExpression call = (BinaryExpression) expression;
return rexBuilder.makeCall(type(call), op,
toRex(ImmutableList.of(call.expression0, call.expression1)));
}
开发者ID:apache,项目名称:kylin,代码行数:6,代码来源:CalcitePrepareImpl.java
示例9: implement
import org.apache.calcite.sql.SqlBinaryOperator; //导入依赖的package包/类
public Expression implement(
RexToLixTranslator translator,
RexCall call,
List<Expression> expressions) {
// neither nullable:
// return x OP y
// x nullable
// null_returns_null
// return x == null ? null : x OP y
// ignore_null
// return x == null ? null : y
// x, y both nullable
// null_returns_null
// return x == null || y == null ? null : x OP y
// ignore_null
// return x == null ? y : y == null ? x : x OP y
if (backupMethodName != null) {
// If one or both operands have ANY type, use the late-binding backup
// method.
if (anyAnyOperands(call)) {
return callBackupMethodAnyType(translator, call, expressions);
}
final Type type0 = expressions.get(0).getType();
final Type type1 = expressions.get(1).getType();
final SqlBinaryOperator op = (SqlBinaryOperator) call.getOperator();
final Primitive primitive = Primitive.ofBoxOr(type0);
if (primitive == null
|| type1 == BigDecimal.class
|| COMPARISON_OPERATORS.contains(op)
&& !COMP_OP_TYPES.contains(primitive)) {
return Expressions.call(SqlFunctions.class, backupMethodName,
expressions);
}
}
final Type returnType =
translator.typeFactory.getJavaClass(call.getType());
return Types.castIfNecessary(returnType,
Expressions.makeBinary(expressionType, expressions.get(0),
expressions.get(1)));
}
开发者ID:apache,项目名称:calcite,代码行数:43,代码来源:RexImpTable.java
注:本文中的org.apache.calcite.sql.SqlBinaryOperator类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论