public ConstraintGroup(RexNode rexNode) { originalRexNode = rexNode; final List<RexNode> conjunctions = RelOptUtil.conjunctions(rexNode); for (RexNode n : conjunctions) { Constraint c = Constraint.of(n); if (c == null) { // interpretation failed; make this node opaque key = Collections.emptySet(); return; } constraints.put(c.getKey(), c); } if (constraints.size() != conjunctions.size()) { LOG.debug("unexpected situation; giving up on this branch"); key = Collections.emptySet(); return; } key = constraints.keySet(); }
conjuctiveElements = RelOptUtil.conjunctions(predicate);
@Override public boolean matches(RelOptRuleCall call) { Join join = call.rel(0); List<RexNode> joinConds = RelOptUtil.conjunctions(join.getCondition()); for (RexNode joinCnd : joinConds) { if (!HiveCalciteUtil.isDeterministic(joinCnd)) { return false; } } return true; }
for (RexNode pred : mq.getPulledUpPredicates(inp).pulledUpPredicates) { predicatesInSubtree.add(pred.toString()); predicatesInSubtree.addAll(Lists.transform(RelOptUtil.conjunctions(pred), REX_STR_FN));
@Override public boolean matches(RelOptRuleCall call) { Join join = call.rel(0); List<RexNode> joinConds = RelOptUtil.conjunctions(join.getCondition()); for (RexNode joinCnd : joinConds) { if (!HiveCalciteUtil.isDeterministic(joinCnd)) { return false; } } return true; }
final List<RexNode> conjunctions = RelOptUtil.conjunctions(operandCNF);
@SuppressWarnings("incomplete-switch") private static List<RexNode> rewriteProjects(List<RexNode> projects, RexNode newPushedCondition, RelBuilder relBuilder) { final List<RexNode> conjunctions = RelOptUtil.conjunctions(newPushedCondition); final Map<String, RexNode> conditions = new HashMap<String, RexNode>(); for (RexNode conjunction: conjunctions) {
for(RexNode pred : RelOptUtil.conjunctions(condition)) { if (first) { sb.append(convertRexToString(pred, rowType));
List<ExprNodeDesc> filterExpressionsForInput = new ArrayList<ExprNodeDesc>(); if (joinFilters.get(i) != null) { for (RexNode conj : RelOptUtil.conjunctions(joinFilters.get(i))) { ExprNodeDesc expr = convertToExprNode(conj, joinRel, null, newVcolsInCalcite); filterExpressionsForInput.add(expr);
RelOptUtil.conjunctions(notDisjunction); if (disjunctions.containsAll(disjunctions2)) { return false;
for (RexNode pred : RelMetadataQuery.instance().getPulledUpPredicates(inp).pulledUpPredicates) { predicatesInSubtree.add(pred.toString()); predicatesInSubtree.addAll(Lists.transform(RelOptUtil.conjunctions(pred), REX_STR_FN));
for (RexNode conj : RelOptUtil.conjunctions(rel.getCondition())) { if (conj.getKind() != SqlKind.EQUALS) { otherConjuncts.add(conj);
private boolean addBaseConditions(RexNode condition, StatisticsPayload payload, boolean redundant, Map<String, Double> baseConditionMap, RelDataType rowType) { boolean res = redundant; if (condition.getKind() == SqlKind.AND) { for(RexNode pred : RelOptUtil.conjunctions(condition)) { res = addBaseConditions(pred, payload, res, baseConditionMap, rowType); } } else if (condition.getKind() == SqlKind.OR) { for(RexNode pred : RelOptUtil.disjunctions(condition)) { res = addBaseConditions(pred, payload, res, baseConditionMap, rowType); } } else { // base condition String conditionAsStr = convertRexToString(condition, rowType); if (!redundant) { baseConditionMap.put(conditionAsStr, payload.getRowCount()); return true; } else { baseConditionMap.put(conditionAsStr, -1.0); return false; } } return res; } /*
new RexPermuteInputsShuttle(leftMapping, joinRel.getInput(0))); for (RexNode r : RelOptUtil.conjunctions(leftChildPredicates)) { exprFields.put(r.toString(), RelOptUtil.InputFinder.bits(r)); allExprsDigests.add(r.toString()); new RexPermuteInputsShuttle(rightMapping, joinRel.getInput(1))); for (RexNode r : RelOptUtil.conjunctions(rightChildPredicates)) { exprFields.put(r.toString(), RelOptUtil.InputFinder.bits(r)); allExprsDigests.add(r.toString()); RelOptUtil.conjunctions( compose(rexBuilder, ImmutableList.of(joinRel.getCondition())));
new RexPermuteInputsShuttle(leftMapping, joinRel.getInput(0))); for (RexNode r : RelOptUtil.conjunctions(leftChildPredicates)) { exprFields.put(r.toString(), RelOptUtil.InputFinder.bits(r)); allExprsDigests.add(r.toString()); new RexPermuteInputsShuttle(rightMapping, joinRel.getInput(1))); for (RexNode r : RelOptUtil.conjunctions(rightChildPredicates)) { exprFields.put(r.toString(), RelOptUtil.InputFinder.bits(r)); allExprsDigests.add(r.toString()); RelOptUtil.conjunctions( compose(rexBuilder, ImmutableList.of(joinRel.getCondition())));
private RexNode convertToStatsCondition(RexNode condition, IndexDescriptor index, IndexCallContext context, RelNode scanRel, List<SqlKind>typesToProcess) { RexBuilder builder = scanRel.getCluster().getRexBuilder(); if (condition.getKind() == SqlKind.AND) { final List<RexNode> conditions = Lists.newArrayList(); for(RexNode pred : RelOptUtil.conjunctions(condition)) { conditions.add(convertToStatsCondition(pred, index, context, scanRel, typesToProcess)); } return RexUtil.composeConjunction(builder, conditions, false); } else if (condition.getKind() == SqlKind.OR) { final List<RexNode> conditions = Lists.newArrayList(); for(RexNode pred : RelOptUtil.disjunctions(condition)) { conditions.add(convertToStatsCondition(pred, index, context, scanRel, typesToProcess)); } return RexUtil.composeDisjunction(builder, conditions, false); } else if (condition instanceof RexCall) { // LIKE operator - convert to a RANGE predicate, if possible if (typesToProcess.contains(SqlKind.LIKE) && ((RexCall) condition).getOperator().getKind() == SqlKind.LIKE) { return convertLikeToRange((RexCall)condition, builder); } else if (typesToProcess.contains(SqlKind.CAST) && hasCastExpression(condition)) { return convertCastForFIdx(((RexCall) condition), index, context, scanRel); } else { return condition; } } return condition; }
for (RexNode ce : RelOptUtil.conjunctions(origFilterCond)) { RexNode newCondition = RelOptUtil.pushPastProject(ce, origproject); if (HiveCalciteUtil.isDeterministicFuncWithSingleInputRef(newCondition,
for (RexNode ce : RelOptUtil.conjunctions(origFilterCond)) { RexNode newCondition = RelOptUtil.pushPastProject(ce, origproject); if (HiveCalciteUtil.isDeterministicFuncWithSingleInputRef(newCondition,
final List<RexNode> condConjs = RelOptUtil.conjunctions( join.getCondition());
@SuppressWarnings("incomplete-switch") private static List<RexNode> rewriteProjects(List<RexNode> projects, RexNode newPushedCondition, RelBuilder relBuilder) { final List<RexNode> conjunctions = RelOptUtil.conjunctions(newPushedCondition); final Map<String, RexNode> conditions = new HashMap<String, RexNode>(); for (RexNode conjunction: conjunctions) {