NXBT-11521: fix case when there is a SORTED_COLUMN without an ORDER BY