[SPARK-3589][Minor]remove redundant code