[SPARK-3407][SQL]Add Date type support

This function is only used for ordering, not for data comparison.