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-sqlpp/src/main/javacc/SQLPP.html b/asterix-lang-sqlpp/src/main/javacc/SQLPP.html
index 4bb64d2..42aaa06 100644
--- a/asterix-lang-sqlpp/src/main/javacc/SQLPP.html
+++ b/asterix-lang-sqlpp/src/main/javacc/SQLPP.html
@@ -403,7 +403,7 @@
<TR>
<TD ALIGN=RIGHT VALIGN=BASELINE><A NAME="prod21">DatasetSpecification</A></TD>
<TD ALIGN=CENTER VALIGN=BASELINE>::=</TD>
-<TD ALIGN=LEFT VALIGN=BASELINE>( <EXTERNAL> <DATASET> <A HREF="#prod30">QualifiedName</A> <LEFTPAREN> <A HREF="#prod18">Identifier</A> <RIGHTPAREN> <A HREF="#prod28">IfNotExists</A> <USING> <A HREF="#prod31">AdapterName</A> <A HREF="#prod32">Configuration</A> ( <ON> <A HREF="#prod18">Identifier</A> )? ( <HINTS> <A HREF="#prod33">Properties</A> )? ( <USING> <COMPACTION> <POLICY> <A HREF="#prod34">CompactionPolicy</A> ( <A HREF="#prod32">Configuration</A> )? )? | ( <INTERNAL> | <TEMPORARY> )? <DATASET> <A HREF="#prod30">QualifiedName</A> <LEFTPAREN> <A HREF="#prod18">Identifier</A> <RIGHTPAREN> <A HREF="#prod28">IfNotExists</A> <A HREF="#prod35">PrimaryKey</A> ( <AUTOGENERATED> )? ( <ON> <A HREF="#prod18">Identifier</A> )? ( <HINTS> <A HREF="#prod33">Properties</A> )? ( <USING> <COMPACTION> <POLICY> <A HREF="#prod34">CompactionPolicy</A> ( <A HREF="#prod32">Configuration</A> )? )? ( <WITH> <FILTER> <ON> <A HREF="#prod36">NestedField</A> )? )</TD>
+<TD ALIGN=LEFT VALIGN=BASELINE>( <EXTERNAL> <DATASET> <A HREF="#prod30">QualifiedName</A> <LEFTPAREN> <A HREF="#prod27">TypeName</A> <RIGHTPAREN> <A HREF="#prod28">IfNotExists</A> <USING> <A HREF="#prod31">AdapterName</A> <A HREF="#prod32">Configuration</A> ( <ON> <A HREF="#prod18">Identifier</A> )? ( <HINTS> <A HREF="#prod33">Properties</A> )? ( <USING> <COMPACTION> <POLICY> <A HREF="#prod34">CompactionPolicy</A> ( <A HREF="#prod32">Configuration</A> )? )? | ( <INTERNAL> | <TEMPORARY> )? <DATASET> <A HREF="#prod30">QualifiedName</A> <LEFTPAREN> <A HREF="#prod27">TypeName</A> ( <COMMA> <A HREF="#prod27">TypeName</A> )? <RIGHTPAREN> <A HREF="#prod28">IfNotExists</A> <A HREF="#prod35">PrimaryKey</A> ( <AUTOGENERATED> )? ( <ON> <A HREF="#prod18">Identifier</A> )? ( <HINTS> <A HREF="#prod33">Properties</A> )? ( <USING> <COMPACTION> <POLICY> <A HREF="#prod34">CompactionPolicy</A> ( <A HREF="#prod32">Configuration</A> )? )? ( <WITH> <FILTER> <ON> <A HREF="#prod36">NestedField</A> )? )</TD>
</TR>
<TR>
<TD ALIGN=RIGHT VALIGN=BASELINE><A NAME="prod16">RefreshExternalDatasetStatement</A></TD>
@@ -623,7 +623,7 @@
<TR>
<TD ALIGN=RIGHT VALIGN=BASELINE><A NAME="prod36">NestedField</A></TD>
<TD ALIGN=CENTER VALIGN=BASELINE>::=</TD>
-<TD ALIGN=LEFT VALIGN=BASELINE><A HREF="#prod18">Identifier</A> ( <DOT> <A HREF="#prod18">Identifier</A> )*</TD>
+<TD ALIGN=LEFT VALIGN=BASELINE>( <ATT> )? <A HREF="#prod18">Identifier</A> ( <DOT> <A HREF="#prod18">Identifier</A> )*</TD>
</TR>
<TR>
<TD ALIGN=RIGHT VALIGN=BASELINE><A NAME="prod40">QuotedString</A></TD>
diff --git a/asterix-lang-sqlpp/src/main/javacc/SQLPP.jj b/asterix-lang-sqlpp/src/main/javacc/SQLPP.jj
index 547a10b..6259faa 100644
--- a/asterix-lang-sqlpp/src/main/javacc/SQLPP.jj
+++ b/asterix-lang-sqlpp/src/main/javacc/SQLPP.jj
@@ -429,6 +429,7 @@
String compactionPolicy = null;
boolean temp = false;
List<String> filterField = null;
+ Pair<Identifier,Identifier> metaTypeComponents = new Pair<Identifier, Identifier>(null, null);
}
{
(
@@ -447,6 +448,8 @@
nameComponents.second,
typeComponents.first,
typeComponents.second,
+ metaTypeComponents.first,
+ metaTypeComponents.second,
nodeGroupName != null? new Identifier(nodeGroupName): null,
compactionPolicy,
compactionPolicyProperties,
@@ -456,9 +459,20 @@
ifNotExists);
}
- | (<INTERNAL> | <TEMPORARY> { temp = true; })?
+ | (<INTERNAL> | <TEMPORARY> { temp = true; })?
<DATASET> nameComponents = QualifiedName()
<LEFTPAREN> typeComponents = TypeName() <RIGHTPAREN>
+ (
+ { String name; }
+ <WITH>
+ name = Identifier()
+ {
+ if(!name.toLowerCase().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; } )?
@@ -475,6 +489,8 @@
nameComponents.second,
typeComponents.first,
typeComponents.second,
+ metaTypeComponents.first,
+ metaTypeComponents.second,
nodeGroupName != null ? new Identifier(nodeGroupName) : null,
compactionPolicy,
compactionPolicyProperties,
@@ -1385,7 +1401,23 @@
{
lit = Identifier()
{
- exprList.add(lit);
+ boolean meetParens = false;
+ }
+ (
+ <LEFTPAREN><RIGHTPAREN>
+ {
+ if(lit.toLowerCase().equals("meta")){
+ exprList.add(lit.toLowerCase() + "()");
+ }else{
+ throw new ParseException("The string before () has to be \"meta\".");
+ }
+ meetParens = true;
+ }
+ )?
+ {
+ if(!meetParens){
+ exprList.add(lit);
+ }
}
(<DOT>
lit = Identifier()