From f40f2a648db6ce47a4c4f301aded3dd15daa2941 Mon Sep 17 00:00:00 2001 From: Luo Chen Date: Mon, 3 Apr 2017 13:49:43 -0700 Subject: [PATCH] Update DataSetInfo to fix MetaSchema (#290) * 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. --- .../zion/model/impl/DataSetInfo.scala | 3 ++- .../zion/model/impl/AQLGeneratorTest.scala | 18 ++++++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/zion/src/main/scala/edu/uci/ics/cloudberry/zion/model/impl/DataSetInfo.scala b/zion/src/main/scala/edu/uci/ics/cloudberry/zion/model/impl/DataSetInfo.scala index 578c33490..41fa658ce 100644 --- a/zion/src/main/scala/edu/uci/ics/cloudberry/zion/model/impl/DataSetInfo.scala +++ b/zion/src/main/scala/edu/uci/ics/cloudberry/zion/model/impl/DataSetInfo.scala @@ -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")) diff --git a/zion/src/test/scala/edu/uci/ics/cloudberry/zion/model/impl/AQLGeneratorTest.scala b/zion/src/test/scala/edu/uci/ics/cloudberry/zion/model/impl/AQLGeneratorTest.scala index 36c6bb429..dbac33224 100644 --- a/zion/src/test/scala/edu/uci/ics/cloudberry/zion/model/impl/AQLGeneratorTest.scala +++ b/zion/src/test/scala/edu/uci/ics/cloudberry/zion/model/impl/AQLGeneratorTest.scala @@ -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 {