[SPARK-58022][SQL] Remove unused legacy error conditions