You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@asterixdb.apache.org by sj...@apache.org on 2016/09/09 20:54:08 UTC

[06/15] asterixdb-bad git commit: Fixed structure

http://git-wip-us.apache.org/repos/asf/asterixdb-bad/blob/0921e3c9/target/generated-sources/javacc/org/apache/asterix/bad/lang/BADAQLParser.java
----------------------------------------------------------------------
diff --git a/target/generated-sources/javacc/org/apache/asterix/bad/lang/BADAQLParser.java b/target/generated-sources/javacc/org/apache/asterix/bad/lang/BADAQLParser.java
deleted file mode 100644
index 8e9ea5a..0000000
--- a/target/generated-sources/javacc/org/apache/asterix/bad/lang/BADAQLParser.java
+++ /dev/null
@@ -1,4407 +0,0 @@
-/* Generated By:JavaCC: Do not edit this line. BADAQLParser.java */
-package org.apache.asterix.bad.lang;
-
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.io.Reader;
-import java.io.StringReader;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-import org.apache.asterix.bad.lang.statement.BrokerDropStatement;
-import org.apache.asterix.bad.lang.statement.ChannelDropStatement;
-import org.apache.asterix.bad.lang.statement.ChannelSubscribeStatement;
-import org.apache.asterix.bad.lang.statement.ChannelUnsubscribeStatement;
-import org.apache.asterix.bad.lang.statement.CreateBrokerStatement;
-import org.apache.asterix.bad.lang.statement.CreateChannelStatement;
-import org.apache.asterix.common.annotations.AutoDataGen;
-import org.apache.asterix.common.annotations.DateBetweenYearsDataGen;
-import org.apache.asterix.common.annotations.DatetimeAddRandHoursDataGen;
-import org.apache.asterix.common.annotations.DatetimeBetweenYearsDataGen;
-import org.apache.asterix.common.annotations.FieldIntervalDataGen;
-import org.apache.asterix.common.annotations.FieldValFileDataGen;
-import org.apache.asterix.common.annotations.FieldValFileSameIndexDataGen;
-import org.apache.asterix.common.annotations.IRecordFieldDataGen;
-import org.apache.asterix.common.annotations.InsertRandIntDataGen;
-import org.apache.asterix.common.annotations.ListDataGen;
-import org.apache.asterix.common.annotations.ListValFileDataGen;
-import org.apache.asterix.common.annotations.SkipSecondaryIndexSearchExpressionAnnotation;
-import org.apache.asterix.common.annotations.TypeDataGen;
-import org.apache.asterix.common.annotations.UndeclaredFieldsDataGen;
-import org.apache.asterix.common.config.DatasetConfig.DatasetType;
-import org.apache.asterix.common.config.DatasetConfig.IndexType;
-import org.apache.asterix.common.exceptions.AsterixException;
-import org.apache.asterix.common.functions.FunctionSignature;
-import org.apache.asterix.lang.aql.clause.DistinctClause;
-import org.apache.asterix.lang.aql.clause.ForClause;
-import org.apache.asterix.lang.aql.expression.FLWOGRExpression;
-import org.apache.asterix.lang.aql.expression.UnionExpr;
-import org.apache.asterix.lang.aql.util.RangeMapBuilder;
-import org.apache.asterix.lang.common.base.Clause;
-import org.apache.asterix.lang.common.base.Expression;
-import org.apache.asterix.lang.common.base.IParser;
-import org.apache.asterix.lang.common.base.Literal;
-import org.apache.asterix.lang.common.base.Statement;
-import org.apache.asterix.lang.common.clause.GroupbyClause;
-import org.apache.asterix.lang.common.clause.LetClause;
-import org.apache.asterix.lang.common.clause.LimitClause;
-import org.apache.asterix.lang.common.clause.OrderbyClause;
-import org.apache.asterix.lang.common.clause.UpdateClause;
-import org.apache.asterix.lang.common.clause.WhereClause;
-import org.apache.asterix.lang.common.context.RootScopeFactory;
-import org.apache.asterix.lang.common.context.Scope;
-import org.apache.asterix.lang.common.expression.AbstractAccessor;
-import org.apache.asterix.lang.common.expression.CallExpr;
-import org.apache.asterix.lang.common.expression.FieldAccessor;
-import org.apache.asterix.lang.common.expression.FieldBinding;
-import org.apache.asterix.lang.common.expression.GbyVariableExpressionPair;
-import org.apache.asterix.lang.common.expression.IfExpr;
-import org.apache.asterix.lang.common.expression.IndexAccessor;
-import org.apache.asterix.lang.common.expression.ListConstructor;
-import org.apache.asterix.lang.common.expression.LiteralExpr;
-import org.apache.asterix.lang.common.expression.OperatorExpr;
-import org.apache.asterix.lang.common.expression.OrderedListTypeDefinition;
-import org.apache.asterix.lang.common.expression.QuantifiedExpression;
-import org.apache.asterix.lang.common.expression.RecordConstructor;
-import org.apache.asterix.lang.common.expression.RecordTypeDefinition;
-import org.apache.asterix.lang.common.expression.TypeExpression;
-import org.apache.asterix.lang.common.expression.TypeReferenceExpression;
-import org.apache.asterix.lang.common.expression.UnaryExpr;
-import org.apache.asterix.lang.common.expression.UnorderedListTypeDefinition;
-import org.apache.asterix.lang.common.expression.VariableExpr;
-import org.apache.asterix.lang.common.literal.DoubleLiteral;
-import org.apache.asterix.lang.common.literal.FalseLiteral;
-import org.apache.asterix.lang.common.literal.FloatLiteral;
-import org.apache.asterix.lang.common.literal.LongIntegerLiteral;
-import org.apache.asterix.lang.common.literal.MissingLiteral;
-import org.apache.asterix.lang.common.literal.NullLiteral;
-import org.apache.asterix.lang.common.literal.StringLiteral;
-import org.apache.asterix.lang.common.literal.TrueLiteral;
-import org.apache.asterix.lang.common.parser.ScopeChecker;
-import org.apache.asterix.lang.common.statement.CompactStatement;
-import org.apache.asterix.lang.common.statement.ConnectFeedStatement;
-import org.apache.asterix.lang.common.statement.CreateDataverseStatement;
-import org.apache.asterix.lang.common.statement.CreateFeedPolicyStatement;
-import org.apache.asterix.lang.common.statement.CreateFeedStatement;
-import org.apache.asterix.lang.common.statement.CreateFunctionStatement;
-import org.apache.asterix.lang.common.statement.CreateIndexStatement;
-import org.apache.asterix.lang.common.statement.CreatePrimaryFeedStatement;
-import org.apache.asterix.lang.common.statement.CreateSecondaryFeedStatement;
-import org.apache.asterix.lang.common.statement.DatasetDecl;
-import org.apache.asterix.lang.common.statement.DataverseDecl;
-import org.apache.asterix.lang.common.statement.DataverseDropStatement;
-import org.apache.asterix.lang.common.statement.DeleteStatement;
-import org.apache.asterix.lang.common.statement.DisconnectFeedStatement;
-import org.apache.asterix.lang.common.statement.DropDatasetStatement;
-import org.apache.asterix.lang.common.statement.ExternalDetailsDecl;
-import org.apache.asterix.lang.common.statement.FeedDropStatement;
-import org.apache.asterix.lang.common.statement.FeedPolicyDropStatement;
-import org.apache.asterix.lang.common.statement.FunctionDecl;
-import org.apache.asterix.lang.common.statement.FunctionDropStatement;
-import org.apache.asterix.lang.common.statement.IndexDropStatement;
-import org.apache.asterix.lang.common.statement.InsertStatement;
-import org.apache.asterix.lang.common.statement.InternalDetailsDecl;
-import org.apache.asterix.lang.common.statement.LoadStatement;
-import org.apache.asterix.lang.common.statement.NodeGroupDropStatement;
-import org.apache.asterix.lang.common.statement.NodegroupDecl;
-import org.apache.asterix.lang.common.statement.Query;
-import org.apache.asterix.lang.common.statement.RefreshExternalDatasetStatement;
-import org.apache.asterix.lang.common.statement.RunStatement;
-import org.apache.asterix.lang.common.statement.SetStatement;
-import org.apache.asterix.lang.common.statement.TypeDecl;
-import org.apache.asterix.lang.common.statement.TypeDropStatement;
-import org.apache.asterix.lang.common.statement.UpdateStatement;
-import org.apache.asterix.lang.common.statement.UpsertStatement;
-import org.apache.asterix.lang.common.statement.WriteStatement;
-import org.apache.asterix.lang.common.struct.Identifier;
-import org.apache.asterix.lang.common.struct.QuantifiedPair;
-import org.apache.asterix.lang.common.struct.VarIdentifier;
-import org.apache.asterix.metadata.utils.MetadataConstants;
-import org.apache.hyracks.algebricks.common.utils.Pair;
-import org.apache.hyracks.algebricks.common.utils.Triple;
-import org.apache.hyracks.algebricks.core.algebra.expressions.IExpressionAnnotation;
-import org.apache.hyracks.algebricks.core.algebra.expressions.IndexedNLJoinExpressionAnnotation;
-import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.xerces.util.IntStack;
-
-class BADAQLParser extends ScopeChecker implements IParser, BADAQLParserConstants {
-
-    // optimizer hints
-    private static final String AUTO_HINT = "auto";
-    private static final String BROADCAST_JOIN_HINT = "bcast";
-    private static final String COMPOSE_VAL_FILES_HINT = "compose-val-files";
-    private static final String DATE_BETWEEN_YEARS_HINT = "date-between-years";
-    private static final String DATETIME_ADD_RAND_HOURS_HINT = "datetime-add-rand-hours";
-    private static final String DATETIME_BETWEEN_YEARS_HINT = "datetime-between-years";
-    private static final String HASH_GROUP_BY_HINT = "hash";
-    private static final String INDEXED_NESTED_LOOP_JOIN_HINT = "indexnl";
-    private static final String INMEMORY_HINT = "inmem";
-    private static final String INSERT_RAND_INT_HINT = "insert-rand-int";
-    private static final String INTERVAL_HINT = "interval";
-    private static final String LIST_HINT = "list";
-    private static final String LIST_VAL_FILE_HINT = "list-val-file";
-    private static final String RANGE_HINT = "range";
-    private static final String SKIP_SECONDARY_INDEX_SEARCH_HINT = "skip-index";
-    private static final String VAL_FILE_HINT = "val-files";
-    private static final String VAL_FILE_SAME_INDEX_HINT = "val-file-same-idx";
-    private static final String GEN_FIELDS_HINT = "gen-fields";
-    // data generator hints
-    private static final String DGEN_HINT = "dgen";
-
-    private static class IndexParams {
-      public IndexType type;
-      public int gramLength;
-
-      public IndexParams(IndexType type, int gramLength) {
-        this.type = type;
-        this.gramLength = gramLength;
-      }
-    };
-
-    private static class FunctionName {
-       public String dataverse = null;
-       public String library = null;
-       public String function = null;
-       public String hint = null;
-    }
-
-    private static String getHint(Token t) {
-        if (t.specialToken == null) {
-            return null;
-        }
-        String s = t.specialToken.image;
-        int n = s.length();
-        if (n < 2) {
-            return null;
-        }
-        return s.substring(1).trim();
-    }
-
-    private static IRecordFieldDataGen parseFieldDataGen(String hint) throws ParseException {
-      IRecordFieldDataGen rfdg = null;
-      String splits[] = hint.split(" +");
-      if (splits[0].equals(VAL_FILE_HINT)) {
-        File[] valFiles = new File[splits.length - 1];
-        for (int k=1; k<splits.length; k++) {
-          valFiles[k-1] = new File(splits[k]);
-        }
-        rfdg = new FieldValFileDataGen(valFiles);
-      } else if (splits[0].equals(VAL_FILE_SAME_INDEX_HINT)) {
-        rfdg = new FieldValFileSameIndexDataGen(new File(splits[1]), splits[2]);
-      } else if (splits[0].equals(LIST_VAL_FILE_HINT)) {
-        rfdg = new ListValFileDataGen(new File(splits[1]), Integer.parseInt(splits[2]), Integer.parseInt(splits[3]));
-      } else if (splits[0].equals(LIST_HINT)) {
-        rfdg = new ListDataGen(Integer.parseInt(splits[1]), Integer.parseInt(splits[2]));
-      } else if (splits[0].equals(INTERVAL_HINT)) {
-        FieldIntervalDataGen.ValueType vt;
-        if (splits[1].equals("int")) {
-          vt = FieldIntervalDataGen.ValueType.INT;
-        } else if (splits[1].equals("long")) {
-          vt = FieldIntervalDataGen.ValueType.LONG;
-        } else if (splits[1].equals("float")) {
-          vt = FieldIntervalDataGen.ValueType.FLOAT;
-        } else if (splits[1].equals("double")) {
-          vt = FieldIntervalDataGen.ValueType.DOUBLE;
-        } else {
-          throw new ParseException("Unknown type for interval data gen: " + splits[1]);
-        }
-        rfdg = new FieldIntervalDataGen(vt, splits[2], splits[3]);
-      } else if (splits[0].equals(INSERT_RAND_INT_HINT)) {
-        rfdg = new InsertRandIntDataGen(splits[1], splits[2]);
-      } else if (splits[0].equals(DATE_BETWEEN_YEARS_HINT)) {
-        rfdg = new DateBetweenYearsDataGen(Integer.parseInt(splits[1]), Integer.parseInt(splits[2]));
-      } else if (splits[0].equals(DATETIME_BETWEEN_YEARS_HINT)) {
-        rfdg = new DatetimeBetweenYearsDataGen(Integer.parseInt(splits[1]), Integer.parseInt(splits[2]));
-      } else if (splits[0].equals(DATETIME_ADD_RAND_HOURS_HINT)) {
-        rfdg = new DatetimeAddRandHoursDataGen(Integer.parseInt(splits[1]), Integer.parseInt(splits[2]), splits[3]);
-      } else if (splits[0].equals(AUTO_HINT)) {
-        rfdg = new AutoDataGen(splits[1]);
-      }
-      return rfdg;
-    }
-
-    public BADAQLParser(String s){
-        this(new StringReader(s));
-        super.setInput(s);
-    }
-
-    public static void main(String args[]) throws ParseException, TokenMgrError, IOException, FileNotFoundException, AsterixException {
-        File file = new File(args[0]);
-        Reader fis = new BufferedReader(new InputStreamReader(new FileInputStream(file), "UTF-8"));
-        BADAQLParser parser = new BADAQLParser(fis);
-        List<Statement> st = parser.parse();
-        //st.accept(new AQLPrintVisitor(), 0);
-    }
-
-    public List<Statement> parse() throws AsterixException {
-        try {
-            return Statement();
-        } catch (Error e) {
-            // this is here as the JavaCharStream that's below the lexer somtimes throws Errors that are not handled
-            // by the ANTLR-generated lexer or parser (e.g it does this for invalid backslash u + 4 hex digits escapes)
-            throw new AsterixException(new ParseException(e.getMessage()));
-        } catch (ParseException e){
-            throw new AsterixException(e.getMessage());
-        }
-    }
-
-  final public LimitClause LimitClause() throws ParseException, ParseException {
-    LimitClause lc = new LimitClause();
-    Expression expr;
-    pushForbiddenScope(getCurrentScope());
-    jj_consume_token(LIMIT);
-    expr = Expression();
-                                     lc.setLimitExpr(expr);
-    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
-    case OFFSET:
-      jj_consume_token(OFFSET);
-      expr = Expression();
-                                    lc.setOffset(expr);
-      break;
-    default:
-      jj_la1[0] = jj_gen;
-      ;
-    }
-    popForbiddenScope();
-    {if (true) return lc;}
-    throw new Error("Missing return statement in function");
-  }
-
-  final public String StringLiteral() throws ParseException, ParseException {
-    jj_consume_token(STRING_LITERAL);
-      {if (true) return removeQuotesAndEscapes(token.image);}
-    throw new Error("Missing return statement in function");
-  }
-
-  final public RefreshExternalDatasetStatement RefreshExternalDatasetStatement() throws ParseException, ParseException {
-  RefreshExternalDatasetStatement redss = new RefreshExternalDatasetStatement();
-  Pair<Identifier,Identifier> nameComponents = null;
-  String datasetName = null;
-    jj_consume_token(REFRESH);
-    jj_consume_token(EXTERNAL);
-    jj_consume_token(DATASET);
-    nameComponents = QualifiedName();
-    redss.setDataverseName(nameComponents.first);
-    redss.setDatasetName(nameComponents.second);
-    {if (true) return redss;}
-    throw new Error("Missing return statement in function");
-  }
-
-  final public Statement CompactStatement() throws ParseException, ParseException {
-  Pair<Identifier,Identifier> nameComponents = null;
-  Statement stmt = null;
-    jj_consume_token(COMPACT);
-    jj_consume_token(DATASET);
-    nameComponents = QualifiedName();
-      stmt = new CompactStatement(nameComponents.first, nameComponents.second);
-      {if (true) return stmt;}
-    throw new Error("Missing return statement in function");
-  }
-
-  final public Expression AndExpr() throws ParseException, ParseException {
-  OperatorExpr op = null;
-  Expression operand = null;
-    operand = RelExpr();
-    label_1:
-    while (true) {
-      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
-      case AND:
-        ;
-        break;
-      default:
-        jj_la1[1] = jj_gen;
-        break label_1;
-      }
-      jj_consume_token(AND);
-        if (op == null) {
-          op = new OperatorExpr();
-          op.addOperand(operand);
-        op.setCurrentop(true);
-        }
-        try{
-          op.addOperator(token.image);
-        } catch (AsterixException e){
-          {if (true) throw new ParseException(e.getMessage());}
-        }
-      operand = RelExpr();
-      op.addOperand(operand);
-    }
-      {if (true) return op==null? operand: op;}
-    throw new Error("Missing return statement in function");
-  }
-
-  final public TypeDecl TypeSpecification(String hint, boolean dgen) throws ParseException, ParseException {
-  Pair<Identifier,Identifier> nameComponents = null;
-  boolean ifNotExists = false;
-  TypeExpression typeExpr = null;
-    jj_consume_token(TYPE);
-    nameComponents = TypeName();
-    ifNotExists = IfNotExists();
-    jj_consume_token(AS);
-    typeExpr = TypeExpr();
-      long numValues = -1;
-      String filename = null;
-      if (dgen) {
-        String splits[] = hint.split(" +");
-        if (splits.length != 3) {
-          {if (true) throw new ParseException("Expecting /*+ dgen <filename> <numberOfItems> */");}
-        }
-        filename = splits[1];
-        numValues = Long.parseLong(splits[2]);
-      }
-      TypeDataGen tddg = new TypeDataGen(dgen, filename, numValues);
-      {if (true) return new TypeDecl(nameComponents.first, nameComponents.second, typeExpr, tddg, ifNotExists);}
-    throw new Error("Missing return statement in function");
-  }
-
-  final public Statement WriteStatement() throws ParseException, ParseException {
-  String nodeName = null;
-  String fileName = null;
-  Query query;
-  String writerClass = null;
-  Pair<Identifier,Identifier> nameComponents = null;
-    jj_consume_token(WRITE);
-    jj_consume_token(OUTPUT);
-    jj_consume_token(TO);
-    nodeName = Identifier();
-    jj_consume_token(COLON);
-    fileName = StringLiteral();
-    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
-    case USING:
-      jj_consume_token(USING);
-      writerClass = StringLiteral();
-      break;
-    default:
-      jj_la1[2] = jj_gen;
-      ;
-    }
-      {if (true) return new WriteStatement(new Identifier(nodeName), fileName, writerClass);}
-    throw new Error("Missing return statement in function");
-  }
-
-  final public Pair<Integer, Pair<List<String>, TypeExpression>> OpenField() throws ParseException, ParseException {
-  TypeExpression fieldType = null;
-  Pair<Integer, List<String>> fieldList = null;
-    fieldList = NestedField();
-    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
-    case COLON:
-      jj_consume_token(COLON);
-      fieldType = IndexedTypeExpr();
-      jj_consume_token(QUES);
-      break;
-    default:
-      jj_la1[3] = jj_gen;
-      ;
-    }
-    {if (true) return new Pair<Integer, Pair<List<String>, TypeExpression>>
-           (fieldList.first, new Pair<List<String>, TypeExpression>(fieldList.second, fieldType));}
-    throw new Error("Missing return statement in function");
-  }
-
-  final public boolean IfExists() throws ParseException, ParseException {
-    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
-    case IF:
-      jj_consume_token(IF);
-      jj_consume_token(EXISTS);
-      {if (true) return true;}
-      break;
-    default:
-      jj_la1[4] = jj_gen;
-      ;
-    }
-      {if (true) return false;}
-    throw new Error("Missing return statement in function");
-  }
-
-  final public Expression Index() throws ParseException, ParseException {
-    Expression expr = null;
-    jj_consume_token(LEFTBRACKET);
-    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
-    case DATASET:
-    case EVERY:
-    case FOR:
-    case FROM:
-    case IF:
-    case LET:
-    case SOME:
-    case WITH:
-    case MINUS:
-    case PLUS:
-    case LEFTPAREN:
-    case LEFTBRACKET:
-    case LEFTBRACE:
-    case LEFTDBLBRACE:
-    case INTEGER_LITERAL:
-    case MISSING:
-    case NULL:
-    case TRUE:
-    case FALSE:
-    case DOUBLE_LITERAL:
-    case FLOAT_LITERAL:
-    case STRING_LITERAL:
-    case IDENTIFIER:
-    case VARIABLE:
-      expr = Expression();
-        if(expr.getKind() == Expression.Kind.LITERAL_EXPRESSION)
-        {
-            Literal lit = ((LiteralExpr)expr).getValue();
-            if(lit.getLiteralType() != Literal.Type.INTEGER &&
-               lit.getLiteralType() != Literal.Type.LONG) {
-                {if (true) throw new ParseException("Index should be an INTEGER");}
-            }
-        }
-      break;
-    case QUES:
-      jj_consume_token(QUES);
-      break;
-    default:
-      jj_la1[5] = jj_gen;
-      jj_consume_token(-1);
-      throw new ParseException();
-    }
-    jj_consume_token(RIGHTBRACKET);
-      {if (true) return expr;}
-    throw new Error("Missing return statement in function");
-  }
-
-  final public IndexParams IndexType() throws ParseException, ParseException {
-  IndexType type = null;
-  int gramLength = 0;
-    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
-    case BTREE:
-      jj_consume_token(BTREE);
-      type = IndexType.BTREE;
-      break;
-    case RTREE:
-      jj_consume_token(RTREE);
-      type = IndexType.RTREE;
-      break;
-    case KEYWORD:
-      jj_consume_token(KEYWORD);
-      type = IndexType.LENGTH_PARTITIONED_WORD_INVIX;
-      break;
-    case NGRAM:
-      jj_consume_token(NGRAM);
-      jj_consume_token(LEFTPAREN);
-      jj_consume_token(INTEGER_LITERAL);
-      type = IndexType.LENGTH_PARTITIONED_NGRAM_INVIX;
-      gramLength = Integer.valueOf(token.image);
-      jj_consume_token(RIGHTPAREN);
-      break;
-    default:
-      jj_la1[6] = jj_gen;
-      jj_consume_token(-1);
-      throw new ParseException();
-    }
-    {if (true) return new IndexParams(type, gramLength);}
-    throw new Error("Missing return statement in function");
-  }
-
-  final public CreateBrokerStatement BrokerSpecification() throws ParseException, ParseException {
-  CreateBrokerStatement cbs = null;
-  Pair<Identifier,Identifier> name = null;
-  String endPoint = null;
-    jj_consume_token(BROKER);
-    name = QualifiedName();
-    jj_consume_token(AT);
-    endPoint = StringLiteral();
-      cbs = new CreateBrokerStatement(name.first, name.second,endPoint);
-      {if (true) return cbs;}
-    throw new Error("Missing return statement in function");
-  }
-
-  final public FunctionDecl FunctionDeclaration() throws ParseException, ParseException {
-  FunctionDecl funcDecl;
-  FunctionSignature signature;
-  String functionName;
-  List<VarIdentifier> paramList = new ArrayList<VarIdentifier>();
-  Expression funcBody;
-  createNewScope();
-    jj_consume_token(DECLARE);
-    jj_consume_token(FUNCTION);
-    functionName = Identifier();
-    paramList = ParameterList();
-    jj_consume_token(LEFTBRACE);
-    funcBody = Expression();
-    jj_consume_token(RIGHTBRACE);
-      signature = new FunctionSignature(defaultDataverse, functionName, paramList.size());
-      getCurrentScope().addFunctionDescriptor(signature, false);
-      funcDecl = new FunctionDecl(signature, paramList, funcBody);
-      removeCurrentScope();
-      {if (true) return funcDecl;}
-    throw new Error("Missing return statement in function");
-  }
-
-  final public Triple<Identifier,Identifier,Identifier> DoubleQualifiedName() throws ParseException, ParseException {
-  String first = null;
-  String second = null;
-  String third = null;
-    first = Identifier();
-    jj_consume_token(DOT);
-    second = Identifier();
-    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
-    case DOT:
-      jj_consume_token(DOT);
-      third = Identifier();
-      break;
-    default:
-      jj_la1[7] = jj_gen;
-      ;
-    }
-    Identifier id1 = null;
-    Identifier id2 = null;
-    Identifier id3 = null;
-    if (third == null) {
-      id2 = new Identifier(first);
-      id3 = new Identifier(second);
-    } else {
-      id1 = new Identifier(first);
-      id2 = new Identifier(second);
-      id3 = new Identifier(third);
-    }
-    {if (true) return new Triple<Identifier,Identifier,Identifier>(id1, id2, id3);}
-    throw new Error("Missing return statement in function");
-  }
-
-  final public Expression MultExpr() throws ParseException, ParseException {
-  OperatorExpr op = null;
-  Expression operand = null;
-    operand = ExponentExpr();
-    label_2:
-    while (true) {
-      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
-      case DIV:
-      case IDIV:
-      case MOD:
-      case MUL:
-        ;
-        break;
-      default:
-        jj_la1[8] = jj_gen;
-        break label_2;
-      }
-      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
-      case MUL:
-        jj_consume_token(MUL);
-        break;
-      case DIV:
-        jj_consume_token(DIV);
-        break;
-      case MOD:
-        jj_consume_token(MOD);
-        break;
-      case IDIV:
-        jj_consume_token(IDIV);
-        break;
-      default:
-        jj_la1[9] = jj_gen;
-        jj_consume_token(-1);
-        throw new ParseException();
-      }
-        if (op == null) {
-          op = new OperatorExpr();
-          op.addOperand(operand);
-          op.setCurrentop(true);
-        }
-        try{
-          op.addOperator(token.image);
-        } catch (AsterixException e){
-          {if (true) throw new ParseException(e.getMessage());}
-        }
-      operand = ExponentExpr();
-       op.addOperand(operand);
-    }
-       {if (true) return op==null?operand:op;}
-    throw new Error("Missing return statement in function");
-  }
-
-  final public InsertStatement InsertStatement() throws ParseException, ParseException {
-  Pair<Identifier,Identifier> nameComponents = null;
-  Pair<Integer, List<String>> returnField = new Pair<Integer, List<String>>(0, null);
-  boolean returnRecord = false;
-  Query query;
-  boolean upsert = false;
-    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
-    case INSERT:
-      jj_consume_token(INSERT);
-      break;
-    case UPSERT:
-      jj_consume_token(UPSERT);
-                      upsert = true;
-      break;
-    default:
-      jj_la1[10] = jj_gen;
-      jj_consume_token(-1);
-      throw new ParseException();
-    }
-    jj_consume_token(INTO);
-    jj_consume_token(DATASET);
-    nameComponents = QualifiedName();
-    query = Query();
-    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
-    case 2:
-    case RETURN:
-      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
-      case RETURN:
-        jj_consume_token(RETURN);
-        jj_consume_token(1);
-                                      returnRecord = true;
-        break;
-      case 2:
-        jj_consume_token(2);
-        returnField = NestedField();
-        break;
-      default:
-        jj_la1[11] = jj_gen;
-        jj_consume_token(-1);
-        throw new ParseException();
-      }
-      break;
-    default:
-      jj_la1[12] = jj_gen;
-      ;
-    }
-      query.setTopLevel(true);
-      if(upsert){
-        {if (true) return new UpsertStatement(nameComponents.first, nameComponents.second, query, getVarCounter());}
-      } else{
-        {if (true) return new InsertStatement(nameComponents.first, nameComponents.second, query, getVarCounter(),
-        returnRecord, returnField.second);}
-      }
-    throw new Error("Missing return statement in function");
-  }
-
-  final public Expression FunctionCallExpr() throws ParseException, ParseException {
-  CallExpr callExpr;
-  List<Expression> argList = new ArrayList<Expression>();
-  Expression tmp;
-  int arity = 0;
-  FunctionName funcName = null;
-  String hint = null;
-    funcName = FunctionName();
-      hint = funcName.hint;
-    jj_consume_token(LEFTPAREN);
-    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
-    case DATASET:
-    case EVERY:
-    case FOR:
-    case FROM:
-    case IF:
-    case LET:
-    case SOME:
-    case WITH:
-    case MINUS:
-    case PLUS:
-    case LEFTPAREN:
-    case LEFTBRACKET:
-    case LEFTBRACE:
-    case LEFTDBLBRACE:
-    case INTEGER_LITERAL:
-    case MISSING:
-    case NULL:
-    case TRUE:
-    case FALSE:
-    case DOUBLE_LITERAL:
-    case FLOAT_LITERAL:
-    case STRING_LITERAL:
-    case IDENTIFIER:
-    case VARIABLE:
-      tmp = Expression();
-      argList.add(tmp);
-      arity ++;
-      label_3:
-      while (true) {
-        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
-        case COMMA:
-          ;
-          break;
-        default:
-          jj_la1[13] = jj_gen;
-          break label_3;
-        }
-        jj_consume_token(COMMA);
-        tmp = Expression();
-      argList.add(tmp);
-      arity++;
-      }
-      break;
-    default:
-      jj_la1[14] = jj_gen;
-      ;
-    }
-    jj_consume_token(RIGHTPAREN);
-      // TODO use funcName.library
-      String fqFunctionName = funcName.library == null ? funcName.function : funcName.library + "#" + funcName.function;
-      FunctionSignature signature
-        = lookupFunctionSignature(funcName.dataverse, fqFunctionName, arity);
-      if (signature == null) {
-        signature = new FunctionSignature(funcName.dataverse, fqFunctionName, arity);
-      }
-      callExpr = new CallExpr(signature,argList);
-      if (hint != null) {
-        if (hint.startsWith(INDEXED_NESTED_LOOP_JOIN_HINT)) {
-          callExpr.addHint(IndexedNLJoinExpressionAnnotation.INSTANCE);
-        } else if (hint.startsWith(SKIP_SECONDARY_INDEX_SEARCH_HINT)) {
-          callExpr.addHint(SkipSecondaryIndexSearchExpressionAnnotation.INSTANCE);
-        }
-      }
-      {if (true) return callExpr;}
-    throw new Error("Missing return statement in function");
-  }
-
-  final public Clause Clause() throws ParseException, ParseException {
-  Clause clause;
-    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
-    case FOR:
-    case FROM:
-      clause = ForClause();
-      break;
-    case LET:
-    case WITH:
-      clause = LetClause();
-      break;
-    case WHERE:
-      clause = WhereClause();
-      break;
-    case ORDER:
-      clause = OrderbyClause();
-      break;
-    case GROUP:
-      clause = GroupClause();
-      break;
-    case LIMIT:
-      clause = LimitClause();
-      break;
-    case DISTINCT:
-      clause = DistinctClause();
-      break;
-    default:
-      jj_la1[15] = jj_gen;
-      jj_consume_token(-1);
-      throw new ParseException();
-    }
-      {if (true) return clause;}
-    throw new Error("Missing return statement in function");
-  }
-
-  final public Pair<Integer, List<String>> NestedField() throws ParseException, ParseException {
-  List<String> exprList = new ArrayList<String>();
-  String lit = null;
-  int source = 0;
-    lit = Identifier();
-    boolean meetParens = false;
-    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
-    case LEFTPAREN:
-      jj_consume_token(LEFTPAREN);
-      jj_consume_token(RIGHTPAREN);
-        if(!lit.equals("meta")){
-            {if (true) throw new ParseException("The string before () has to be \u005c"meta\u005c".");}
-        }
-        meetParens = true;
-        source = 1;
-      break;
-    default:
-      jj_la1[16] = jj_gen;
-      ;
-    }
-    if(!meetParens){
-        exprList.add(lit);
-    }
-    label_4:
-    while (true) {
-      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
-      case DOT:
-        ;
-        break;
-      default:
-        jj_la1[17] = jj_gen;
-        break label_4;
-      }
-      jj_consume_token(DOT);
-      lit = Identifier();
-      exprList.add(lit);
-    }
-    {if (true) return new Pair<Integer, List<String>>(source, exprList);}
-    throw new Error("Missing return statement in function");
-  }
-
-  final public Expression Literal() throws ParseException, ParseException {
-  LiteralExpr lit = new LiteralExpr();
-  String str = null;
-    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
-    case STRING_LITERAL:
-      str = StringLiteral();
-      lit.setValue(new StringLiteral(str));
-      break;
-    case INTEGER_LITERAL:
-      jj_consume_token(INTEGER_LITERAL);
-      lit.setValue(new LongIntegerLiteral(new Long(token.image)));
-      break;
-    case FLOAT_LITERAL:
-      jj_consume_token(FLOAT_LITERAL);
-      lit.setValue(new FloatLiteral(new Float(token.image)));
-      break;
-    case DOUBLE_LITERAL:
-      jj_consume_token(DOUBLE_LITERAL);
-      lit.setValue(new DoubleLiteral(new Double(token.image)));
-      break;
-    case MISSING:
-      jj_consume_token(MISSING);
-      lit.setValue(MissingLiteral.INSTANCE);
-      break;
-    case NULL:
-      jj_consume_token(NULL);
-      lit.setValue(NullLiteral.INSTANCE);
-      break;
-    case TRUE:
-      jj_consume_token(TRUE);
-      lit.setValue(TrueLiteral.INSTANCE);
-      break;
-    case FALSE:
-      jj_consume_token(FALSE);
-      lit.setValue(FalseLiteral.INSTANCE);
-      break;
-    default:
-      jj_la1[18] = jj_gen;
-      jj_consume_token(-1);
-      throw new ParseException();
-    }
-      {if (true) return lit;}
-    throw new Error("Missing return statement in function");
-  }
-
-  final public Expression OperatorExpr() throws ParseException, ParseException {
-  OperatorExpr op = null;
-  Expression operand = null;
-    operand = AndExpr();
-    label_5:
-    while (true) {
-      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
-      case OR:
-        ;
-        break;
-      default:
-        jj_la1[19] = jj_gen;
-        break label_5;
-      }
-      jj_consume_token(OR);
-        if (op == null) {
-          op = new OperatorExpr();
-          op.addOperand(operand);
-        op.setCurrentop(true);
-        }
-        try{
-          op.addOperator(token.image);
-        } catch (AsterixException e){
-          {if (true) throw new ParseException(e.getMessage());}
-        }
-      operand = AndExpr();
-      op.addOperand(operand);
-    }
-      {if (true) return op==null? operand: op;}
-    throw new Error("Missing return statement in function");
-  }
-
-  final public Expression AddExpr() throws ParseException, ParseException {
-  OperatorExpr op = null;
-  Expression operand = null;
-    operand = MultExpr();
-    label_6:
-    while (true) {
-      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
-      case MINUS:
-      case PLUS:
-        ;
-        break;
-      default:
-        jj_la1[20] = jj_gen;
-        break label_6;
-      }
-      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
-      case PLUS:
-        jj_consume_token(PLUS);
-        break;
-      case MINUS:
-        jj_consume_token(MINUS);
-        break;
-      default:
-        jj_la1[21] = jj_gen;
-        jj_consume_token(-1);
-        throw new ParseException();
-      }
-        if (op == null) {
-          op = new OperatorExpr();
-        op.addOperand(operand);
-        op.setCurrentop(true);
-        }
-        try{
-          ((OperatorExpr)op).addOperator(token.image);
-        } catch (AsterixException e){
-          {if (true) throw new ParseException(e.getMessage());}
-        }
-      operand = MultExpr();
-      op.addOperand(operand);
-    }
-       {if (true) return op==null? operand: op;}
-    throw new Error("Missing return statement in function");
-  }
-
-  final public Statement SetStatement() throws ParseException, ParseException {
-  String pn = null;
-  String pv = null;
-    jj_consume_token(SET);
-    pn = Identifier();
-    pv = StringLiteral();
-      {if (true) return new SetStatement(pn, pv);}
-    throw new Error("Missing return statement in function");
-  }
-
-  final public RunStatement RunStatement() throws ParseException, ParseException {
-  String system = null;
-  String tmp;
-  ArrayList<String> parameters = new  ArrayList<String>();
-  Pair<Identifier,Identifier> nameComponentsFrom = null;
-  Pair<Identifier,Identifier> nameComponentsTo = null;
-    jj_consume_token(RUN);
-    system = Identifier();
-    jj_consume_token(LEFTPAREN);
-    label_7:
-    while (true) {
-      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
-      case STRING_LITERAL:
-      case IDENTIFIER:
-        ;
-        break;
-      default:
-        jj_la1[22] = jj_gen;
-        break label_7;
-      }
-      tmp = Identifier();
-      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
-      case COMMA:
-        jj_consume_token(COMMA);
-        break;
-      default:
-        jj_la1[23] = jj_gen;
-        ;
-      }
-      parameters.add(tmp);
-    }
-    jj_consume_token(RIGHTPAREN);
-    jj_consume_token(FROM);
-    jj_consume_token(DATASET);
-    nameComponentsFrom = QualifiedName();
-    jj_consume_token(TO);
-    jj_consume_token(DATASET);
-    nameComponentsTo = QualifiedName();
-      {if (true) return new RunStatement(system, parameters, nameComponentsFrom.first, nameComponentsFrom.second, nameComponentsTo.first, nameComponentsTo.second);}
-    throw new Error("Missing return statement in function");
-  }
-
-  final public List<Statement> Statement() throws ParseException, ParseException {
-  scopeStack.push(RootScopeFactory.createRootScope(this));
-  List<Statement> decls = new ArrayList<Statement>();
-  Statement stmt = null;
-    label_8:
-    while (true) {
-      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
-      case 4:
-      case 5:
-      case 6:
-      case COMPACT:
-      case CONNECT:
-      case CREATE:
-      case DATASET:
-      case DECLARE:
-      case DELETE:
-      case DISCONNECT:
-      case DROP:
-      case EVERY:
-      case FOR:
-      case FROM:
-      case IF:
-      case INSERT:
-      case LET:
-      case LOAD:
-      case REFRESH:
-      case RUN:
-      case SET:
-      case SOME:
-      case UPDATE:
-      case UPSERT:
-      case USE:
-      case WITH:
-      case WRITE:
-      case MINUS:
-      case PLUS:
-      case LEFTPAREN:
-      case LEFTBRACKET:
-      case LEFTBRACE:
-      case LEFTDBLBRACE:
-      case INTEGER_LITERAL:
-      case MISSING:
-      case NULL:
-      case TRUE:
-      case FALSE:
-      case DOUBLE_LITERAL:
-      case FLOAT_LITERAL:
-      case STRING_LITERAL:
-      case IDENTIFIER:
-      case VARIABLE:
-        ;
-        break;
-      default:
-        jj_la1[24] = jj_gen;
-        break label_8;
-      }
-      stmt = SingleStatement();
-      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
-      case 3:
-        jj_consume_token(3);
-        break;
-      default:
-        jj_la1[25] = jj_gen;
-        ;
-      }
-      decls.add(stmt);
-    }
-    jj_consume_token(0);
-    {if (true) return decls;}
-    throw new Error("Missing return statement in function");
-  }
-
-  final public String GetPolicy() throws ParseException, ParseException {
-  String policy = null;
-    jj_consume_token(USING);
-    jj_consume_token(POLICY);
-    policy = Identifier();
-     {if (true) return policy;}
-    throw new Error("Missing return statement in function");
-  }
-
-  final public Expression FLWOGR() throws ParseException, ParseException {
-    FLWOGRExpression flworg = new FLWOGRExpression();
-    List<Clause> clauseList = new ArrayList<Clause>();
-    Expression returnExpr;
-    Clause tmp;
-    createNewScope();
-    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
-    case FOR:
-    case FROM:
-      tmp = ForClause();
-                          clauseList.add(tmp);
-      break;
-    case LET:
-    case WITH:
-      tmp = LetClause();
-                                                                     clauseList.add(tmp);
-      break;
-    default:
-      jj_la1[26] = jj_gen;
-      jj_consume_token(-1);
-      throw new ParseException();
-    }
-    label_9:
-    while (true) {
-      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
-      case DISTINCT:
-      case FOR:
-      case FROM:
-      case GROUP:
-      case LET:
-      case LIMIT:
-      case ORDER:
-      case WHERE:
-      case WITH:
-        ;
-        break;
-      default:
-        jj_la1[27] = jj_gen;
-        break label_9;
-      }
-      tmp = Clause();
-                       clauseList.add(tmp);
-    }
-    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
-    case RETURN:
-      jj_consume_token(RETURN);
-      break;
-    case SELECT:
-      jj_consume_token(SELECT);
-      break;
-    default:
-      jj_la1[28] = jj_gen;
-      jj_consume_token(-1);
-      throw new ParseException();
-    }
-    returnExpr = Expression();
-       flworg.setClauseList(clauseList);
-       flworg.setReturnExpr(returnExpr);
-       removeCurrentScope();
-       {if (true) return flworg;}
-    throw new Error("Missing return statement in function");
-  }
-
-  final public DistinctClause DistinctClause() throws ParseException, ParseException {
-  List<Expression> exprs = new ArrayList<Expression>();
-  Expression expr;
-    jj_consume_token(DISTINCT);
-    jj_consume_token(BY);
-    expr = Expression();
-    exprs.add(expr);
-    label_10:
-    while (true) {
-      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
-      case COMMA:
-        ;
-        break;
-      default:
-        jj_la1[29] = jj_gen;
-        break label_10;
-      }
-      jj_consume_token(COMMA);
-      expr = Expression();
-          exprs.add(expr);
-    }
-      {if (true) return new DistinctClause(exprs);}
-    throw new Error("Missing return statement in function");
-  }
-
-  final public Identifier Field() throws ParseException, ParseException {
-  String ident = null;
-    jj_consume_token(DOT);
-    ident = Identifier();
-      {if (true) return new Identifier(ident);}
-    throw new Error("Missing return statement in function");
-  }
-
-  final public String Identifier() throws ParseException, ParseException {
-  String lit = null;
-    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
-    case IDENTIFIER:
-      jj_consume_token(IDENTIFIER);
-      {if (true) return token.image;}
-      break;
-    case STRING_LITERAL:
-      lit = StringLiteral();
-      {if (true) return lit;}
-      break;
-    default:
-      jj_la1[30] = jj_gen;
-      jj_consume_token(-1);
-      throw new ParseException();
-    }
-    throw new Error("Missing return statement in function");
-  }
-
-// Merged Non-terminal
-  final public Statement SingleStatement() throws ParseException, ParseException {
-  Statement stmt = null;
-    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
-    case USE:
-      stmt = DataverseDeclaration();
-      break;
-    case DECLARE:
-      stmt = FunctionDeclaration();
-      break;
-    case CREATE:
-      stmt = CreateStatement();
-      break;
-    case LOAD:
-      stmt = LoadStatement();
-      break;
-    case DROP:
-      stmt = DropStatement();
-      break;
-    case WRITE:
-      stmt = WriteStatement();
-      break;
-    case SET:
-      stmt = SetStatement();
-      break;
-    case INSERT:
-    case UPSERT:
-      stmt = InsertStatement();
-      break;
-    case DELETE:
-      stmt = DeleteStatement();
-      break;
-    case UPDATE:
-      stmt = UpdateStatement();
-      break;
-    case CONNECT:
-    case DISCONNECT:
-      stmt = FeedStatement();
-      break;
-    case COMPACT:
-      stmt = CompactStatement();
-      break;
-    case DATASET:
-    case EVERY:
-    case FOR:
-    case FROM:
-    case IF:
-    case LET:
-    case SOME:
-    case WITH:
-    case MINUS:
-    case PLUS:
-    case LEFTPAREN:
-    case LEFTBRACKET:
-    case LEFTBRACE:
-    case LEFTDBLBRACE:
-    case INTEGER_LITERAL:
-    case MISSING:
-    case NULL:
-    case TRUE:
-    case FALSE:
-    case DOUBLE_LITERAL:
-    case FLOAT_LITERAL:
-    case STRING_LITERAL:
-    case IDENTIFIER:
-    case VARIABLE:
-      stmt = Query();
-      break;
-    case REFRESH:
-      stmt = RefreshExternalDatasetStatement();
-      break;
-    case RUN:
-      stmt = RunStatement();
-      break;
-    case 4:
-    case 5:
-    case 6:
-      stmt = ChannelSubscriptionStatement();
-      break;
-    default:
-      jj_la1[31] = jj_gen;
-      jj_consume_token(-1);
-      throw new ParseException();
-    }
-  {if (true) return stmt;}
-    throw new Error("Missing return statement in function");
-  }
-
-  final public Clause LetClause() throws ParseException, ParseException {
-    LetClause lc = new LetClause();
-    VariableExpr varExp;
-    Expression beExp;
-    extendCurrentScope();
-    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
-    case LET:
-      jj_consume_token(LET);
-      break;
-    case WITH:
-      jj_consume_token(WITH);
-      break;
-    default:
-      jj_la1[32] = jj_gen;
-      jj_consume_token(-1);
-      throw new ParseException();
-    }
-    varExp = Variable();
-    jj_consume_token(ASSIGN);
-    beExp = Expression();
-      getCurrentScope().addNewVarSymbolToScope(varExp.getVar());
-      lc.setVarExpr(varExp);
-      lc.setBindingExpr(beExp);
-      {if (true) return lc;}
-    throw new Error("Missing return statement in function");
-  }
-
-  final public ListConstructor UnorderedListConstructor() throws ParseException, ParseException {
-      ListConstructor expr = new ListConstructor();
-      List<Expression> exprList = null;
-      expr.setType(ListConstructor.Type.UNORDERED_LIST_CONSTRUCTOR);
-    jj_consume_token(LEFTDBLBRACE);
-    exprList = ExpressionList();
-    jj_consume_token(RIGHTDBLBRACE);
-      expr.setExprList(exprList);
-      {if (true) return expr;}
-    throw new Error("Missing return statement in function");
-  }
-
-  final public Expression PrimaryExpr() throws ParseException, ParseException {
-  Expression expr = null;
-    if (jj_2_1(2)) {
-      expr = FunctionCallExpr();
-    } else {
-      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
-      case INTEGER_LITERAL:
-      case MISSING:
-      case NULL:
-      case TRUE:
-      case FALSE:
-      case DOUBLE_LITERAL:
-      case FLOAT_LITERAL:
-      case STRING_LITERAL:
-        expr = Literal();
-        break;
-      case DATASET:
-        expr = DatasetAccessExpression();
-        break;
-      case VARIABLE:
-        expr = VariableRef();
-      if(((VariableExpr)expr).getIsNewVar() == true)
-        {if (true) throw new ParseException("can't find variable " + ((VariableExpr)expr).getVar());}
-        break;
-      case LEFTBRACKET:
-      case LEFTDBLBRACE:
-        expr = ListConstructor();
-        break;
-      case LEFTBRACE:
-        expr = RecordConstructor();
-        break;
-      case LEFTPAREN:
-        expr = ParenthesizedExpression();
-        break;
-      default:
-        jj_la1[33] = jj_gen;
-        jj_consume_token(-1);
-        throw new ParseException();
-      }
-    }
-      {if (true) return expr;}
-    throw new Error("Missing return statement in function");
-  }
-
-  final public Expression DatasetAccessExpression() throws ParseException, ParseException {
-  String funcName;
-  String arg1 = null;
-  String arg2 = null;
-  Expression nameArg;
-    jj_consume_token(DATASET);
-      funcName = token.image;
-    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
-    case STRING_LITERAL:
-    case IDENTIFIER:
-      arg1 = Identifier();
-      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
-      case DOT:
-        jj_consume_token(DOT);
-        arg2 = Identifier();
-        break;
-      default:
-        jj_la1[34] = jj_gen;
-        ;
-      }
-      String name = arg2 == null ? arg1 : arg1 + "." + arg2;
-      LiteralExpr ds = new LiteralExpr();
-      ds.setValue( new StringLiteral(name) );
-      nameArg = ds;
-      if(arg2 != null){
-          addDataverse(arg1.toString());
-          addDataset(name);
-      } else {
-          addDataset(defaultDataverse + "." + name);
-      }
-      break;
-    case LEFTPAREN:
-      jj_consume_token(LEFTPAREN);
-      nameArg = Expression();
-      jj_consume_token(RIGHTPAREN);
-      break;
-    default:
-      jj_la1[35] = jj_gen;
-      jj_consume_token(-1);
-      throw new ParseException();
-    }
-      String dataverse = MetadataConstants.METADATA_DATAVERSE_NAME;
-      FunctionSignature signature = lookupFunctionSignature(dataverse, funcName, 1);
-      if (signature == null) {
-        signature = new FunctionSignature(dataverse, funcName, 1);
-      }
-      List<Expression> argList = new ArrayList<Expression>();
-      argList.add(nameArg);
-      {if (true) return new CallExpr(signature, argList);}
-    throw new Error("Missing return statement in function");
-  }
-
-  final public Pair<Identifier,Identifier> QualifiedName() throws ParseException, ParseException {
-  String first = null;
-  String second = null;
-    first = Identifier();
-    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
-    case DOT:
-      jj_consume_token(DOT);
-      second = Identifier();
-      break;
-    default:
-      jj_la1[36] = jj_gen;
-      ;
-    }
-    Identifier id1 = null;
-    Identifier id2 = null;
-    if (second == null) {
-      id2 = new Identifier(first);
-    } else
-    {
-      id1 = new Identifier(first);
-      id2 = new Identifier(second);
-    }
-    {if (true) return new Pair<Identifier,Identifier>(id1, id2);}
-    throw new Error("Missing return statement in function");
-  }
-
-  final public UpdateClause UpdateClause() throws ParseException, ParseException {
-  Expression target = null;
-  Expression value = null ;
-  InsertStatement is = null;
-  DeleteStatement ds = null;
-  UpdateStatement us = null;
-  Expression condition = null;
-  UpdateClause ifbranch = null;
-  UpdateClause elsebranch = null;
-    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
-    case SET:
-      jj_consume_token(SET);
-      target = Expression();
-      jj_consume_token(ASSIGN);
-      value = Expression();
-      break;
-    case INSERT:
-    case UPSERT:
-      is = InsertStatement();
-      break;
-    case DELETE:
-      ds = DeleteStatement();
-      break;
-    case UPDATE:
-      us = UpdateStatement();
-      break;
-    case IF:
-      jj_consume_token(IF);
-      jj_consume_token(LEFTPAREN);
-      condition = Expression();
-      jj_consume_token(RIGHTPAREN);
-      jj_consume_token(THEN);
-      ifbranch = UpdateClause();
-      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
-      case ELSE:
-        jj_consume_token(ELSE);
-        elsebranch = UpdateClause();
-        break;
-      default:
-        jj_la1[37] = jj_gen;
-        ;
-      }
-       {if (true) return new UpdateClause(target, value, is, ds, us, condition, ifbranch, elsebranch);}
-      break;
-    default:
-      jj_la1[38] = jj_gen;
-      jj_consume_token(-1);
-      throw new ParseException();
-    }
-    throw new Error("Missing return statement in function");
-  }
-
-  final public Clause ForClause() throws ParseException, ParseException {
-    ForClause fc = new ForClause();
-    VariableExpr varExp;
-    VariableExpr varPos = null;
-    Expression inExp;
-    extendCurrentScope();
-    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
-    case FOR:
-      jj_consume_token(FOR);
-      break;
-    case FROM:
-      jj_consume_token(FROM);
-      break;
-    default:
-      jj_la1[39] = jj_gen;
-      jj_consume_token(-1);
-      throw new ParseException();
-    }
-    varExp = Variable();
-    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
-    case AT:
-      jj_consume_token(AT);
-      varPos = Variable();
-      break;
-    default:
-      jj_la1[40] = jj_gen;
-      ;
-    }
-    jj_consume_token(IN);
-    inExp = Expression();
-      fc.setVarExpr(varExp);
-      getCurrentScope().addNewVarSymbolToScope(varExp.getVar());
-      fc.setInExpr(inExp);
-      if (varPos != null) {
-        fc.setPosExpr(varPos);
-        getCurrentScope().addNewVarSymbolToScope(varPos.getVar());
-      }
-      {if (true) return fc;}
-    throw new Error("Missing return statement in function");
-  }
-
-  final public Clause OrderbyClause() throws ParseException, ParseException {
-    OrderbyClause oc = new OrderbyClause();
-    Expression orderbyExpr;
-    List<Expression> orderbyList = new ArrayList<Expression>();
-    List<OrderbyClause.OrderModifier> modifierList = new ArrayList<OrderbyClause.OrderModifier >();
-    int numOfOrderby = 0;
-    jj_consume_token(ORDER);
-        String hint = getHint(token);
-        if (hint != null) {
-          if (hint.startsWith(INMEMORY_HINT)) {
-            String splits[] = hint.split(" +");
-            int numFrames = Integer.parseInt(splits[1]);
-            int numTuples = Integer.parseInt(splits[2]);
-            oc.setNumFrames(numFrames);
-            oc.setNumTuples(numTuples);
-          }
-          if (hint.startsWith(RANGE_HINT)) {
-            try{
-              oc.setRangeMap(RangeMapBuilder.parseHint(hint.substring(RANGE_HINT.length())));
-            } catch (AsterixException e) {
-              {if (true) throw new ParseException(e.getMessage());}
-            }
-          }
-        }
-    jj_consume_token(BY);
-    orderbyExpr = Expression();
-      orderbyList.add(orderbyExpr);
-      OrderbyClause.OrderModifier modif = OrderbyClause.OrderModifier.ASC;
-    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
-    case ASC:
-    case DESC:
-      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
-      case ASC:
-        jj_consume_token(ASC);
-               modif = OrderbyClause.OrderModifier.ASC;
-        break;
-      case DESC:
-        jj_consume_token(DESC);
-                modif = OrderbyClause.OrderModifier.DESC;
-        break;
-      default:
-        jj_la1[41] = jj_gen;
-        jj_consume_token(-1);
-        throw new ParseException();
-      }
-      break;
-    default:
-      jj_la1[42] = jj_gen;
-      ;
-    }
-      modifierList.add(modif);
-    label_11:
-    while (true) {
-      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
-      case COMMA:
-        ;
-        break;
-      default:
-        jj_la1[43] = jj_gen;
-        break label_11;
-      }
-      jj_consume_token(COMMA);
-      orderbyExpr = Expression();
-      orderbyList.add(orderbyExpr);
-      modif = OrderbyClause.OrderModifier.ASC;
-      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
-      case ASC:
-      case DESC:
-        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
-        case ASC:
-          jj_consume_token(ASC);
-               modif = OrderbyClause.OrderModifier.ASC;
-          break;
-        case DESC:
-          jj_consume_token(DESC);
-                modif = OrderbyClause.OrderModifier.DESC;
-          break;
-        default:
-          jj_la1[44] = jj_gen;
-          jj_consume_token(-1);
-          throw new ParseException();
-        }
-        break;
-      default:
-        jj_la1[45] = jj_gen;
-        ;
-      }
-      modifierList.add(modif);
-    }
-      oc.setModifierList(modifierList);
-      oc.setOrderbyList(orderbyList);
-      {if (true) return oc;}
-    throw new Error("Missing return statement in function");
-  }
-
-  final public Expression IfThenElse() throws ParseException, ParseException {
-  Expression condExpr;
-  Expression thenExpr;
-  Expression elseExpr;
-  IfExpr ifExpr = new IfExpr();
-    jj_consume_token(IF);
-    jj_consume_token(LEFTPAREN);
-    condExpr = Expression();
-    jj_consume_token(RIGHTPAREN);
-    jj_consume_token(THEN);
-    thenExpr = Expression();
-    jj_consume_token(ELSE);
-    elseExpr = Expression();
-      ifExpr.setCondExpr(condExpr);
-      ifExpr.setThenExpr(thenExpr);
-      ifExpr.setElseExpr(elseExpr);
-      {if (true) return ifExpr;}
-    throw new Error("Missing return statement in function");
-  }
-
-  final public void RecordField(RecordTypeDefinition recType) throws ParseException, ParseException {
-  String fieldName;
-  TypeExpression type = null;
-  boolean nullable = false;
-    fieldName = Identifier();
-      String hint = getHint(token);
-      IRecordFieldDataGen rfdg = hint != null ? parseFieldDataGen(hint) : null;
-    jj_consume_token(COLON);
-    type = TypeExpr();
-    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
-    case QUES:
-      jj_consume_token(QUES);
-                                       nullable = true;
-      break;
-    default:
-      jj_la1[46] = jj_gen;
-      ;
-    }
-      recType.addField(fieldName, type, nullable, rfdg);
-  }
-
-  final public Expression UnionExpr() throws ParseException, ParseException {
-    UnionExpr union = null;
-    Expression operand1 = null;
-    Expression operand2 = null;
-    operand1 = UnaryExpr();
-    label_12:
-    while (true) {
-      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
-      case UNION:
-        ;
-        break;
-      default:
-        jj_la1[47] = jj_gen;
-        break label_12;
-      }
-      jj_consume_token(UNION);
-      operand2 = UnaryExpr();
-          if (union == null) {
-             union = new UnionExpr();
-             union.addExpr(operand1);
-          }
-          union.addExpr(operand2);
-    }
-     {if (true) return (union == null)? operand1: union;}
-    throw new Error("Missing return statement in function");
-  }
-
-  final public Expression RelExpr() throws ParseException, ParseException {
-  OperatorExpr op = null;
-  Expression operand = null;
-  boolean broadcast = false;
-  IExpressionAnnotation annotation = null;
-    operand = AddExpr();
-      if (operand instanceof VariableExpr) {
-        String hint = getHint(token);
-        if (hint != null && hint.equals(BROADCAST_JOIN_HINT)) {
-          broadcast = true;
-        }
-      }
-    if (jj_2_2(2)) {
-      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
-      case LT:
-        jj_consume_token(LT);
-        break;
-      case GT:
-        jj_consume_token(GT);
-        break;
-      case LE:
-        jj_consume_token(LE);
-        break;
-      case GE:
-        jj_consume_token(GE);
-        break;
-      case EQ:
-        jj_consume_token(EQ);
-        break;
-      case NE:
-        jj_consume_token(NE);
-        break;
-      case SIMILAR:
-        jj_consume_token(SIMILAR);
-        break;
-      default:
-        jj_la1[48] = jj_gen;
-        jj_consume_token(-1);
-        throw new ParseException();
-      }
-          String mhint = getHint(token);
-          if (mhint != null) {
-            if (mhint.equals(INDEXED_NESTED_LOOP_JOIN_HINT)) {
-            annotation = IndexedNLJoinExpressionAnnotation.INSTANCE;
-          } else if (mhint.equals(SKIP_SECONDARY_INDEX_SEARCH_HINT)) {
-            annotation = SkipSecondaryIndexSearchExpressionAnnotation.INSTANCE;
-          }
-        }
-          if (op == null) {
-            op = new OperatorExpr();
-            op.addOperand(operand, broadcast);
-          op.setCurrentop(true);
-          broadcast = false;
-          }
-         try{
-           op.addOperator(token.image);
-         } catch (AsterixException e){
-           {if (true) throw new ParseException(e.getMessage());}
-         }
-      operand = AddExpr();
-         broadcast = false;
-         if (operand instanceof VariableExpr) {
-           String hint = getHint(token);
-           if (hint != null && hint.equals(BROADCAST_JOIN_HINT)) {
-             broadcast = true;
-           }
-         }
-         op.addOperand(operand, broadcast);
-    } else {
-      ;
-    }
-       if (annotation != null) {
-         op.addHint(annotation);
-       }
-       {if (true) return op==null? operand: op;}
-    throw new Error("Missing return statement in function");
-  }
-
-  final public String FilterField() throws ParseException, ParseException {
-  String filterField = null;
-    filterField = Identifier();
-      {if (true) return filterField;}
-    throw new Error("Missing return statement in function");
-  }
-
-  final public FunctionSignature ApplyFunction() throws ParseException, ParseException {
-  FunctionName functioName = null;
-  FunctionSignature funcSig = null;
-    jj_consume_token(APPLY);
-    jj_consume_token(FUNCTION);
-    functioName = FunctionName();
-       String fqFunctionName = functioName.library == null ? functioName.function : functioName.library + "#" + functioName.function;
-       {if (true) return new FunctionSignature(functioName.dataverse, fqFunctionName, 1);}
-    throw new Error("Missing return statement in function");
-  }
-
-  final public String CompactionPolicy() throws ParseException, ParseException {
-  String compactionPolicy = null;
-    compactionPolicy = Identifier();
-      {if (true) return compactionPolicy;}
-    throw new Error("Missing return statement in function");
-  }
-
-  final public FunctionName FunctionName() throws ParseException, ParseException {
-  String first = null;
-  String second = null;
-  String third = null;
-  boolean secondAfterDot = false;
-    first = Identifier();
-    FunctionName result = new FunctionName();
-    result.hint = getHint(token);
-    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
-    case DOT:
-    case SYMBOLHASH:
-      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
-      case DOT:
-        jj_consume_token(DOT);
-        second = Identifier();
-      secondAfterDot = true;
-        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
-        case SYMBOLHASH:
-          jj_consume_token(SYMBOLHASH);
-          third = Identifier();
-          break;
-        default:
-          jj_la1[49] = jj_gen;
-          ;
-        }
-        break;
-      case SYMBOLHASH:
-        jj_consume_token(SYMBOLHASH);
-        second = Identifier();
-        break;
-      default:
-        jj_la1[50] = jj_gen;
-        jj_consume_token(-1);
-        throw new ParseException();
-      }
-      break;
-    default:
-      jj_la1[51] = jj_gen;
-      ;
-    }
-      if (second == null) {
-        result.dataverse = defaultDataverse;
-        result.library = null;
-        result.function = first;
-      } else if (third == null) {
-        if (secondAfterDot) {
-          result.dataverse = first;
-          result.library   = null;
-          result.function = second;
-        } else {
-          result.dataverse = defaultDataverse;
-          result.library   = first;
-          result.function = second;
-        }
-      } else {
-        result.dataverse = first;
-        result.library   = second;
-        result.function  = third;
-      }
-
-      if (result.function.equalsIgnoreCase("int")) {
-            result.function = "int64";
-      }
-      {if (true) return result;}
-    throw new Error("Missing return statement in function");
-  }
-
-  final public List<Expression> ExpressionList() throws ParseException, ParseException {
-      Expression expr = null;
-      List<Expression> list = null;
-      List<Expression> exprList = new ArrayList<Expression>();
-    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
-    case DATASET:
-    case EVERY:
-    case FOR:
-    case FROM:
-    case IF:
-    case LET:
-    case SOME:
-    case WITH:
-    case MINUS:
-    case PLUS:
-    case LEFTPAREN:
-    case LEFTBRACKET:
-    case LEFTBRACE:
-    case LEFTDBLBRACE:
-    case INTEGER_LITERAL:
-    case MISSING:
-    case NULL:
-    case TRUE:
-    case FALSE:
-    case DOUBLE_LITERAL:
-    case FLOAT_LITERAL:
-    case STRING_LITERAL:
-    case IDENTIFIER:
-    case VARIABLE:
-      expr = Expression();
-                            exprList.add(expr);
-      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
-      case COMMA:
-        jj_consume_token(COMMA);
-        list = ExpressionList();
-                                                      exprList.addAll(list);
-        break;
-      default:
-        jj_la1[52] = jj_gen;
-        ;
-      }
-      break;
-    default:
-      jj_la1[53] = jj_gen;
-      ;
-    }
-    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
-    case COMMA:
-      Comma();
-      break;
-    default:
-      jj_la1[54] = jj_gen;
-      ;
-    }
-        {if (true) return exprList;}
-    throw new Error("Missing return statement in function");
-  }
-
-  final public DeleteStatement DeleteStatement() throws ParseException, ParseException {
-  VariableExpr var = null;
-  Expression condition = null;
-  Pair<Identifier, Identifier> nameComponents;
-  // This is related to the new metadata lock management
-  setDataverses(new ArrayList<String>());
-  setDatasets(new ArrayList<String>());
-    jj_consume_token(DELETE);
-    var = Variable();
-      getCurrentScope().addNewVarSymbolToScope(var.getVar());
-    jj_consume_token(FROM);
-    jj_consume_token(DATASET);
-    nameComponents = QualifiedName();
-    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
-    case WHERE:
-      jj_consume_token(WHERE);
-      condition = Expression();
-      break;
-    default:
-      jj_la1[55] = jj_gen;
-      ;
-    }
-      // First we get the dataverses and datasets that we want to lock
-      List<String> dataverses = getDataverses();
-      List<String> datasets = getDatasets();
-      // we remove the pointer to the dataverses and datasets
-      setDataverses(null);
-      setDatasets(null);
-      {if (true) return new DeleteStatement(var, nameComponents.first, nameComponents.second,
-          condition, getVarCounter(), dataverses, datasets);}
-    throw new Error("Missing return statement in function");
-  }
-
-  final public Map<String,String> Properties() throws ParseException, ParseException {
-  Map<String,String> properties = new HashMap<String,String>();
-  Pair<String, String> property;
-    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
-    case LEFTPAREN:
-      jj_consume_token(LEFTPAREN);
-      property = Property();
-      properties.put(property.first, property.second);
-      label_13:
-      while (true) {
-        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
-        case COMMA:
-          ;
-          break;
-        default:
-          jj_la1[56] = jj_gen;
-          break label_13;
-        }
-        jj_consume_token(COMMA);
-        property = Property();
-      properties.put(property.first, property.second);
-      }
-      jj_consume_token(RIGHTPAREN);
-      break;
-    default:
-      jj_la1[57] = jj_gen;
-      ;
-    }
-      {if (true) return properties;}
-    throw new Error("Missing return statement in function");
-  }
-
-  final public Clause GroupClause() throws ParseException, ParseException {
-    GroupbyClause gbc = new GroupbyClause();
-    // GbyVariableExpressionPair pair = new GbyVariableExpressionPair();
-    List<GbyVariableExpressionPair> vePairList = new ArrayList<GbyVariableExpressionPair>();
-    List<GbyVariableExpressionPair> decorPairList = new ArrayList<GbyVariableExpressionPair>();
-    Map<Expression, VariableExpr> withVarMap = new HashMap<Expression, VariableExpr>();
-    VariableExpr var = null;
-    VariableExpr withVar = null;
-    Expression expr = null;
-    VariableExpr decorVar = null;
-    Expression decorExpr = null;
-        Scope newScope = extendCurrentScopeNoPush(true);
-        // extendCurrentScope(true);
-
-    jj_consume_token(GROUP);
-         String hint = getHint(token);
-         if (hint != null && hint.equals(HASH_GROUP_BY_HINT)) {
-           gbc.setHashGroupByHint(true);
-         }
-    jj_consume_token(BY);
-    if (jj_2_3(2)) {
-      var = Variable();
-      newScope.addNewVarSymbolToScope(var.getVar());
-      jj_consume_token(ASSIGN);
-    } else {
-      ;
-    }
-    expr = Expression();
-         GbyVariableExpressionPair pair1 = new GbyVariableExpressionPair(var, expr);
-         vePairList.add(pair1);
-    label_14:
-    while (true) {
-      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
-      case COMMA:
-        ;
-        break;
-      default:
-        jj_la1[58] = jj_gen;
-        break label_14;
-      }
-      jj_consume_token(COMMA);
-      if (jj_2_4(2)) {
-        var = Variable();
-      newScope.addNewVarSymbolToScope(var.getVar());
-        jj_consume_token(ASSIGN);
-      } else {
-        ;
-      }
-      expr = Expression();
-           GbyVariableExpressionPair pair2 = new GbyVariableExpressionPair(var, expr);
-           vePairList.add(pair2);
-    }
-    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
-    case DECOR:
-      jj_consume_token(DECOR);
-      decorVar = Variable();
-      jj_consume_token(ASSIGN);
-      decorExpr = Expression();
-         newScope.addNewVarSymbolToScope(decorVar.getVar());
-         GbyVariableExpressionPair pair3 = new GbyVariableExpressionPair(decorVar, decorExpr);
-         decorPairList.add(pair3);
-      label_15:
-      while (true) {
-        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
-        case COMMA:
-          ;
-          break;
-        default:
-          jj_la1[59] = jj_gen;
-          break label_15;
-        }
-        jj_consume_token(COMMA);
-        jj_consume_token(DECOR);
-        decorVar = Variable();
-        jj_consume_token(ASSIGN);
-        decorExpr = Expression();
-             newScope.addNewVarSymbolToScope(decorVar.getVar());
-             GbyVariableExpressionPair pair4 = new GbyVariableExpressionPair(decorVar, decorExpr);
-             decorPairList.add(pair4);
-      }
-      break;
-    default:
-      jj_la1[60] = jj_gen;
-      ;
-    }
-    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
-    case WITH:
-      jj_consume_token(WITH);
-      break;
-    case KEEPING:
-      jj_consume_token(KEEPING);
-      break;
-    default:
-      jj_la1[61] = jj_gen;
-      jj_consume_token(-1);
-      throw new ParseException();
-    }
-    withVar = VariableRef();
-      if(withVar.getIsNewVar()==true)
-          {if (true) throw new ParseException("can't find variable " + withVar.getVar());}
-      withVarMap.put(withVar, withVar);
-      newScope.addNewVarSymbolToScope(withVar.getVar());
-    label_16:
-    while (true) {
-      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
-      case COMMA:
-        ;
-        break;
-      default:
-        jj_la1[62] = jj_gen;
-        break label_16;
-      }
-      jj_consume_token(COMMA);
-      withVar = VariableRef();
-      if(withVar.getIsNewVar()==true)
-          {if (true) throw new ParseException("can't find variable " + withVar.getVar());}
-      withVarMap.put(withVar, withVar);
-      newScope.addNewVarSymbolToScope(withVar.getVar());
-    }
-      gbc.setGbyPairList(vePairList);
-      gbc.setDecorPairList(decorPairList);
-      gbc.setWithVarMap(withVarMap);
-      replaceCurrentScope(newScope);
-      {if (true) return gbc;}
-    throw new Error("Missing return statement in function");
-  }
-
-  final public OrderedListTypeDefinition OrderedListTypeDef() throws ParseException, ParseException {
-  TypeExpression type = null;
-    jj_consume_token(LEFTBRACKET);
-    type = TypeExpr();
-    jj_consume_token(RIGHTBRACKET);
-    {if (true) return new OrderedListTypeDefinition(type);}
-    throw new Error("Missing return statement in function");
-  }
-
-  final public boolean IfNotExists() throws ParseException, ParseException {
-    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
-    case IF:
-      jj_consume_token(IF);
-      jj_consume_token(IDENTIFIER);
-        if(!token.image.equals("not")){
-           {if (true) throw new ParseException("Expect word \u005c"not\u005c" at line " + token.beginLine + ", column "
-                         + token.beginColumn +"!");}
-        }
-      jj_consume_token(EXISTS);
-      {if (true) return true;}
-      break;
-    default:
-      jj_la1[63] = jj_gen;
-      ;
-    }
-      {if (true) return false;}
-    throw new Error("Missing return statement in function");
-  }
-
-  final public Expression ListConstructor() throws ParseException, ParseException {
-    Expression expr = null;
-    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
-    case LEFTBRACKET:
-      expr = OrderedListConstructor();
-      break;
-    case LEFTDBLBRACE:
-      expr = UnorderedListConstructor();
-      break;
-    default:
-      jj_la1[64] = jj_gen;
-      jj_consume_token(-1);
-      throw new ParseException();
-    }
-      {if (true) return expr;}
-    throw new Error("Missing return statement in function");
-  }
-
-  final public LoadStatement LoadStatement() throws ParseException, ParseException {
-  Identifier dataverseName = null;
-  Identifier datasetName = null;
-  boolean alreadySorted = false;
-  String adapterName;
-  Map<String,String> properties;
-  Pair<Identifier,Identifier> nameComponents = null;
-    jj_consume_token(LOAD);
-    jj_consume_token(DATASET);
-    nameComponents = QualifiedName();
-      dataverseName = nameComponents.first;
-      datasetName = nameComponents.second;
-    jj_consume_token(USING);
-    adapterName = AdapterName();
-    properties = Configuration();
-    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
-    case PRESORTED:
-      jj_consume_token(PRESORTED);
-      alreadySorted = true;
-      break;
-    default:
-      jj_la1[65] = jj_gen;
-      ;
-    }
-      {if (true) return new LoadStatement(dataverseName, datasetName, adapterName, properties, alreadySorted);}
-    throw new Error("Missing return statement in function");
-  }
-
-  final public Statement ChannelSubscriptionStatement() throws ParseException, ParseException {
-  Statement stmt = null;
-  Pair<Identifier,Identifier> nameComponents = null;
-  List<Expression> argList = new ArrayList<Expression>();
-  Expression tmp = null;
-  String id = null;
-  String subscriptionId = null;
-  Pair<Identifier,Identifier> brokerName = null;
-    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
-    case 4:
-      jj_consume_token(4);
-      jj_consume_token(TO);
-      nameComponents = QualifiedName();
-      jj_consume_token(LEFTPAREN);
-      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
-      case DATASET:
-      case EVERY:
-      case FOR:
-      case FROM:
-      case IF:
-      case LET:
-      case SOME:
-      case WITH:
-      case MINUS:
-      case PLUS:
-      case LEFTPAREN:
-      case LEFTBRACKET:
-      case LEFTBRACE:
-      case LEFTDBLBRACE:
-      case INTEGER_LITERAL:
-      case MISSING:
-      case NULL:
-      case TRUE:
-      case FALSE:
-      case DOUBLE_LITERAL:
-      case FLOAT_LITERAL:
-      case STRING_LITERAL:
-      case IDENTIFIER:
-      case VARIABLE:
-        tmp = Expression();
-      argList.add(tmp);
-        label_17:
-        while (true) {
-          switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
-          case COMMA:
-            ;
-            break;
-          default:
-            jj_la1[66] = jj_gen;
-            break label_17;
-          }
-          jj_consume_token(COMMA);
-          tmp = Expression();
-      argList.add(tmp);
-        }
-        break;
-      default:
-        jj_la1[67] = jj_gen;
-        ;
-      }
-      jj_consume_token(RIGHTPAREN);
-      jj_consume_token(ON);
-      brokerName = QualifiedName();
-      stmt = new ChannelSubscribeStatement(nameComponents.first, nameComponents.second, argList, getVarCounter(), brokerName.first, brokerName.second, subscriptionId);
-      break;
-    case 5:
-      jj_consume_token(5);
-      id = StringLiteral();
-      jj_consume_token(FROM);
-      nameComponents = QualifiedName();
-        setDataverses(new ArrayList<String>());
-        setDatasets(new ArrayList<String>());
-        VariableExpr varExp = new VariableExpr();
-        VarIdentifier var = new VarIdentifier();
-        varExp.setVar(var);
-        var.setValue("$subscriptionPlaceholder");
-        getCurrentScope().addNewVarSymbolToScope(varExp.getVar());
-        List<String> dataverses = getDataverses();
-        List<String> datasets = getDatasets();
-        // we remove the pointer to the dataverses and datasets
-        setDataverses(null);
-        setDatasets(null);
-        stmt = new ChannelUnsubscribeStatement(varExp, nameComponents.first, nameComponents.second, id, getVarCounter(), dataverses, datasets);
-      break;
-    case 6:
-      jj_consume_token(6);
-      jj_consume_token(7);
-      subscriptionId = StringLiteral();
-      jj_consume_token(ON);
-      nameComponents = QualifiedName();
-      jj_consume_token(LEFTPAREN);
-      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
-      case DATASET:
-      case EVERY:
-      case FOR:
-      case FROM:
-      case IF:
-      case LET:
-      case SOME:
-      case WITH:
-      case MINUS:
-      case PLUS:
-      case LEFTPAREN:
-      case LEFTBRACKET:
-      case LEFTBRACE:
-      case LEFTDBLBRACE:
-      case INTEGER_LITERAL:
-      case MISSING:
-      case NULL:
-      case TRUE:
-      case FALSE:
-      case DOUBLE_LITERAL:
-      case FLOAT_LITERAL:
-      case STRING_LITERAL:
-      case IDENTIFIER:
-      case VARIABLE:
-        tmp = Expression();
-         argList.add(tmp);
-        label_18:
-        while (true) {
-          switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
-          case COMMA:
-            ;
-            break;
-          default:
-            jj_la1[68] = jj_gen;
-            break label_18;
-          }
-          jj_consume_token(COMMA);
-          tmp = Expression();
-         argList.add(tmp);
-        }
-        break;
-      default:
-        jj_la1[69] = jj_gen;
-        ;
-      }
-      jj_consume_token(RIGHTPAREN);
-      jj_consume_token(TO);
-      brokerName = QualifiedName();
-        stmt = new ChannelSubscribeStatement(nameComponents.first, nameComponents.second, argList, getVarCounter(), brokerName.first, brokerName.second, subscriptionId);
-      break;
-    default:
-      jj_la1[70] = jj_gen;
-      jj_consume_token(-1);
-      throw new ParseException();
-    }
-      {if (true) return stmt;}
-    throw new Error("Missing return statement in function");
-  }
-
-  final public Expression UnaryExpr() throws ParseException, ParseException {
-    UnaryExpr uexpr = null;
-    Expression expr = null;
-    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
-    case MINUS:
-    case PLUS:
-      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
-      case PLUS:
-        jj_consume_token(PLUS);
-        break;
-      case MINUS:
-        jj_consume_token(MINUS);
-        break;
-      default:
-        jj_la1[71] = jj_gen;
-        jj_consume_token(-1);
-        throw new ParseException();
-      }
-          uexpr = new UnaryExpr();
-          try{
-            uexpr.setExprType(token.image);
-          } catch (AsterixException e){
-            {if (true) throw new ParseException(e.getMessage());}
-          }
-      break;
-    default:
-      jj_la1[72] = jj_gen;
-      ;
-    }
-    expr = ValueExpr();
-        if(uexpr!=null){
-            ((UnaryExpr)uexpr).setExpr(expr);
-            {if (true) return uexpr;}
-        }
-        else{
-            {if (true) return expr;}
-        }
-    throw new Error("Missing return statement in function");
-  }
-
-  final public Query Query() throws ParseException, ParseException {
-  Query query = new Query(false);
-  // we set the pointers to the dataverses and datasets lists to fill them with entities to be locked
-  setDataverses(query.getDataverses());
-  setDatasets(query.getDatasets());
-  Expression expr;
-    expr = Expression();
-      query.setBody(expr);
-      query.setVarCounter(getVarCounter());
-      // we remove the pointers to the locked entities before we return the query object
-      setDataverses(null);
-      setDatasets(null);
-      {if (true) return query;}
-    throw new Error("Missing return statement in function");
-  }
-
-  final public Expression ValueExpr() throws ParseException, ParseException {
-  Expression expr = null;
-  Identifier ident = null;
-  AbstractAccessor fa = null;
-  Expression indexExpr = null;
-    expr = PrimaryExpr();
-    label_19:
-    while (true) {
-      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
-      case LEFTBRACKET:
-      case DOT:
-        ;
-        break;
-      default:
-        jj_la1[73] = jj_gen;
-        break label_19;
-      }
-      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
-      case DOT:
-        ident = Field();
-      fa = (fa == null ? new FieldAccessor(expr, ident)
-                       : new FieldAccessor(fa, ident));
-        break;
-      case LEFTBRACKET:
-        indexExpr = Index();
-      fa = (fa == null ? new IndexAccessor(expr, indexExpr)
-                       : new IndexAccessor(fa, indexExpr));
-        break;
-      default:
-        jj_la1[74] = jj_gen;
-        jj_consume_token(-1);
-        throw new ParseException();
-      }
-    }
-      {if (true) return fa == null ? expr : fa;}
-    throw new Error("Missing return statement in function");
-  }
-
-  final public TypeReferenceExpression TypeReference() throws ParseException, ParseException {
-  String id = null;
-    id = Identifier();
-     if (id.equalsIgnoreCase("int")) {
-        id = "int64";
-     }
-
-     {if (true) return new TypeReferenceExpression(new Identifier(id));}
-    throw new Error("Missing return statement in function");
-  }
-
-// Merged Non-terminal
-  final public Statement DropStatement() throws ParseException, ParseException {
-  String id = null;
-  Pair<Identifier,Identifier> pairId = null;
-  Triple<Identifier,Identifier,Identifier> tripleId = null;
-  FunctionSignature funcSig = null;
-  boolean ifExists = false;
-  Statement stmt = null;
-    jj_consume_token(DROP);
-    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
-    case DATASET:
-      jj_consume_token(DATASET);
-      pairId = QualifiedName();
-      ifExists = IfExists();
-        stmt = new DropDatasetStatement(pairId.first, pairId.second, ifExists);
-      break;
-    case INDEX:
-      jj_consume_token(INDEX);
-      tripleId = DoubleQualifiedName();
-      ifExists = IfExists();
-        stmt = new IndexDropStatement(tripleId.first, tripleId.second, tripleId.third, ifExists);
-      break;
-    case NODEGROUP:
-      jj_consume_token(NODEGROUP);
-      id = Identifier();
-      ifExists = IfExists();
-        stmt = new NodeGroupDropStatement(new Identifier(id), ifExists);
-      break;
-    case TYPE:
-      jj_consume_token(TYPE);
-      pairId = TypeName();
-      ifExists = IfExists();
-        stmt = new TypeDropStatement(pairId.first, pairId.second, ifExists);
-      break;
-    case DATAVERSE:
-      jj_consume_token(DATAVERSE);
-      id = Identifier();
-      ifExists = IfExists();
-        stmt = new DataverseDropStatement(new Identifier(id), ifExists);
-      break;
-    case FUNCTION:
-      jj_consume_token(FUNCTION);
-      funcSig = FunctionSignature();
-      ifExists = IfExists();
-        stmt = new FunctionDropStatement(funcSig, ifExists);
-      break;
-    case FEED:
-      jj_consume_token(FEED);
-      pairId = QualifiedName();
-      ifExists = IfExists();
-        stmt = new FeedDropStatement(pairId.first, pairId.second, ifExists);
-      break;
-    case INGESTION:
-      jj_consume_token(INGESTION);
-      jj_consume_token(POLICY);
-      pairId = QualifiedName();
-      ifExists = IfExists();
-        stmt = new FeedPolicyDropStatement(pairId.first, pairId.second, ifExists);
-      break;
-    case CHANNEL:
-      jj_consume_token(CHANNEL);
-      pairId = QualifiedName();
-      ifExists = IfExists();
-        stmt = new ChannelDropStatement(pairId.first, pairId.second, ifExists);
-      break;
-    case BROKER:
-      jj_consume_token(BROKER);
-      pairId = QualifiedName();
-      ifExists = IfExists();
-        stmt = new BrokerDropStatement(pairId.first, pairId.second, ifExists);
-      break;
-    default:
-      jj_la1[75] = jj_gen;
-      jj_consume_token(-1);
-      throw new ParseException();
-    }
-  {if (true) return stmt;}
-    throw new Error("Missing return statement in function");
-  }
-
-  final public Expression ParenthesizedExpression() throws ParseException, ParseException {
-  Expression expr;
-    jj_consume_token(LEFTPAREN);
-    expr = Expression();
-    jj_consume_token(RIGHTPAREN);
-      {if (true) return expr;}
-    throw new Error("Missing return statement in function");
-  }
-
-// Merged Non-terminal
-  final public Statement CreateStatement() throws ParseException, ParseException {
-  String hint = null;
-  boolean dgen = false;
-  Statement stmt = null;
-    jj_consume_token(CREATE);
-    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
-    case TYPE:
-      hint = getHint(token);
-      if (hint != null && hint.startsWith(DGEN_HINT)) {
-        dgen = true;
-      }
-      stmt = TypeSpecification(hint, dgen);
-      break;
-    case NODEGROUP:
-      stmt = NodegroupSpecification();
-      break;
-    case DATASET:
-    case EXTERNAL:
-    case INTERNAL:
-    case TEMPORARY:
-      stmt = DatasetSpecification();
-      break;
-    case INDEX:
-      stmt = IndexSpecification();
-      break;
-    case DATAVERSE:
-      stmt = DataverseSpecification();
-      break;
-    case FUNCTION:
-      stmt = FunctionSpecification();
-      break;
-    case FEED:
-    case PRIMARY:
-    case SECONDARY:
-      stmt = FeedSpecification();
-      break;
-    case INGESTION:
-      stmt = FeedPolicySpecification();
-      break;
-    case 8:
-      stmt = ChannelSpecification();
-      break;
-    case BROKER:
-      stmt = BrokerSpecification();
-      break;
-    default:
-      jj_la1[76] = jj_gen;
-      jj_consume_token(-1);
-      throw new ParseException();
-    }
-  {if (true) return stmt;}
-    throw new Error("Missing return statement in function");
-  }
-
-  final public QuantifiedExpression QuantifiedExpression() throws ParseException, ParseException {
-  QuantifiedExpression qc = new QuantifiedExpression();
-  List<QuantifiedPair> quantifiedList = new ArrayList<QuantifiedPair>();
-  Expression satisfiesExpr;
-  VariableExpr var;
-  Expression inExpr;
-  QuantifiedPair pair;
-    createNewScope();
-    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
-    case SOME:
-      jj_consume_token(SOME);
-                      qc.setQuantifier(QuantifiedExpression.Quantifier.SOME);
-      break;
-    case EVERY:
-      jj_consume_token(EVERY);
-                      qc.setQuantifier(QuantifiedExpression.Quantifier.EVERY);
-      break;
-    default:
-      jj_la1[77] = jj_gen;
-      jj_consume_token(-1);
-      throw new ParseException();
-    }
-    var = Variable();
-    jj_consume_token(IN);
-    inExpr = Expression();
-      pair = new QuantifiedPair(var, inExpr);
-      getCurrentScope().addNewVarSymbolToScope(var.getVar());
-      quantifiedList.add(pair);
-    label_20:
-    while (true) {
-      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
-      case COMMA:
-        ;
-        break;
-      default:
-        jj_la1[78] = jj_gen;
-        break label_20;
-      }
-      jj_consume_token(COMMA);
-      var = Variable();
-      jj_consume_token(IN);
-      inExpr = Expression();
-      pair = new QuantifiedPair(var, inExpr);
-      getCurrentScope().addNewVarSymbolToScope(var.getVar());
-      quantifiedList.add(pair);
-    }
-    jj_consume_token(SATISFIES);
-    satisfiesExpr = Expression();
-       qc.setSatisfiesExpr(satisfiesExpr);
-       qc.setQuantifiedList(quantifiedList);
-       removeCurrentScope();
-       {if (true) return qc;}
-    throw new Error("Missing return statement in function");
-  }
-
-  final public String AdapterName() throws ParseException, ParseException {
-  String adapterName = null;
-    adapterName = Identifier();
-      {if (true) return adapterName;}
-    throw new Error("Missing return statement in function");
-  }
-
-  final public DataverseDecl DataverseDeclaration() throws ParseException, ParseException {
-  String dvName = null;
-    jj_consume_token(USE);
-    jj_consume_token(DATAVERSE);
-    dvName = Identifier();
-      defaultDataverse = dvName;
-      {if (true) return new DataverseDecl(new Identifier(dvName));}
-    throw new Error("Missing return statement in function");
-  }
-
-  final public CreateFeedStatement FeedSpecification() throws ParseException, ParseException {
-  Pair<Identifier,Identifier> nameComponents = null;
-  boolean ifNotExists = false;
-  String adapterName = null;
-  Map<String,String> properties = null;
-  FunctionSignature appliedFunction = null;
-  CreateFeedStatement cfs = null;
-  Pair<Identifier,Identifier> sourceNameComponents = null;
-    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
-    case SECONDARY:
-      jj_consume_token(SECONDARY);
-      jj_consume_token(FEED);
-      nameComponents = QualifiedName();
-      ifNotExists = IfNotExists();
-      jj_consume_token(FROM);
-      jj_consume_token(FEED);
-      sourceNameComponents = QualifiedName();
-      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
-      case APPLY:
-        appliedFunction = ApplyFunction();
-        break;
-      default:
-        jj_la1[79] = jj_gen;
-        ;
-      }
-      cfs = new CreateSecondaryFeedStatement(nameComponents, sourceNameComponents, appliedFunction, ifNotExists);
-      break;
-    case FEED:
-    case PRIMARY:
-      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
-      case PRIMARY:
-        jj_consume_token(PRIMARY);
-        break;
-      default:
-        jj_la1[80] = jj_gen;
-        ;
-      }
-      jj_consume_token(FEED);
-      nameComponents = QualifiedName();
-      ifNotExists = IfNotExists();
-      jj_consume_token(USING);
-      adapterName = AdapterName();
-      properties = Configuration();
-      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
-      case APPLY:
-        appliedFunction = ApplyFunction();
-        break;
-      default:
-        jj_la1[81] = jj_gen;
-        ;
-      }
-      cfs = new CreatePrimaryFeedStatement(nameComponents, adapterName, properties, appliedFunction, ifNotExists);
-      break;
-    default:
-      jj_la1[82] = jj_gen;
-      jj_consume_token(-1);
-      throw new ParseException();
-    }
-    {if (true) return cfs;}
-    throw new Error("Missing return statement in function");
-  }
-
-  final public FunctionSignature FunctionSignature() throws ParseException, ParseException {
-  FunctionName fctName = null;
-  int arity = 0;
-    fctName

<TRUNCATED>