I believe that exprToAliasMap is not needed because the alias is only useful when the TVE replaces the whole display column, that only requires one alias string to be passed into replaceWithTVE at the top and the recursive calls (and calls for the ORDER BY clause) can pass a null alias. Usually, the TVE aliases can be left null.