/** * we look for keys that are preserved by the projection and if so these keys are the new keys, * otherwise the 'on' attributes form the new key (key of the projection) */ @Override public Keys lazyComputeKey() { Keys keys = operand.getKeys(); Predicate<Key> p = (k) -> isKeyPreserving(k); Set<Key> kept = keys.stream().filter(p).collect(Collectors.toSet()); if (kept.isEmpty()) { return new Keys(type.getLargestKey()); } else { return new Keys(kept); } }