Fixed Exception with GROUP BY Clause in Merge Table Queries Using SAMPLE

Fixed an exception when running queries with a GROUP BY clause from a Merge table when using SAMPLE.