public void validate(RelNode relNode) { try { relNode.accept(this); } catch (Util.FoundOne e) { // Can ignore - the check failed. } }
public void visit( RelNode node, int ordinal, RelNode parent) { if (node instanceof JdbcHiveTableScan && tmpJdbcHiveTableScan [0] == null) { tmpJdbcHiveTableScan [0] = (JdbcHiveTableScan) node; } else { super.visit(node, ordinal, parent); } } }.go(this);
MutableLeafRel(MutableRelType type, RelNode rel) { super(rel.getCluster(), rel.getRowType(), type); this.rel = rel; }
/** * Creates a HiveSortExchange. * * @param input Input relational expression * @param distribution Distribution specification * @param collation Collation specification * @param joinKeys Join Keys specification */ public static HiveSortExchange create(RelNode input, RelDistribution distribution, RelCollation collation, ImmutableList<RexNode> joinKeys) { RelOptCluster cluster = input.getCluster(); distribution = RelDistributionTraitDef.INSTANCE.canonize(distribution); collation = RelCollationTraitDef.INSTANCE.canonize(collation); RelTraitSet traitSet = RelTraitSet.createEmpty().plus(distribution).plus(collation); return new HiveSortExchange(cluster, traitSet, input, distribution, collation, joinKeys); }
@Override public RelWriter explainTerms(RelWriter pw) { return super.explainTerms(pw) .item("ctx", context == null ? "" : String.valueOf(context.id) + "@" + context.realization) .itemIf("offset", localOffset, localOffset != null).itemIf("fetch", localFetch, localFetch != null); }
public RelDataType getRowType() { return leafRel().getRowType(); }
@Override public RelWriter explainTerms(RelWriter pw) { if (this.useQBIdInDigest) { // TODO: Only the qualified name should be left here return super.explainTerms(pw) .item("qbid:alias", concatQbIDAlias); } else { return super.explainTerms(pw).item("table:alias", tblAlias); } }
@Override public RelWriter explainTerms(RelWriter pw) { return super.explainTerms(pw).item("sql", stripToOneLineSql(sql)); }
@Override public RelWriter explainTerms(RelWriter pw) { return super.explainTerms(pw) .item("algorithm", joinAlgorithm == null ? "none" : joinAlgorithm) .item("cost", joinCost == null ? "not available" : joinCost); }
private Statistic buildStatistic() { if (stats != null || primaryKey == -1) { return stats; } Direction dir = primaryKeyMonotonicity == INCREASING ? ASCENDING : DESCENDING; RelFieldCollation collation = new RelFieldCollation(primaryKey, dir, NullDirection.UNSPECIFIED); return Statistics.of(fields.size(), ImmutableList.of(ImmutableBitSet.of(primaryKey)), ImmutableList.of(RelCollations.of(collation))); }
public RelTrait[] getRelTraits() { return leafRel().getTraitSet().toArray(new RelTrait[0]); }
private RelNode getCorRel(CorRef corVar) { final RelNode r = cm.mapCorToCorRel.get(corVar.corr); RelNode ret = r.getInput(0); return ret; }
@Override public boolean matches(final RelOptRuleCall call) { // LIMIT, no ORDER BY final Sort sort = call.rel(0); return sort.collation.getFieldCollations().isEmpty() && sort.fetch != null; }
@Override public int compareTo(RelMultipleTrait o) { final RelDistribution distribution = (RelDistribution) o; if (type == distribution.getType() && (type == Type.HASH_DISTRIBUTED || type == Type.RANGE_DISTRIBUTED)) { return ORDERING.compare(getKeys(), distribution.getKeys()); } return type.compareTo(distribution.getType()); }
@Override public RelNode accept(RelShuttle shuttle) { if(shuttle instanceof HiveRelShuttle) { return ((HiveRelShuttle)shuttle).visit(this); } return shuttle.visit(this); }
@Override public RelOptCost computeSelfCost(final RelOptPlanner planner, final RelMetadataQuery mq) { return right.computeSelfCost(planner, mq).plus(left.computeSelfCost(planner, mq).multiplyBy(50)); }
public boolean traverse(RelNode root) { root.accept(this); return mightRequireValueGen; } }
@Override public void visit(RelNode node, int ordinal, RelNode parent) { if (node instanceof Project || node instanceof Filter || node instanceof TableScan) { // We can continue super.visit(node, ordinal, parent); } else { throw new ReturnedValue(false); } }
@Override public RelNode accept(RelShuttle shuttle) { if(shuttle instanceof HiveRelShuttle) { return ((HiveRelShuttle)shuttle).visit(this); } return shuttle.visit(this); }