Skip to content

Instantly share code, notes, and snippets.

@MehdiTAZI
Last active November 15, 2018 15:24
Show Gist options
  • Select an option

  • Save MehdiTAZI/7450583e29befe25a981cecbec09f2e6 to your computer and use it in GitHub Desktop.

Select an option

Save MehdiTAZI/7450583e29befe25a981cecbec09f2e6 to your computer and use it in GitHub Desktop.
#!/bin/sh
exec scala "$0" "$@"
!#
object HelloWorld {
def main(args: Array[String]) {
println("Hello, world! " + args.toList)
}
}
HelloWorld.main(args)
scala> val words = sc.textFile("adl://engiedatalake.azuredatalakestore.net/out/wordcount.txt")
scala> val counts = words .flatMap(line => line.split(" ")).map(word => (word, 1)).reduceByKey(_ + _)
scala> counts.saveAsTextFile("adl://engiedatalake.azuredatalakestore.net/out/wordcount-result.txt")
echo "this line is composed of 7 characters" > wordcount.txt
echo "this one of 4 5" >> wordcount.txt
echo "with this one of 16 characters it makes a full file of a total of 28" >> wordcount.txt
hdfs dfs -put wordcount.txt adl://engiedatalake.azuredatalakestore.net/out/wordcount.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment