Skip to content

Commit

Permalink
Require not null for CI
Browse files Browse the repository at this point in the history
  • Loading branch information
JiajunBernoulli committed Jan 28, 2024
1 parent 2602f08 commit 59c7415
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions core/src/main/java/org/apache/calcite/tools/RelBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -2535,13 +2535,14 @@ private AggregateCall removeRedundantDistinct(
ImmutableBitSet groupSet,
RelNode r) {
if (aggregateCall.isDistinct() && !config.redundantDistinct()) {
final RelMetadataQuery mq = r.getCluster().getMetadataQuery();
final RelNode relNode = requireNonNull(r, "RelNode");
final RelMetadataQuery mq = relNode.getCluster().getMetadataQuery();
final List<Integer> argList = aggregateCall.getArgList();
final ImmutableBitSet distinctArg = ImmutableBitSet.builder()
.addAll(argList)
.build();
final ImmutableBitSet columns = groupSet.union(distinctArg);
final boolean alreadyUnique = mq.areColumnsUnique(r, columns);
final boolean alreadyUnique = mq.areColumnsUnique(relNode, columns);
if (alreadyUnique) {
return aggregateCall.withDistinct(false);
}
Expand Down

0 comments on commit 59c7415

Please sign in to comment.