Add DDL support for optionally associating meta record with dataset record.
-Fixed the TestExecutor.runScriptAndCompareWithResult() to compare fields
after "Time"-prefixed fields.
Change-Id: I613316985dbd7f553d946f95c5b1a1df56914902
Reviewed-on: https://asterix-gerrit.ics.uci.edu/666
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Reviewed-by: Yingyi Bu <buyingyi@gmail.com>
diff --git a/asterix-lang-aql/src/main/javacc/AQL.jj b/asterix-lang-aql/src/main/javacc/AQL.jj
index 93e3f68..ea95871 100644
--- a/asterix-lang-aql/src/main/javacc/AQL.jj
+++ b/asterix-lang-aql/src/main/javacc/AQL.jj
@@ -416,6 +416,7 @@
String compactionPolicy = null;
boolean temp = false;
List<String> filterField = null;
+ Pair<Identifier,Identifier> metaTypeComponents = new Pair<Identifier, Identifier>(null, null);
}
{
(
@@ -434,6 +435,8 @@
nameComponents.second,
typeComponents.first,
typeComponents.second,
+ metaTypeComponents.first,
+ metaTypeComponents.second,
nodeGroupName != null? new Identifier(nodeGroupName): null,
compactionPolicy,
compactionPolicyProperties,
@@ -446,9 +449,20 @@
| ("internal" | "temporary" {
temp = token.image.toLowerCase().equals("temporary");
}
- )?
+ )?
<DATASET> nameComponents = QualifiedName()
<LEFTPAREN> typeComponents = TypeName() <RIGHTPAREN>
+ (
+ { String name; }
+ <WITH>
+ name = Identifier()
+ {
+ if(!name.equals("meta")){
+ throw new ParseException("We can only support one additional associated field called \"meta\".");
+ }
+ }
+ <LEFTPAREN> metaTypeComponents = TypeName() <RIGHTPAREN>
+ )?
ifNotExists = IfNotExists()
primaryKeyFields = PrimaryKey()
("autogenerated" { autogenerated = true; } )?
@@ -465,6 +479,8 @@
nameComponents.second,
typeComponents.first,
typeComponents.second,
+ metaTypeComponents.first,
+ metaTypeComponents.second,
nodeGroupName != null ? new Identifier(nodeGroupName) : null,
compactionPolicy,
compactionPolicyProperties,
@@ -1386,7 +1402,23 @@
{
lit = Identifier()
{
- exprList.add(lit);
+ boolean meetParens = false;
+ }
+ (
+ <LEFTPAREN><RIGHTPAREN>
+ {
+ if(lit.equals("meta")){
+ exprList.add(lit+"()");
+ }else{
+ throw new ParseException("The string before () has to be \"meta\".");
+ }
+ meetParens = true;
+ }
+ )?
+ {
+ if(!meetParens){
+ exprList.add(lit);
+ }
}
(<DOT>
lit = Identifier()