stratosphere/stratosphere — pull request #274 by aljoscha (2013-11-15 17:01:46+00:00)
Title: Add new way of specifying scala jobs: query {}

This is just to let you know what I'm working on. Do not merge yet.

I want to get rid of ScalaPlan and let people specify queries like this:
```scala
def getScalaPlan(textInput: String, wordsOutput: String) = {
query {
val input = TextFile(textInput)

val words = input flatMap { _.toLowerCase().split(" ") }
val counts = words groupBy { case (word, _) => word } count()

val output = counts.write(wordsOutput, CsvOutputFormat)

Seq(output)
}
}
```

I want to introduce this now before the new release so that people get to know it. In the future this will allow looking at the AST of the whole query, not just at single anonymous functions. Also, we could have something like this instead of the code mentioned above:
```scala

val ex = ExecutionContext("local") // ExecutionContext("localhost:666", )
ex.query {
val input = TextFile(textInput)
val words = input flatMap { _.toLowerCase().split(" ") }
val counts = words groupBy { case (word, _) => word } count()
val output = counts.write(wordsOutput, CsvOutputFormat)
Seq(output)
}
```

Where the query is immediately executed on the executor.