Spark has an easy-to-use interactive shell that can be used to learn API and also analyze data interactively. Below is a simple example written in Scala. You can use any text file that you have:
spark-shell --master yarn --queue <your_queue> scala> val textFile = spark.read.textFile("test.txt") scala> textFile.count() scala> textFile.first() //Count how many lines contain the word "words" //You can replace "words" with any word you'd like scala> textFile.filter(line => line.contains("words")).count()