Created
March 12, 2016 07:27
-
-
Save oluies/d028cc89305fd7b1b852 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//read each of your input directory as a dataframe and union them and repartition it to the # of files you want and dump it back | |
val dfSeq = MutableList[DataFrame]() | |
sourceDirsToConsolidate.map(dir => { | |
val df = sqlContext.parquetFile(dir) | |
dfSeq += df | |
}) | |
val masterDf = dfSeq.reduce((df1, df2) => df1.unionAll(df2)) | |
masterDf.coalesce(numOutputFiles).write.mode(saveMode).parquet(destDir) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment