Filed https://issues.apache.org/jira/browse/CALCITE-6882 Included a few demonstrations of the weirdness. I still think that *both* predicate pullup/refinement and analysis of the join are wrong, since any unique columns will cause a keyset of non-unique columns to become unique as a whole when that unique column is included.
-Ian