rkondakov opened a new pull request #1959: URL: https://github.com/apache/calcite/pull/1959
Currently method `RelTrait.apply(Mappings.Mapping)` might throw an exception when collation/distribution keys are not covered by mapping. For example when we apply project `SELECT name` on input `id, name ORDER BY id` Method `RelTrait.apply(Mappings.Mapping)` throws NPE because of internals of `RexUtil.apply` where assumed that all sort keys `[0]` should be covered by project mapping keys `name=[1]`. And when this assumption is wrong, the exception is thrown. In this patch the graceful handling for such situations added for both collation and distribution traits. When collation or distribution cannot be derived from the mapping, `RelDistributions#RANDOM_DISTRIBUTED` and `RelCollations#EMPTY` are returned accordingly. ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: [email protected]
