assert condition.getKind() == SqlKind.OR; ImmutableList<RexNode> operands = RexUtil.flattenOr(((RexCall) condition).getOperands()); if (operands.size() < minNumORClauses) {
ImmutableList<RexNode> operands = RexUtil.flattenOr(((RexCall) condition).getOperands()); for (int i = 0; i < operands.size(); i++) { final RexNode operand = operands.get(i);
case OR: operands = Lists.newArrayList(RexUtil.flattenOr(call.getOperands())); for (int i = 0; i < operands.size(); i++) { RexNode operand = operands.get(i);
case OR: operands = Lists.newArrayList(RexUtil.flattenOr(((RexCall) call).getOperands())); for (int i = 0; i < operands.size(); i++) { RexNode operand = operands.get(i);
ImmutableList<RexNode> operands = RexUtil.flattenOr(((RexCall) condition).getOperands()); if (operands.size() < minNumORClauses) {
ImmutableList<RexNode> operands = RexUtil.flattenOr(((RexCall) condition).getOperands()); for (int i = 0; i < operands.size(); i++) { final RexNode operand = operands.get(i);
/** * Converts a collection of expressions into an OR, * optionally returning null if the list is empty. */ public static RexNode composeDisjunction(RexBuilder rexBuilder, Iterable<? extends RexNode> nodes, boolean nullOnEmpty) { ImmutableList<RexNode> list = flattenOr(nodes); switch (list.size()) { case 0: return nullOnEmpty ? null : rexBuilder.makeLiteral(false); case 1: return list.get(0); default: if (containsTrue(list)) { return rexBuilder.makeLiteral(true); } return rexBuilder.makeCall(SqlStdOperatorTable.OR, list); } }
/** * Converts a collection of expressions into an OR, * optionally returning null if the list is empty. */ public static RexNode composeDisjunction(RexBuilder rexBuilder, Iterable<? extends RexNode> nodes, boolean nullOnEmpty) { ImmutableList<RexNode> list = flattenOr(nodes); switch (list.size()) { case 0: return nullOnEmpty ? null : rexBuilder.makeLiteral(false); case 1: return list.get(0); default: if (containsTrue(list)) { return rexBuilder.makeLiteral(true); } return rexBuilder.makeCall(SqlStdOperatorTable.OR, 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; } }
case OR: incrementAndCheck(); operands = flattenOr(((RexCall) rex).getOperands()); final RexNode head = operands.get(0); final RexNode headCnf = toCnf2(head); operands = ((RexCall) arg).getOperands(); return toCnf2( and(Lists.transform(flattenOr(operands), RexUtil::addNot))); case AND: operands = ((RexCall) arg).getOperands();
ImmutableList<RexNode> operands = RexUtil.flattenOr(((RexCall) condition).getOperands()); for (int i = 0; i < operands.size(); i++) { final RexNode operand = operands.get(i);
case OR: incrementAndCheck(); operands = flattenOr(((RexCall) rex).getOperands()); final RexNode head = operands.get(0); final RexNode headCnf = toCnf2(head); operands = ((RexCall) arg).getOperands(); return toCnf2( and(Lists.transform(flattenOr(operands), RexUtil::addNot))); case AND: operands = ((RexCall) arg).getOperands();