Fix for issue 252 and 253
git-svn-id: https://asterixdb.googlecode.com/svn/branches/asterix_stabilization_issue_252_253@1182 eaa15691-b419-025a-1212-ee371bd00084
diff --git a/asterix-aql/src/main/javacc/AQL.jj b/asterix-aql/src/main/javacc/AQL.jj
index 4d181ee..0d797a1 100644
--- a/asterix-aql/src/main/javacc/AQL.jj
+++ b/asterix-aql/src/main/javacc/AQL.jj
@@ -623,7 +623,7 @@
Identifier dataverseName = null;
Identifier datasetName = null;
boolean alreadySorted = false;
- String adapterClassname;
+ String adapterName;
Map<String,String> properties;
Pair<Identifier,Identifier> nameComponents = null;
}
@@ -636,12 +636,11 @@
}
"using"
-
- <STRING_LITERAL>
+
{
- adapterClassname = removeQuotesAndEscapes(token.image);
+ adapterName = getAdapterName();
}
-
+
{
properties = getConfiguration();
}
@@ -652,11 +651,31 @@
";"
{
- return new LoadFromFileStatement(dataverseName, datasetName, adapterClassname, properties, alreadySorted);
+ return new LoadFromFileStatement(dataverseName, datasetName, adapterName, properties, alreadySorted);
}
}
+String getAdapterName() throws ParseException :
+{
+ String adapterName = null;
+}
+{
+ (
+ <IDENTIFIER> {
+ adapterName = (new Identifier(token.image)).getValue();;
+ }
+ |
+ <STRING_LITERAL>
+ {
+ adapterName = removeQuotesAndEscapes(token.image);
+ }
+ )
+ {
+ return adapterName;
+ }
+}
+
DatasetDecl DatasetDeclaration(DatasetType datasetType) throws ParseException :
{
@@ -721,21 +740,16 @@
InternalDetailsDecl InternalDatasetDeclaration() throws ParseException :
{
InternalDetailsDecl idd = null;
- List<String> partitioningExprs = new ArrayList<String>();
+ List<String> primaryKey = new ArrayList<String>();
Identifier nodeGroupName=null;
}
{
- "partitioned" "by" "key"
- < IDENTIFIER >
- {
- partitioningExprs.add(token.image);
- }
(
- "," < IDENTIFIER >
{
- partitioningExprs.add(token.image);
+ primaryKey = getPrimaryKey();
}
- )*
+ )
+
(
"on" < IDENTIFIER >
{
@@ -744,7 +758,7 @@
)?
{
- idd = new InternalDetailsDecl(nodeGroupName, partitioningExprs);
+ idd = new InternalDetailsDecl(nodeGroupName, primaryKey);
return idd;
}
}
@@ -752,7 +766,7 @@
ExternalDetailsDecl ExternalDatasetDeclaration() throws ParseException :
{
ExternalDetailsDecl edd = null;
- String adapterClassname = null;
+ String adapterName = null;
Map < String, String > properties;
}
{
@@ -761,10 +775,8 @@
}
"using"
-
- <STRING_LITERAL>
{
- adapterClassname = removeQuotesAndEscapes(token.image);
+ adapterName = getAdapterName();
}
{
@@ -773,7 +785,7 @@
{
edd = new ExternalDetailsDecl();
- edd.setAdapter(adapterClassname);
+ edd.setAdapter(adapterName);
edd.setProperties(properties);
}
@@ -785,10 +797,10 @@
FeedDetailsDecl FeedDatasetDeclaration() throws ParseException :
{
FeedDetailsDecl fdd = null;
- String adapterFactoryClassname = null;
+ String adapterName = null;
Map < String, String > properties;
Pair<Identifier,Identifier> nameComponents;
- List<String> partitioningExprs = new ArrayList<String>();
+ List<String> primaryKey = new ArrayList<String>();
Identifier nodeGroupName=null;
FunctionSignature appliedFunction=null;
String dataverse;
@@ -797,10 +809,8 @@
}
{
"using"
-
- <STRING_LITERAL>
{
- adapterFactoryClassname = removeQuotesAndEscapes(token.image);
+ adapterName = getAdapterName();
}
{
@@ -824,17 +834,12 @@
}
)?
- "partitioned" "by" "key"
- < IDENTIFIER >
- {
- partitioningExprs.add(token.image);
- }
(
- "," < IDENTIFIER >
{
- partitioningExprs.add(token.image);
+ primaryKey = getPrimaryKey();
}
- )*
+ )
+
(
"on" < IDENTIFIER >
{
@@ -843,11 +848,38 @@
)?
{
- fdd = new FeedDetailsDecl(adapterFactoryClassname, properties, appliedFunction, nodeGroupName, partitioningExprs);
+ fdd = new FeedDetailsDecl(adapterName, properties, appliedFunction, nodeGroupName, primaryKey);
return fdd;
}
}
+List<String> getPrimaryKey() throws ParseException :
+{
+ List<String> primaryKey = new ArrayList<String>();
+}
+{
+
+ "primary" "key"
+ < IDENTIFIER >
+ {
+ primaryKey.add(token.image);
+ }
+ (
+ "," < IDENTIFIER >
+ {
+ primaryKey.add(token.image);
+ }
+ )*
+ {
+ return primaryKey;
+ }
+
+}
+
+
+
+
+
ControlFeedStatement ControlFeedDeclaration(ControlFeedStatement.OperationType operationType) throws ParseException :
{
Pair<Identifier,Identifier> nameComponents = null;