Issue #21858:fix missed group by