case AND: operands = Lists.newArrayList(RexUtil.flattenAnd(call.getOperands())); for (int i = 0; i < operands.size(); i++) { RexNode operand = operands.get(i);
switch (call.getKind()) { case AND: ImmutableList<RexNode> operands = RexUtil.flattenAnd(((RexCall) call).getOperands()); List<RexNode> newOperands = new ArrayList<RexNode>(); for (RexNode operand: operands) {
case AND: operands = Lists.newArrayList(RexUtil.flattenAnd(((RexCall) call).getOperands())); for (int i = 0; i < operands.size(); i++) { RexNode operand = operands.get(i);
ImmutableList<RexNode> operands = RexUtil.flattenAnd(((RexCall) topFilterCondition) .getOperands()); Set<String> operandsToPushDownDigest = new HashSet<String>();
ImmutableList<RexNode> operands = RexUtil.flattenAnd(((RexCall) topFilterCondition) .getOperands()); Set<String> operandsToPushDownDigest = new HashSet<String>();
/** * Converts a collection of expressions into an AND. * If there are zero expressions, returns TRUE. * If there is one expression, returns just that expression. * If any of the expressions are FALSE, returns FALSE. * Removes expressions that always evaluate to TRUE. * Returns null only if {@code nullOnEmpty} and expression is TRUE. */ public static RexNode composeConjunction(RexBuilder rexBuilder, Iterable<? extends RexNode> nodes, boolean nullOnEmpty) { ImmutableList<RexNode> list = flattenAnd(nodes); switch (list.size()) { case 0: return nullOnEmpty ? null : rexBuilder.makeLiteral(true); case 1: return list.get(0); default: if (containsFalse(list)) { return rexBuilder.makeLiteral(false); } return rexBuilder.makeCall(SqlStdOperatorTable.AND, list); } }
/** * Converts a collection of expressions into an AND. * If there are zero expressions, returns TRUE. * If there is one expression, returns just that expression. * If any of the expressions are FALSE, returns FALSE. * Removes expressions that always evaluate to TRUE. * Returns null only if {@code nullOnEmpty} and expression is TRUE. */ public static RexNode composeConjunction(RexBuilder rexBuilder, Iterable<? extends RexNode> nodes, boolean nullOnEmpty) { ImmutableList<RexNode> list = flattenAnd(nodes); switch (list.size()) { case 0: return nullOnEmpty ? null : rexBuilder.makeLiteral(true); case 1: return list.get(0); default: if (containsFalse(list)) { return rexBuilder.makeLiteral(false); } return rexBuilder.makeCall(SqlStdOperatorTable.AND, list); } }
private RexNode pull(RexNode rex) { final List<RexNode> operands; switch (rex.getKind()) { case AND: operands = flattenAnd(((RexCall) rex).getOperands()); return and(pullList(operands)); case OR: operands = flattenOr(((RexCall) rex).getOperands()); final Map<RexNode, RexNode> factors = commonFactors(operands); if (factors.isEmpty()) { return or(operands); } final List<RexNode> list = new ArrayList<>(); for (RexNode operand : operands) { list.add(removeFactor(factors, operand)); } return and(Iterables.concat(factors.values(), ImmutableList.of(or(list)))); default: return rex; } }
private RexNode pull(RexNode rex) { final List<RexNode> operands; switch (rex.getKind()) { case AND: operands = flattenAnd(((RexCall) rex).getOperands()); return and(pullList(operands)); case OR: operands = flattenOr(((RexCall) rex).getOperands()); final Map<String, RexNode> factors = commonFactors(operands); if (factors.isEmpty()) { return or(operands); } final List<RexNode> list = new ArrayList<>(); for (RexNode operand : operands) { list.add(removeFactor(factors, operand)); } return and(Iterables.concat(factors.values(), ImmutableList.of(or(list)))); default: return rex; } }
switch (rex.getKind()) { case AND: operands = flattenAnd(((RexCall) rex).getOperands()); final RexNode head = operands.get(0); final RexNode headDnf = toDnf(head); operands = ((RexCall) arg).getOperands(); return toDnf( or(Lists.transform(flattenAnd(operands), RexUtil::addNot))); default: return rex;
switch (rex.getKind()) { case AND: operands = flattenAnd(((RexCall) rex).getOperands()); final RexNode head = operands.get(0); final RexNode headDnf = toDnf(head); operands = ((RexCall) arg).getOperands(); return toDnf( or(Lists.transform(flattenAnd(operands), RexUtil::addNot))); default: return rex;
case AND: incrementAndCheck(); operands = flattenAnd(((RexCall) rex).getOperands()); final List<RexNode> cnfOperands = new ArrayList<>(); for (RexNode node : operands) { operands = ((RexCall) arg).getOperands(); return toCnf2( or(Lists.transform(flattenAnd(operands), RexUtil::addNot))); default: incrementAndCheck();
switch (condition.getKind()) { case AND: ImmutableList<RexNode> operands = RexUtil.flattenAnd(((RexCall) condition).getOperands()); for (RexNode operand: operands) { if (operand.getKind() == SqlKind.OR) {
case AND: incrementAndCheck(); operands = flattenAnd(((RexCall) rex).getOperands()); final List<RexNode> cnfOperands = new ArrayList<>(); for (RexNode node : operands) { operands = ((RexCall) arg).getOperands(); return toCnf2( or(Lists.transform(flattenAnd(operands), RexUtil::addNot))); default: incrementAndCheck();