java - Missing leading zeroes of date in Hive partition using Spark Dataframe -
i adding partition column spark dataframe. new column(s) contains year month , day. have timestamp column in dataframe.
dataframe dfpartition = df.withcolumn("year", df.col("date").substr(0, 4)); dfpartition = dfpartition.withcolumn("month", dfpartition.col("date").substr(6, 2)); dfpartition = dfpartition.withcolumn("day", dfpartition.col("date").substr(9, 2));
i can see correct values of columns when output dataframe eg : 2016 01 08
but when export dataframe hive table
dfpartition.write().partitionby("year", "month","day").mode(savemode.append).saveastable("testdb.testtable");
i see directory structure generated misses leading zeroes. tried cast column string did not work.
is there way capture 2 digits date/month in hive partition
thanks
Comments
Post a Comment