Java Code Examples for org.apache.calcite.sql.SqlNode#equalsDeep()
The following examples show how to use
org.apache.calcite.sql.SqlNode#equalsDeep() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SelectScope.java From Bats with Apache License 2.0 | 6 votes |
public SqlMonotonicity getMonotonicity(SqlNode expr) { SqlMonotonicity monotonicity = expr.getMonotonicity(this); if (monotonicity != SqlMonotonicity.NOT_MONOTONIC) { return monotonicity; } // TODO: compare fully qualified names final SqlNodeList orderList = getOrderList(); if (orderList.size() > 0) { SqlNode order0 = orderList.get(0); monotonicity = SqlMonotonicity.INCREASING; if ((order0 instanceof SqlCall) && (((SqlCall) order0).getOperator() == SqlStdOperatorTable.DESC)) { monotonicity = monotonicity.reverse(); order0 = ((SqlCall) order0).operand(0); } if (expr.equalsDeep(order0, Litmus.IGNORE)) { return monotonicity; } } return SqlMonotonicity.NOT_MONOTONIC; }
Example 2
Source File: OverScope.java From Bats with Apache License 2.0 | 6 votes |
public SqlMonotonicity getMonotonicity(SqlNode expr) { SqlMonotonicity monotonicity = expr.getMonotonicity(this); if (monotonicity != SqlMonotonicity.NOT_MONOTONIC) { return monotonicity; } if (children.size() == 1) { final SqlValidatorNamespace child = children.get(0).namespace; final List<Pair<SqlNode, SqlMonotonicity>> monotonicExprs = child.getMonotonicExprs(); for (Pair<SqlNode, SqlMonotonicity> pair : monotonicExprs) { if (expr.equalsDeep(pair.left, Litmus.IGNORE)) { return pair.right; } } } return super.getMonotonicity(expr); }
Example 3
Source File: SelectScope.java From calcite with Apache License 2.0 | 6 votes |
public SqlMonotonicity getMonotonicity(SqlNode expr) { SqlMonotonicity monotonicity = expr.getMonotonicity(this); if (monotonicity != SqlMonotonicity.NOT_MONOTONIC) { return monotonicity; } // TODO: compare fully qualified names final SqlNodeList orderList = getOrderList(); if (orderList.size() > 0) { SqlNode order0 = orderList.get(0); monotonicity = SqlMonotonicity.INCREASING; if ((order0 instanceof SqlCall) && (((SqlCall) order0).getOperator() == SqlStdOperatorTable.DESC)) { monotonicity = monotonicity.reverse(); order0 = ((SqlCall) order0).operand(0); } if (expr.equalsDeep(order0, Litmus.IGNORE)) { return monotonicity; } } return SqlMonotonicity.NOT_MONOTONIC; }
Example 4
Source File: OverScope.java From calcite with Apache License 2.0 | 6 votes |
public SqlMonotonicity getMonotonicity(SqlNode expr) { SqlMonotonicity monotonicity = expr.getMonotonicity(this); if (monotonicity != SqlMonotonicity.NOT_MONOTONIC) { return monotonicity; } if (children.size() == 1) { final SqlValidatorNamespace child = children.get(0).namespace; final List<Pair<SqlNode, SqlMonotonicity>> monotonicExprs = child.getMonotonicExprs(); for (Pair<SqlNode, SqlMonotonicity> pair : monotonicExprs) { if (expr.equalsDeep(pair.left, Litmus.IGNORE)) { return pair.right; } } } return super.getMonotonicity(expr); }
Example 5
Source File: AggregatingSelectScope.java From Bats with Apache License 2.0 | 5 votes |
public int lookupGroupingExpr(SqlNode operand) { for (Ord<SqlNode> groupExpr : Ord.zip(groupExprList)) { if (operand.equalsDeep(groupExpr.e, Litmus.IGNORE)) { return groupExpr.i; } } return -1; }
Example 6
Source File: AggChecker.java From Bats with Apache License 2.0 | 5 votes |
boolean isGroupExpr(SqlNode expr) { for (SqlNode groupExpr : groupExprs) { if (groupExpr.equalsDeep(expr, Litmus.IGNORE)) { return true; } } for (SqlNode extraExpr : extraExprs) { if (extraExpr.equalsDeep(expr, Litmus.IGNORE)) { return true; } } return false; }
Example 7
Source File: AggregatingSelectScope.java From calcite with Apache License 2.0 | 5 votes |
public int lookupGroupingExpr(SqlNode operand) { for (Ord<SqlNode> groupExpr : Ord.zip(groupExprList)) { if (operand.equalsDeep(groupExpr.e, Litmus.IGNORE)) { return groupExpr.i; } } return -1; }
Example 8
Source File: AggChecker.java From calcite with Apache License 2.0 | 5 votes |
boolean isGroupExpr(SqlNode expr) { for (SqlNode groupExpr : groupExprs) { if (groupExpr.equalsDeep(expr, Litmus.IGNORE)) { return true; } } for (SqlNode extraExpr : extraExprs) { if (extraExpr.equalsDeep(expr, Litmus.IGNORE)) { return true; } } return false; }