Description
When saved as a partitioned table, partition columns of a DataFrame are appended after data columns. However, column names are not adjusted accordingly.
import sqlContext._ import sqlContext.implicits._ val df = (1 to 3).map(i => i -> i * 2).toDF("a", "b") df.write .format("parquet") .mode("overwrite") .partitionBy("a") .saveAsTable("t") table("t").orderBy('a).show()
Expected output:
+-+-+ |b|a| +-+-+ |2|1| |4|2| |6|3| +-+-+
Actual output:
+-+-+ |b|a| +-+-+ |1|2| |2|4| |3|6| +-+-+