handle distinct as on left or right side of set plan node