Skip to content

Commit

Permalink
Update DataSetInfo to fix MetaSchema (#290)
Browse files Browse the repository at this point in the history
* Update DataSetInfo to fix MetaSchema

The MetaSchema was wrong in that the timeField ("stats.createTime") was not added into its dimension fields. Now it's fixed.

* Add a test case for translating meta query.
  • Loading branch information
luochen01 authored Apr 3, 2017
1 parent b5d7c36 commit f40f2a6
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ object DataSetInfo {

val MetaDataDBName: String = "berry.meta"
val MetaSchema: Schema = Schema("berry.MetaType",
Seq(StringField("name")),
Seq(StringField("name"),
TimeField("stats.createTime")),
Seq.empty,
Seq(StringField("name")),
TimeField("stats.createTime"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -649,6 +649,24 @@ class AQLGeneratorTest extends Specification {
ok
}

"translate a meta query" in {
val select = Some(SelectStatement(Seq(DataSetInfo.MetaSchema.timeField), Seq(SortOrder.ASC), Int.MaxValue, 0, Seq.empty))
val query = new Query(DataSetInfo.MetaDataDBName, select = select)
val result = parser.generate(query, Map(DataSetInfo.MetaDataDBName->DataSetInfo.MetaSchema))
removeEmptyLine(result) must_== unifyNewLine(
"""
|for $t in dataset berry.meta
|order by $t.'stats'.'createTime'
|limit 2147483647
|offset 0
|return
|$t
""".stripMargin.trim
)
}



}

"AQLQueryParser calcResultSchema" should {
Expand Down

0 comments on commit f40f2a6

Please sign in to comment.