Java Code Examples for org.apache.calcite.util.Bug#CALCITE_1048_FIXED
The following examples show how to use
org.apache.calcite.util.Bug#CALCITE_1048_FIXED .
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: RelMdDistinctRowCount.java From Bats with Apache License 2.0 | 6 votes |
public Double getDistinctRowCount(RelSubset rel, RelMetadataQuery mq, ImmutableBitSet groupKey, RexNode predicate) { final RelNode best = rel.getBest(); if (best != null) { return mq.getDistinctRowCount(best, groupKey, predicate); } if (!Bug.CALCITE_1048_FIXED) { return getDistinctRowCount((RelNode) rel, mq, groupKey, predicate); } Double d = null; for (RelNode r2 : rel.getRels()) { try { Double d2 = mq.getDistinctRowCount(r2, groupKey, predicate); d = NumberUtil.min(d, d2); } catch (CyclicMetadataException e) { // Ignore this relational expression; there will be non-cyclic ones // in this set. } } return d; }
Example 2
Source File: RelMdPredicates.java From Bats with Apache License 2.0 | 6 votes |
/** @see RelMetadataQuery#getPulledUpPredicates(RelNode) */ public RelOptPredicateList getPredicates(RelSubset r, RelMetadataQuery mq) { if (!Bug.CALCITE_1048_FIXED) { return RelOptPredicateList.EMPTY; } final RexBuilder rexBuilder = r.getCluster().getRexBuilder(); RelOptPredicateList list = null; for (RelNode r2 : r.getRels()) { RelOptPredicateList list2 = mq.getPulledUpPredicates(r2); if (list2 != null) { list = list == null ? list2 : list.union(rexBuilder, list2); } } return Util.first(list, RelOptPredicateList.EMPTY); }
Example 3
Source File: RelMdDistinctRowCount.java From calcite with Apache License 2.0 | 6 votes |
public Double getDistinctRowCount(RelSubset rel, RelMetadataQuery mq, ImmutableBitSet groupKey, RexNode predicate) { final RelNode best = rel.getBest(); if (best != null) { return mq.getDistinctRowCount(best, groupKey, predicate); } if (!Bug.CALCITE_1048_FIXED) { return getDistinctRowCount((RelNode) rel, mq, groupKey, predicate); } Double d = null; for (RelNode r2 : rel.getRels()) { try { Double d2 = mq.getDistinctRowCount(r2, groupKey, predicate); d = NumberUtil.min(d, d2); } catch (CyclicMetadataException e) { // Ignore this relational expression; there will be non-cyclic ones // in this set. } } return d; }
Example 4
Source File: RelMdPredicates.java From calcite with Apache License 2.0 | 6 votes |
/** @see RelMetadataQuery#getPulledUpPredicates(RelNode) */ public RelOptPredicateList getPredicates(RelSubset r, RelMetadataQuery mq) { if (!Bug.CALCITE_1048_FIXED) { return RelOptPredicateList.EMPTY; } final RexBuilder rexBuilder = r.getCluster().getRexBuilder(); RelOptPredicateList list = null; for (RelNode r2 : r.getRels()) { RelOptPredicateList list2 = mq.getPulledUpPredicates(r2); if (list2 != null) { list = list == null ? list2 : list.union(rexBuilder, list2); } } return Util.first(list, RelOptPredicateList.EMPTY); }
Example 5
Source File: QuidemTest.java From calcite with Apache License 2.0 | 6 votes |
private static Object getEnv(String varName) { switch (varName) { case "jdk18": return System.getProperty("java.version").startsWith("1.8"); case "fixed": // Quidem requires a Java 8 function return (Function<String, Object>) v -> { switch (v) { case "calcite1045": return Bug.CALCITE_1045_FIXED; case "calcite1048": return Bug.CALCITE_1048_FIXED; } return null; }; default: return null; } }
Example 6
Source File: FlinkRelMdCollation.java From flink with Apache License 2.0 | 5 votes |
public com.google.common.collect.ImmutableList<RelCollation> collations(RelSubset subset, RelMetadataQuery mq) { if (!Bug.CALCITE_1048_FIXED) { //if the best node is null, so we can get the collation based original node, due to //the original node is logically equivalent as the rel. RelNode rel = Util.first(subset.getBest(), subset.getOriginal()); return mq.collations(rel); } else { throw new RuntimeException("CALCITE_1048 is fixed, so check this method again!"); } }