Sorts and dedups label ids in batch importer