From 59c741575cd5b0a3974ae6f17329e98ae50cd6c4 Mon Sep 17 00:00:00 2001 From: xiejiajun Date: Sun, 28 Jan 2024 15:48:08 +0800 Subject: [PATCH] Require not null for CI --- core/src/main/java/org/apache/calcite/tools/RelBuilder.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/core/src/main/java/org/apache/calcite/tools/RelBuilder.java b/core/src/main/java/org/apache/calcite/tools/RelBuilder.java index ae4e077b97ef..703098cb3457 100644 --- a/core/src/main/java/org/apache/calcite/tools/RelBuilder.java +++ b/core/src/main/java/org/apache/calcite/tools/RelBuilder.java @@ -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 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); }