Java Code Examples for org.apache.calcite.rex.RexUtil#predicateConstants()
The following examples show how to use
org.apache.calcite.rex.RexUtil#predicateConstants() .
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: RelOptPredicateList.java From Bats with Apache License 2.0 | 6 votes |
/** Creates a RelOptPredicateList for a join. * * @param rexBuilder Rex builder * @param pulledUpPredicates Predicates that apply to the rows returned by the * relational expression * @param leftInferredPredicates Predicates that were inferred from the right * input * @param rightInferredPredicates Predicates that were inferred from the left * input */ public static RelOptPredicateList of(RexBuilder rexBuilder, Iterable<RexNode> pulledUpPredicates, Iterable<RexNode> leftInferredPredicates, Iterable<RexNode> rightInferredPredicates) { final ImmutableList<RexNode> pulledUpPredicatesList = ImmutableList.copyOf(pulledUpPredicates); final ImmutableList<RexNode> leftInferredPredicateList = ImmutableList.copyOf(leftInferredPredicates); final ImmutableList<RexNode> rightInferredPredicatesList = ImmutableList.copyOf(rightInferredPredicates); if (pulledUpPredicatesList.isEmpty() && leftInferredPredicateList.isEmpty() && rightInferredPredicatesList.isEmpty()) { return EMPTY; } final ImmutableMap<RexNode, RexNode> constantMap = RexUtil.predicateConstants(RexNode.class, rexBuilder, pulledUpPredicatesList); return new RelOptPredicateList(pulledUpPredicatesList, leftInferredPredicateList, rightInferredPredicatesList, constantMap); }
Example 2
Source File: RelOptPredicateList.java From calcite with Apache License 2.0 | 6 votes |
/** Creates a RelOptPredicateList for a join. * * @param rexBuilder Rex builder * @param pulledUpPredicates Predicates that apply to the rows returned by the * relational expression * @param leftInferredPredicates Predicates that were inferred from the right * input * @param rightInferredPredicates Predicates that were inferred from the left * input */ public static RelOptPredicateList of(RexBuilder rexBuilder, Iterable<RexNode> pulledUpPredicates, Iterable<RexNode> leftInferredPredicates, Iterable<RexNode> rightInferredPredicates) { final ImmutableList<RexNode> pulledUpPredicatesList = ImmutableList.copyOf(pulledUpPredicates); final ImmutableList<RexNode> leftInferredPredicateList = ImmutableList.copyOf(leftInferredPredicates); final ImmutableList<RexNode> rightInferredPredicatesList = ImmutableList.copyOf(rightInferredPredicates); if (pulledUpPredicatesList.isEmpty() && leftInferredPredicateList.isEmpty() && rightInferredPredicatesList.isEmpty()) { return EMPTY; } final ImmutableMap<RexNode, RexNode> constantMap = RexUtil.predicateConstants(RexNode.class, rexBuilder, pulledUpPredicatesList); return new RelOptPredicateList(pulledUpPredicatesList, leftInferredPredicateList, rightInferredPredicatesList, constantMap); }
Example 3
Source File: ReduceExpressionsRule.java From Bats with Apache License 2.0 | 3 votes |
/** Creates a map containing each (e, constant) pair that occurs within * a predicate list. * * @param clazz Class of expression that is considered constant * @param rexBuilder Rex builder * @param predicates Predicate list * @param <C> what to consider a constant: {@link RexLiteral} to use a narrow * definition of constant, or {@link RexNode} to use * {@link RexUtil#isConstant(RexNode)} * @return Map from values to constants * * @deprecated Use {@link RelOptPredicateList#constantMap} */ @Deprecated // to be removed before 2.0 public static <C extends RexNode> ImmutableMap<RexNode, C> predicateConstants( Class<C> clazz, RexBuilder rexBuilder, RelOptPredicateList predicates) { return RexUtil.predicateConstants(clazz, rexBuilder, predicates.pulledUpPredicates); }
Example 4
Source File: ReduceExpressionsRule.java From calcite with Apache License 2.0 | 3 votes |
/** Creates a map containing each (e, constant) pair that occurs within * a predicate list. * * @param clazz Class of expression that is considered constant * @param rexBuilder Rex builder * @param predicates Predicate list * @param <C> what to consider a constant: {@link RexLiteral} to use a narrow * definition of constant, or {@link RexNode} to use * {@link RexUtil#isConstant(RexNode)} * @return Map from values to constants * * @deprecated Use {@link RelOptPredicateList#constantMap} */ @Deprecated // to be removed before 2.0 public static <C extends RexNode> ImmutableMap<RexNode, C> predicateConstants( Class<C> clazz, RexBuilder rexBuilder, RelOptPredicateList predicates) { return RexUtil.predicateConstants(clazz, rexBuilder, predicates.pulledUpPredicates); }