[SPARK-3481][SQL] removes the evil MINOR HACK

 a follow up of https://github.com/apache/spark/pull/2377 and https://github.com/apache/spark/pull/2352, see detail there.