Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FLINK-15381] [table-planner-blink] correct collation derive logic on RelSubset in RelMdCollation #10694

Merged
merged 3 commits into from
Jan 2, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
address comments
  • Loading branch information
godfreyhe committed Jan 2, 2020
commit 1f464e14831cf8f4940fa6c76dbb9dd0acfe6ce4
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!");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's unsafe to throw exception here.

}
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The fix makes sense.

Expand Down