drill-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gparai <...@git.apache.org>
Subject [GitHub] drill pull request #729: Drill 1328: Support table statistics for Parquet
Date Thu, 09 Feb 2017 21:20:21 GMT
Github user gparai commented on a diff in the pull request:

    https://github.com/apache/drill/pull/729#discussion_r100414605
  
    --- Diff: exec/java-exec/src/main/java/org/apache/drill/exec/planner/common/DrillJoinRelBase.java
---
    @@ -99,9 +105,40 @@ public RelOptCost computeSelfCost(RelOptPlanner planner) {
       public double getRows() {
         if (this.condition.isAlwaysTrue()) {
           return joinRowFactor * this.getLeft().getRows() * this.getRight().getRows();
    -    } else {
    -      return joinRowFactor * Math.max(this.getLeft().getRows(), this.getRight().getRows());
         }
    +
    +    int[] joinFields = new int[2];
    +
    +    LogicalJoin jr = new LogicalJoin(
    +        this.getCluster(),
    +        this.getTraitSet(),
    +        this.getLeft(),
    +        this.getRight(),
    +        this.getCondition(),
    +        this.getJoinType(),
    +        this.getVariablesStopped(),
    +        false,
    +        ImmutableList.<RelDataTypeField>of());
    +
    +    if (!DrillRelOptUtil.guessRows(this)         //Statistics present for left and right
side of the join
    +        && jr.getJoinType() == JoinRelType.INNER
    +        && DrillRelOptUtil.analyzeSimpleEquiJoin((Join)jr, joinFields)) {
    +      ImmutableBitSet leq = ImmutableBitSet.of(joinFields[0]);
    +      ImmutableBitSet req = ImmutableBitSet.of(joinFields[1]);
    +
    +      Double ldrc = RelMetadataQuery.getDistinctRowCount(this.getLeft(), leq, null);
    +      Double rdrc = RelMetadataQuery.getDistinctRowCount(this.getRight(), req, null);
    +
    +      Double lrc = RelMetadataQuery.getRowCount(this.getLeft());
    +      Double rrc = RelMetadataQuery.getRowCount(this.getRight());
    +
    +      if (ldrc != null && rdrc != null && lrc != null && rrc
!= null) {
    +        return (lrc * rrc) / Math.max(ldrc, rdrc);
    --- End diff --
    
    Done


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message