[SPARK-3651]  implemented suggested changes