caicancai commented on code in PR #4013:
URL: https://github.com/apache/calcite/pull/4013#discussion_r1820930846
##########
core/src/main/java/org/apache/calcite/rel/metadata/RelMdUniqueKeys.java:
##########
@@ -184,19 +180,12 @@ private static Set<ImmutableBitSet>
getProjectUniqueKeys(SingleRel rel, RelMetad
continue;
}
// colMask is mapped to output project, however, the column can be
mapped more than once:
- // select id, id, id, unique2, unique2
- // the resulting unique keys would be {{0},{3}}, {{0},{4}},
{{0},{1},{4}}, ...
-
- Iterable<List<ImmutableBitSet>> product =
- Linq4j.product(
- Util.transform(colMask, in ->
- Util.filter(
- requireNonNull(mapInToOutPos.get(in),
- () -> "no entry for column " + in
- + " in mapInToOutPos: " +
mapInToOutPos).powerSet(),
- bs -> !bs.isEmpty())));
-
- resultBuilder.addAll(Util.transform(product, ImmutableBitSet::union));
+ // select key1, key1, val1, val2, key2 from ...
+ // the resulting unique keys would be {{0},{4}}, {{1},{4}}
Review Comment:
Thank you very much for your answer, I agree with you
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]