From 87b0462cb0c1c753a7d775f8472f2c49eaa5ff82 Mon Sep 17 00:00:00 2001 From: karthik Date: Thu, 9 Jul 2020 09:21:43 -0400 Subject: [PATCH] Initial commit --- .../com/barrelsofdata/sparkexamples/Driver.scala | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/main/scala/com/barrelsofdata/sparkexamples/Driver.scala b/src/main/scala/com/barrelsofdata/sparkexamples/Driver.scala index 16321ca..23aedb5 100644 --- a/src/main/scala/com/barrelsofdata/sparkexamples/Driver.scala +++ b/src/main/scala/com/barrelsofdata/sparkexamples/Driver.scala @@ -23,7 +23,16 @@ object Driver { .rdd.reduceByKey(_ + _) .toDF("word", "frequency") - wordFrequencies.write.option("header","true").csv(outputFilePath) +// val wordFrequencies: DataFrame = words +// .groupBy(col("value")).count() +// .toDF("word", "frequency") + + wordFrequencies + .coalesce(1) + .write + .option("header","true") + .csv(outputFilePath) + LOG.info(s"Result successfully written to $outputFilePath") }