Skip to content

Commit

Permalink
address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
godfreyhe committed Jan 2, 2020
1 parent e9b4471 commit a37a0f8
Showing 1 changed file with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
import org.apache.calcite.rex.RexNode;
import org.apache.calcite.rex.RexProgram;
import org.apache.calcite.sql.validate.SqlMonotonicity;
import org.apache.calcite.util.Bug;
import org.apache.calcite.util.BuiltInMethod;
import org.apache.calcite.util.ImmutableBitSet;
import org.apache.calcite.util.ImmutableIntList;
Expand Down Expand Up @@ -184,11 +185,14 @@ public com.google.common.collect.ImmutableList<RelCollation> collations(HepRelVe
return mq.collations(rel.getCurrentRel());
}

public com.google.common.collect.ImmutableList<RelCollation> collations(RelSubset rel, RelMetadataQuery mq) {
if (rel.getBest() != null) {
return mq.collations(rel.getBest());
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 {
return mq.collations(rel.getOriginal());
throw new RuntimeException("CALCITE_1048 is fixed, so check this method again!");
}
}

Expand Down

0 comments on commit a37a0f8

Please sign in to comment.