v.22.10Bug Fix

Fix ORDER BY and GROUP BY Queries with Monotonic Functions in ClickHouse

Fix wrong result of queries with ORDER BY or GROUP BY by columns from prefix of sorting key, wrapped into monotonic functions, with enable "read in order" optimization (settings optimize_read_in_order and optimize_aggregation_in_order). #41701 (Anton Popov).