The following query
is rewritten (by the new JoinGroupOrderOptimizer) as
The problem is that the binding of ?new requires ?X to be bound, i.e. the UNION node must be evaluated after the BIND node. The optimizer needs to be adjusted to take such recursive binding requirements into account.