@Override public List<Expression> getChildren() { return delegate.getChildren(); }
@Override public Iterator<Expression> defaultIterator(Expression node) { final List<Expression> children = node.getChildren(); return new Iterator<Expression>() { private int position; @Override public final boolean hasNext() { return position < children.size(); } @Override public final Expression next() { if (!hasNext()) { throw new NoSuchElementException(); } return children.get(position++); } @Override public final void remove() { throw new UnsupportedOperationException(); } }; }
@Override public boolean isCloneNode(Expression node, List<Expression> children) { return !children.equals(node.getChildren()); }
@Override public Boolean defaultReturn(Expression node, List<Boolean> returnValues) { if (!ExpressionUtil.isContantForStatement(node) || returnValues.size() < node.getChildren().size()) { return Boolean.FALSE; } for (Boolean returnValue : returnValues) { if (!returnValue) { return Boolean.FALSE; } } return Boolean.TRUE; }
@Override public Boolean defaultReturn(Expression expression, List<Boolean> childResultValues) { if (!ExpressionUtil.isContantForStatement(expression) || childResultValues.size() < expression.getChildren().size()) { return Boolean.FALSE; } for (Boolean childResultValue : childResultValues) { if (!childResultValue) { return Boolean.FALSE; } } return Boolean.TRUE; } @Override
if (lhs instanceof RowValueConstructorExpression && rhs instanceof RowValueConstructorExpression) { int i = 0; for (; i < Math.min(lhs.getChildren().size(),rhs.getChildren().size()); i++) { addEqualityExpression(lhs.getChildren().get(i), rhs.getChildren().get(i), andNodes, ptr, rowKeyOrderOptimizable); for (; i < lhs.getChildren().size(); i++) { addEqualityExpression(lhs.getChildren().get(i), LiteralExpression.newConstant(null, lhs.getChildren().get(i).getDataType()), andNodes, ptr, rowKeyOrderOptimizable); for (; i < rhs.getChildren().size(); i++) { addEqualityExpression(LiteralExpression.newConstant(null, rhs.getChildren().get(i).getDataType()), rhs.getChildren().get(i), andNodes, ptr, rowKeyOrderOptimizable); addEqualityExpression(lhs.getChildren().get(0), rhs, andNodes, ptr, rowKeyOrderOptimizable); for (int i = 1; i < lhs.getChildren().size(); i++) { addEqualityExpression(lhs.getChildren().get(i), LiteralExpression.newConstant(null, lhs.getChildren().get(i).getDataType()), andNodes, ptr, rowKeyOrderOptimizable); addEqualityExpression(lhs, rhs.getChildren().get(0), andNodes, ptr, rowKeyOrderOptimizable); for (int i = 1; i < rhs.getChildren().size(); i++) { addEqualityExpression(LiteralExpression.newConstant(null, rhs.getChildren().get(i).getDataType()), rhs.getChildren().get(i), andNodes, ptr, rowKeyOrderOptimizable);
for (; i < Math.min(lhsExpr.getChildren().size(),rhsExpr.getChildren().size()); i++) { addBindParamMetaData(lhsNode.getChildren().get(i), rhsNode.getChildren().get(i), lhsExpr.getChildren().get(i), rhsExpr.getChildren().get(i)); for (; i < lhsExpr.getChildren().size(); i++) { addBindParamMetaData(lhsNode.getChildren().get(i), null, lhsExpr.getChildren().get(i), null); for (; i < rhsExpr.getChildren().size(); i++) { addBindParamMetaData(null, rhsNode.getChildren().get(i), null, rhsExpr.getChildren().get(i)); addBindParamMetaData(lhsNode.getChildren().get(0), rhsNode, lhsExpr.getChildren().get(0), rhsExpr); for (int i = 1; i < lhsExpr.getChildren().size(); i++) { addBindParamMetaData(lhsNode.getChildren().get(i), null, lhsExpr.getChildren().get(i), null); addBindParamMetaData(lhsNode, rhsNode.getChildren().get(0), lhsExpr, rhsExpr.getChildren().get(0)); for (int i = 1; i < rhsExpr.getChildren().size(); i++) { addBindParamMetaData(null, rhsNode.getChildren().get(i), null, rhsExpr.getChildren().get(i));
List<Expression> coercedNodes = Lists.newArrayListWithExpectedSize(Math.max(lhs.getChildren().size(), rhs.getChildren().size())); for (; i < Math.min(lhs.getChildren().size(),rhs.getChildren().size()); i++) { coercedNodes.add(coerce(lhs.getChildren().get(i), rhs.getChildren().get(i), wrapper, rowKeyOrderOptimizable)); for (; i < lhs.getChildren().size(); i++) { coercedNodes.add(coerce(lhs.getChildren().get(i), null, wrapper, rowKeyOrderOptimizable)); for (; i < rhs.getChildren().size(); i++) { coercedNodes.add(coerce(null, rhs.getChildren().get(i), wrapper, rowKeyOrderOptimizable)); return coercedNodes.equals(rhs.getChildren()) ? rhs : new RowValueConstructorExpression(coercedNodes, rhs.isStateless()); } else if (lhs instanceof RowValueConstructorExpression) { List<Expression> coercedNodes = Lists.newArrayListWithExpectedSize(Math.max(rhs.getChildren().size(), lhs.getChildren().size())); coercedNodes.add(coerce(lhs.getChildren().get(0), rhs, wrapper, rowKeyOrderOptimizable)); for (int i = 1; i < lhs.getChildren().size(); i++) { coercedNodes.add(coerce(lhs.getChildren().get(i), null, wrapper, rowKeyOrderOptimizable)); return coercedNodes.equals(rhs.getChildren()) ? rhs : new RowValueConstructorExpression(coercedNodes, rhs.isStateless()); } else if (rhs instanceof RowValueConstructorExpression) { List<Expression> coercedNodes = Lists.newArrayListWithExpectedSize(Math.max(rhs.getChildren().size(), lhs.getChildren().size())); coercedNodes.add(coerce(lhs, rhs.getChildren().get(0), wrapper, rowKeyOrderOptimizable)); for (int i = 1; i < rhs.getChildren().size(); i++) { coercedNodes.add(coerce(null, rhs.getChildren().get(i), wrapper, rowKeyOrderOptimizable)); return coercedNodes.equals(rhs.getChildren()) ? rhs : new RowValueConstructorExpression(coercedNodes, rhs.isStateless()); } else if (lhs == null) { return rhs;
if (rvc.getChildren().size() < rhs.getChildren().size()) { if (op == CompareOp.LESS) { op = CompareOp.LESS_OR_EQUAL; if (rvc.getChildren().size() < rhs.getChildren().size()) { if (op == CompareOp.LESS) { op = CompareOp.LESS_OR_EQUAL; if (!usedAllOfLHS || rvc.getChildren().size() != rhs.getChildren().size()) { rhs= new RowValueConstructorExpression(rhs.getChildren().subList(0, Math.min(rvc.getChildren().size(), rhs.getChildren().size())), rhs.isStateless());
List<Expression> children = keyExpression.getChildren(); List<Expression> values = Lists.newArrayListWithExpectedSize(children.size()); for (Expression child : children) {
@Override public List<Expression> getChildren() { return delegate.getChildren(); }
@Override public List<Expression> getChildren() { return delegate.getChildren(); }
@Override public Iterator<Expression> defaultIterator(Expression node) { final List<Expression> children = node.getChildren(); return new Iterator<Expression>() { private int position; @Override public final boolean hasNext() { return position < children.size(); } @Override public final Expression next() { if (!hasNext()) { throw new NoSuchElementException(); } return children.get(position++); } @Override public final void remove() { throw new UnsupportedOperationException(); } }; }
@Override public Iterator<Expression> defaultIterator(Expression node) { final List<Expression> children = node.getChildren(); return new Iterator<Expression>() { private int position; @Override public final boolean hasNext() { return position < children.size(); } @Override public final Expression next() { if (!hasNext()) { throw new NoSuchElementException(); } return children.get(position++); } @Override public final void remove() { throw new UnsupportedOperationException(); } }; }
@Override public boolean isCloneNode(Expression node, List<Expression> children) { return !children.equals(node.getChildren()); }
@Override public boolean isCloneNode(Expression node, List<Expression> children) { return !children.equals(node.getChildren()); }
List<Expression> andNodes = Lists.<Expression>newArrayListWithExpectedSize(Math.max(lhsExpr.getChildren().size(), rhsExpr.getChildren().size())); rewriteRVCAsEqualityExpression(lhsExpr, rhsExpr, andNodes, ptr, rowKeyOrderOptimizable); Expression expr = AndExpression.create(andNodes);
if (lhs instanceof RowValueConstructorExpression && rhs instanceof RowValueConstructorExpression) { int i = 0; for (; i < Math.min(lhs.getChildren().size(),rhs.getChildren().size()); i++) { addEqualityExpression(lhs.getChildren().get(i), rhs.getChildren().get(i), andNodes, ptr, rowKeyOrderOptimizable); for (; i < lhs.getChildren().size(); i++) { addEqualityExpression(lhs.getChildren().get(i), LiteralExpression.newConstant(null, lhs.getChildren().get(i).getDataType()), andNodes, ptr, rowKeyOrderOptimizable); for (; i < rhs.getChildren().size(); i++) { addEqualityExpression(LiteralExpression.newConstant(null, rhs.getChildren().get(i).getDataType()), rhs.getChildren().get(i), andNodes, ptr, rowKeyOrderOptimizable); addEqualityExpression(lhs.getChildren().get(0), rhs, andNodes, ptr, rowKeyOrderOptimizable); for (int i = 1; i < lhs.getChildren().size(); i++) { addEqualityExpression(lhs.getChildren().get(i), LiteralExpression.newConstant(null, lhs.getChildren().get(i).getDataType()), andNodes, ptr, rowKeyOrderOptimizable); addEqualityExpression(lhs, rhs.getChildren().get(0), andNodes, ptr, rowKeyOrderOptimizable); for (int i = 1; i < rhs.getChildren().size(); i++) { addEqualityExpression(LiteralExpression.newConstant(null, rhs.getChildren().get(i).getDataType()), rhs.getChildren().get(i), andNodes, ptr, rowKeyOrderOptimizable);
@Override public Boolean defaultReturn(Expression node, List<Boolean> returnValues) { if (node.getDeterminism().ordinal() > Determinism.PER_STATEMENT.ordinal() || returnValues.size() < node.getChildren().size()) { return Boolean.FALSE; } for (Boolean returnValue : returnValues) { if (!returnValue) { return Boolean.FALSE; } } return Boolean.TRUE; }
@Override public Boolean defaultReturn(Expression node, List<Boolean> returnValues) { if (node.getDeterminism().ordinal() > Determinism.PER_STATEMENT.ordinal() || returnValues.size() < node.getChildren().size()) { return Boolean.FALSE; } for (Boolean returnValue : returnValues) { if (!returnValue) { return Boolean.FALSE; } } return Boolean.TRUE; }