forked from scala-lms/tutorials
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathquery_live.scala
51 lines (44 loc) · 1.5 KB
/
query_live.scala
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
package scala.lms.tutorial
import scala.lms.common._
object query_live {
trait QueryInterpreter extends PlainQueryProcessor {
override def version = "query_live"
def execQuery(q: Operator): Unit = {
println("hello")
}
}
}
class QueryLiveTest extends TutorialFunSuite {
val under = "query_live_"
def engine =
new Engine with query_live.QueryInterpreter {
override def liftTable(n: Table) = n
override def eval = run
//trait QueryCompiler extends Dsl with StagedQueryProcessor with ScannerBase {
/**
new DslDriver[String,Unit] with ScannerExp with StagedEngine with query_live.QueryCompiler { q =>
override val codegen = new DslGen with ScalaGenScanner {
val IR: q.type = q
}
override def prepare: Unit = precompile
*/
//trait QueryCompiler extends Dsl with StagedQueryProcessor with ScannerLowerBase {
/**
new DslDriverC[String,Unit] with ScannerLowerExp with StagedEngine with query_live.QueryCompiler { q =>
override val codegen = new DslGenC with CGenScannerLower {
val IR: q.type = q
}
*/
/**
override def snippet(fn: Table): Rep[Unit] = run
override def eval = eval(filename)
*/
override def query = s"select * from $t1gram"
override def filename = dataFilePath("t1gram.csv")
val t1gram = "? schema Phrase, Year, MatchCount, VolumeCount delim \\t"
}
test("demo") {
//exec("code", engine.code, suffix="scala")
exec("data", engine.evalString, suffix="csv")
}
}