[SPARK-26307][SQL] Fix CTAS when INSERT a partitioned table using Hive serde