SPARK-2452, create a new valid for each  instead of using lineId, because Line ids can be same sometimes.