Skip to content

Commit

Permalink
#162 Remove redundant creation of directories that will be created an…
Browse files Browse the repository at this point in the history
…yway.
  • Loading branch information
yruslan committed Mar 7, 2023
1 parent 4b7b4b5 commit da2c16d
Showing 1 changed file with 2 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -219,27 +219,21 @@ class StandardizationSink(sinkConfig: Config,

private[extras] def writeToRawFolder(df: DataFrame,
recordCount: Long,
outputPartitionPath: Path)(implicit spark: SparkSession): Unit = {
outputPartitionPath: Path): Unit = {
val outputPathStr = outputPartitionPath.toUri.toString
log.info(s"Saving $recordCount records to the Enceladus raw folder: $outputPathStr")

val fsUtils = new FsUtils(spark.sparkContext.hadoopConfiguration, outputPathStr)
fsUtils.createDirectoryRecursiveButLast(outputPartitionPath)

df.write
.mode(SaveMode.Overwrite)
.json(outputPathStr)
}

private[extras] def writeToPublishFolder(df: DataFrame,
recordCount: Long,
outputPartitionPath: Path)(implicit spark: SparkSession): Unit = {
outputPartitionPath: Path): Unit = {
val outputPathStr = outputPartitionPath.toUri.toString
log.info(s"Saving $recordCount records to the Enceladus publish folder: $outputPathStr")

val fsUtils = new FsUtils(spark.sparkContext.hadoopConfiguration, outputPathStr)
fsUtils.createDirectoryRecursiveButLast(outputPartitionPath)

df.write
.mode(SaveMode.Overwrite)
.parquet(outputPathStr)
Expand Down

0 comments on commit da2c16d

Please sign in to comment.