Another option is to bind the "partitionCount" variable to the evaluation context for the user-provided "partitionSelectorExpression" so that they are responsible for doing a mod with that value OR anything else that returns a valid value (0 <= value < partitionCount). If so, then abs() and modulo would only be applied by XD in the case where only the partitionKeyExpression was provided by the user.