Indexing / Slicing with Apache Spark to return a result to be used in a spark.sql query The following simple spark sql query produces results