[SPARK-2452] Create a new valid for each  instead of using lineId.