asterixdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sjaco...@apache.org
Subject [2/7] asterixdb git commit: Change the compilation related Exception
Date Mon, 16 Jan 2017 18:46:46 GMT
http://git-wip-us.apache.org/repos/asf/asterixdb/blob/e65e6ca4/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/util/SqlppAstPrintUtil.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/util/SqlppAstPrintUtil.java b/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/util/SqlppAstPrintUtil.java
index 0d840cd..ef8c4f5 100644
--- a/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/util/SqlppAstPrintUtil.java
+++ b/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/util/SqlppAstPrintUtil.java
@@ -23,7 +23,7 @@ import java.io.PrintWriter;
 import java.util.ArrayList;
 import java.util.List;
 
-import org.apache.asterix.common.exceptions.AsterixException;
+import org.apache.asterix.common.exceptions.CompilationException;
 import org.apache.asterix.lang.common.base.IAstPrintVisitorFactory;
 import org.apache.asterix.lang.common.base.ILangExpression;
 import org.apache.asterix.lang.common.base.Statement;
@@ -45,9 +45,9 @@ public class SqlppAstPrintUtil {
      *            the language expression.
      * @param output
      *            a writer for printing strings.
-     * @throws AsterixException
+     * @throws CompilationException
      */
-    public static void print(ILangExpression expr, PrintWriter output) throws AsterixException {
+    public static void print(ILangExpression expr, PrintWriter output) throws CompilationException {
         QueryPrintVisitor visitor = astPrintVisitorFactory.createLangVisitor(output);
         expr.accept(visitor, 0);
         output.flush();
@@ -60,9 +60,9 @@ public class SqlppAstPrintUtil {
      *            a list of statements of a query
      * @param output
      *            a writer for printing strings.
-     * @throws AsterixException
+     * @throws CompilationException
      */
-    public static void print(List<Statement> statements, PrintWriter output) throws AsterixException {
+    public static void print(List<Statement> statements, PrintWriter output) throws CompilationException {
         QueryPrintVisitor visitor = astPrintVisitorFactory.createLangVisitor(output);
         for (Statement statement : statements) {
             statement.accept(visitor, 0);
@@ -74,9 +74,9 @@ public class SqlppAstPrintUtil {
      * @param expr
      *            a language expression.
      * @return the AST of a language expression.
-     * @throws AsterixException
+     * @throws CompilationException
      */
-    public static String toString(ILangExpression expr) throws AsterixException {
+    public static String toString(ILangExpression expr) throws CompilationException {
         List<ILangExpression> exprs = new ArrayList<>();
         exprs.add(expr);
         return toString(exprs);
@@ -86,9 +86,9 @@ public class SqlppAstPrintUtil {
      * @param exprs
      *            a list of language expression.
      * @return an AST of the input language expressions.
-     * @throws AsterixException
+     * @throws CompilationException
      */
-    public static String toString(List<ILangExpression> exprs) throws AsterixException {
+    public static String toString(List<ILangExpression> exprs) throws CompilationException {
         ByteArrayOutputStream bos = new ByteArrayOutputStream();
         PrintWriter output = new PrintWriter(bos);
         QueryPrintVisitor visitor = astPrintVisitorFactory.createLangVisitor(output);

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/e65e6ca4/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/util/SqlppFormatPrintUtil.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/util/SqlppFormatPrintUtil.java b/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/util/SqlppFormatPrintUtil.java
index 2c8f582..6cfaeef 100644
--- a/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/util/SqlppFormatPrintUtil.java
+++ b/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/util/SqlppFormatPrintUtil.java
@@ -23,7 +23,7 @@ import java.io.PrintWriter;
 import java.util.ArrayList;
 import java.util.List;
 
-import org.apache.asterix.common.exceptions.AsterixException;
+import org.apache.asterix.common.exceptions.CompilationException;
 import org.apache.asterix.lang.common.base.ILangExpression;
 import org.apache.asterix.lang.common.base.Statement;
 import org.apache.asterix.lang.sqlpp.visitor.SqlppFormatPrintVisitor;
@@ -41,9 +41,9 @@ public class SqlppFormatPrintUtil {
      *            the language expression.
      * @param output
      *            a writer for printing strings.
-     * @throws AsterixException
+     * @throws CompilationException
      */
-    public static void print(ILangExpression expr, PrintWriter output) throws AsterixException {
+    public static void print(ILangExpression expr, PrintWriter output) throws CompilationException {
         SqlppFormatPrintVisitor visitor = new SqlppFormatPrintVisitor(output);
         expr.accept(visitor, 0);
     }
@@ -55,9 +55,9 @@ public class SqlppFormatPrintUtil {
      *            a list of statements of a query
      * @param output
      *            a writer for printing strings.
-     * @throws AsterixException
+     * @throws CompilationException
      */
-    public static void print(List<Statement> statements, PrintWriter output) throws AsterixException {
+    public static void print(List<Statement> statements, PrintWriter output) throws CompilationException {
         SqlppFormatPrintVisitor visitor = new SqlppFormatPrintVisitor(output);
         for (Statement statement : statements) {
             statement.accept(visitor, 0);
@@ -68,9 +68,9 @@ public class SqlppFormatPrintUtil {
      * @param expr
      *            a language expression.
      * @return a formatted string of a language expression.
-     * @throws AsterixException
+     * @throws CompilationException
      */
-    public static String toString(ILangExpression expr) throws AsterixException {
+    public static String toString(ILangExpression expr) throws CompilationException {
         List<ILangExpression> exprs = new ArrayList<>();
         exprs.add(expr);
         return toString(exprs);
@@ -80,9 +80,9 @@ public class SqlppFormatPrintUtil {
      * @param exprs
      *            a list of language expression.
      * @return a formatted string of the input language expressions.
-     * @throws AsterixException
+     * @throws CompilationException
      */
-    public static String toString(List<ILangExpression> exprs) throws AsterixException {
+    public static String toString(List<ILangExpression> exprs) throws CompilationException {
         ByteArrayOutputStream bos = new ByteArrayOutputStream();
         PrintWriter output = new PrintWriter(bos);
         SqlppFormatPrintVisitor visitor = new SqlppFormatPrintVisitor(output);

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/e65e6ca4/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/util/SqlppRewriteUtil.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/util/SqlppRewriteUtil.java b/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/util/SqlppRewriteUtil.java
index 519963a..a066110 100644
--- a/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/util/SqlppRewriteUtil.java
+++ b/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/util/SqlppRewriteUtil.java
@@ -23,7 +23,7 @@ import java.util.HashSet;
 import java.util.Map;
 import java.util.Set;
 
-import org.apache.asterix.common.exceptions.AsterixException;
+import org.apache.asterix.common.exceptions.CompilationException;
 import org.apache.asterix.lang.common.base.Expression;
 import org.apache.asterix.lang.common.base.ILangExpression;
 import org.apache.asterix.lang.common.expression.VariableExpr;
@@ -43,19 +43,19 @@ public class SqlppRewriteUtil {
     // Applying sugar rewriting for group-by.
     public static Expression rewriteExpressionUsingGroupVariable(VariableExpr groupVar,
             Collection<VariableExpr> fieldVars, ILangExpression expr,
-            LangRewritingContext context) throws AsterixException {
+            LangRewritingContext context) throws CompilationException {
         SqlppGroupBySugarVisitor visitor = new SqlppGroupBySugarVisitor(context, groupVar, fieldVars);
         return expr.accept(visitor, null);
     }
 
-    public static Set<VariableExpr> getFreeVariable(Expression expr) throws AsterixException {
+    public static Set<VariableExpr> getFreeVariable(Expression expr) throws CompilationException {
         Set<VariableExpr> vars = new HashSet<>();
         FreeVariableVisitor visitor = new FreeVariableVisitor();
         expr.accept(visitor, vars);
         return vars;
     }
 
-    public static ILangExpression deepCopy(ILangExpression expr) throws AsterixException {
+    public static ILangExpression deepCopy(ILangExpression expr) throws CompilationException {
         if (expr == null) {
             return expr;
         }
@@ -64,7 +64,7 @@ public class SqlppRewriteUtil {
     }
 
     // Checks if an ILangExpression contains a subquery.
-    public static boolean constainsSubquery(ILangExpression expr) throws AsterixException {
+    public static boolean constainsSubquery(ILangExpression expr) throws CompilationException {
         if (expr == null) {
             return false;
         }
@@ -83,10 +83,10 @@ public class SqlppRewriteUtil {
      * @return an expression, where sub-expressions of the input expression (including the input expression itself)
      *         are replaced with deep copies with their mapped replacements in the exprMap if there exists such a
      *         replacement expression.
-     * @throws AsterixException
+     * @throws CompilationException
      */
     public static Expression substituteExpression(Expression expression, Map<Expression, Expression> exprMap,
-            LangRewritingContext context) throws AsterixException {
+            LangRewritingContext context) throws CompilationException {
         if (exprMap.isEmpty()) {
             return expression;
         }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/e65e6ca4/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/util/SqlppVariableUtil.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/util/SqlppVariableUtil.java b/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/util/SqlppVariableUtil.java
index 5352804..2d6ac53 100644
--- a/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/util/SqlppVariableUtil.java
+++ b/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/util/SqlppVariableUtil.java
@@ -26,7 +26,7 @@ import java.util.Iterator;
 import java.util.List;
 import java.util.Set;
 
-import org.apache.asterix.common.exceptions.AsterixException;
+import org.apache.asterix.common.exceptions.CompilationException;
 import org.apache.asterix.lang.common.base.ILangExpression;
 import org.apache.asterix.lang.common.clause.GroupbyClause;
 import org.apache.asterix.lang.common.clause.LetClause;
@@ -101,7 +101,7 @@ public class SqlppVariableUtil {
         return new VarIdentifier(USER_VAR_PREFIX + idName);
     }
 
-    public static Collection<VariableExpr> getFreeVariables(ILangExpression langExpr) throws AsterixException {
+    public static Collection<VariableExpr> getFreeVariables(ILangExpression langExpr) throws CompilationException {
         Collection<VariableExpr> freeVars = new HashSet<>();
         FreeVariableVisitor visitor = new FreeVariableVisitor();
         langExpr.accept(visitor, freeVars);

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/e65e6ca4/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/visitor/CheckDatasetOnlyResolutionVisitor.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/visitor/CheckDatasetOnlyResolutionVisitor.java b/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/visitor/CheckDatasetOnlyResolutionVisitor.java
index 05b1018..cab7b5b 100644
--- a/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/visitor/CheckDatasetOnlyResolutionVisitor.java
+++ b/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/visitor/CheckDatasetOnlyResolutionVisitor.java
@@ -19,7 +19,7 @@
 
 package org.apache.asterix.lang.sqlpp.visitor;
 
-import org.apache.asterix.common.exceptions.AsterixException;
+import org.apache.asterix.common.exceptions.CompilationException;
 import org.apache.asterix.lang.common.base.ILangExpression;
 import org.apache.asterix.lang.common.clause.GroupbyClause;
 import org.apache.asterix.lang.common.clause.LetClause;
@@ -64,57 +64,57 @@ import org.apache.asterix.lang.sqlpp.visitor.base.AbstractSqlppQueryExpressionVi
 public class CheckDatasetOnlyResolutionVisitor extends AbstractSqlppQueryExpressionVisitor<Boolean, ILangExpression> {
 
     @Override
-    public Boolean visit(Query q, ILangExpression expr) throws AsterixException {
+    public Boolean visit(Query q, ILangExpression expr) throws CompilationException {
         return false;
     }
 
     @Override
-    public Boolean visit(FunctionDecl fd, ILangExpression expr) throws AsterixException {
+    public Boolean visit(FunctionDecl fd, ILangExpression expr) throws CompilationException {
         return false;
     }
 
     @Override
-    public Boolean visit(LiteralExpr l, ILangExpression expr) throws AsterixException {
+    public Boolean visit(LiteralExpr l, ILangExpression expr) throws CompilationException {
         return false;
     }
 
     @Override
-    public Boolean visit(VariableExpr v, ILangExpression expr) throws AsterixException {
+    public Boolean visit(VariableExpr v, ILangExpression expr) throws CompilationException {
         return false;
     }
 
     @Override
-    public Boolean visit(ListConstructor lc, ILangExpression expr) throws AsterixException {
+    public Boolean visit(ListConstructor lc, ILangExpression expr) throws CompilationException {
         return false;
     }
 
     @Override
-    public Boolean visit(RecordConstructor rc, ILangExpression expr) throws AsterixException {
+    public Boolean visit(RecordConstructor rc, ILangExpression expr) throws CompilationException {
         return false;
     }
 
     @Override
-    public Boolean visit(OperatorExpr ifbo, ILangExpression expr) throws AsterixException {
+    public Boolean visit(OperatorExpr ifbo, ILangExpression expr) throws CompilationException {
         return false;
     }
 
     @Override
-    public Boolean visit(FieldAccessor fa, ILangExpression expr) throws AsterixException {
+    public Boolean visit(FieldAccessor fa, ILangExpression expr) throws CompilationException {
         return false;
     }
 
     @Override
-    public Boolean visit(IndexAccessor ia, ILangExpression expr) throws AsterixException {
+    public Boolean visit(IndexAccessor ia, ILangExpression expr) throws CompilationException {
         return false;
     }
 
     @Override
-    public Boolean visit(IfExpr ifexpr, ILangExpression expr) throws AsterixException {
+    public Boolean visit(IfExpr ifexpr, ILangExpression expr) throws CompilationException {
         return false;
     }
 
     @Override
-    public Boolean visit(QuantifiedExpression qe, ILangExpression expr) throws AsterixException {
+    public Boolean visit(QuantifiedExpression qe, ILangExpression expr) throws CompilationException {
         for (QuantifiedPair qp : qe.getQuantifiedList()) {
             // If the target reference of undefined variable is a binding expression in a quantified pair,
             // then we only resolve it to dataset.
@@ -126,112 +126,112 @@ public class CheckDatasetOnlyResolutionVisitor extends AbstractSqlppQueryExpress
     }
 
     @Override
-    public Boolean visit(UnaryExpr u, ILangExpression expr) throws AsterixException {
+    public Boolean visit(UnaryExpr u, ILangExpression expr) throws CompilationException {
         return false;
     }
 
     @Override
-    public Boolean visit(CallExpr pf, ILangExpression expr) throws AsterixException {
+    public Boolean visit(CallExpr pf, ILangExpression expr) throws CompilationException {
         return false;
     }
 
     @Override
-    public Boolean visit(LetClause lc, ILangExpression expr) throws AsterixException {
+    public Boolean visit(LetClause lc, ILangExpression expr) throws CompilationException {
         return false;
     }
 
     @Override
-    public Boolean visit(WhereClause wc, ILangExpression expr) throws AsterixException {
+    public Boolean visit(WhereClause wc, ILangExpression expr) throws CompilationException {
         return false;
     }
 
     @Override
-    public Boolean visit(OrderbyClause oc, ILangExpression expr) throws AsterixException {
+    public Boolean visit(OrderbyClause oc, ILangExpression expr) throws CompilationException {
         return false;
     }
 
     @Override
-    public Boolean visit(GroupbyClause gc, ILangExpression expr) throws AsterixException {
+    public Boolean visit(GroupbyClause gc, ILangExpression expr) throws CompilationException {
         return false;
     }
 
     @Override
-    public Boolean visit(LimitClause lc, ILangExpression expr) throws AsterixException {
+    public Boolean visit(LimitClause lc, ILangExpression expr) throws CompilationException {
         return false;
     }
 
     @Override
-    public Boolean visit(FromClause fromClause, ILangExpression expr) throws AsterixException {
+    public Boolean visit(FromClause fromClause, ILangExpression expr) throws CompilationException {
         return false;
     }
 
     @Override
-    public Boolean visit(FromTerm fromTerm, ILangExpression expr) throws AsterixException {
+    public Boolean visit(FromTerm fromTerm, ILangExpression expr) throws CompilationException {
         return expr == fromTerm.getLeftExpression();
     }
 
     @Override
-    public Boolean visit(JoinClause joinClause, ILangExpression expr) throws AsterixException {
+    public Boolean visit(JoinClause joinClause, ILangExpression expr) throws CompilationException {
         return expr == joinClause.getRightExpression();
     }
 
     @Override
-    public Boolean visit(NestClause nestClause, ILangExpression expr) throws AsterixException {
+    public Boolean visit(NestClause nestClause, ILangExpression expr) throws CompilationException {
         return expr == nestClause.getRightExpression();
     }
 
     @Override
-    public Boolean visit(Projection projection, ILangExpression expr) throws AsterixException {
+    public Boolean visit(Projection projection, ILangExpression expr) throws CompilationException {
         return false;
     }
 
     @Override
-    public Boolean visit(SelectBlock selectBlock, ILangExpression expr) throws AsterixException {
+    public Boolean visit(SelectBlock selectBlock, ILangExpression expr) throws CompilationException {
         return false;
     }
 
     @Override
-    public Boolean visit(SelectClause selectClause, ILangExpression expr) throws AsterixException {
+    public Boolean visit(SelectClause selectClause, ILangExpression expr) throws CompilationException {
         return false;
     }
 
     @Override
-    public Boolean visit(SelectElement selectElement, ILangExpression expr) throws AsterixException {
+    public Boolean visit(SelectElement selectElement, ILangExpression expr) throws CompilationException {
         return false;
     }
 
     @Override
-    public Boolean visit(SelectRegular selectRegular, ILangExpression expr) throws AsterixException {
+    public Boolean visit(SelectRegular selectRegular, ILangExpression expr) throws CompilationException {
         return false;
     }
 
     @Override
-    public Boolean visit(SelectSetOperation selectSetOperation, ILangExpression expr) throws AsterixException {
+    public Boolean visit(SelectSetOperation selectSetOperation, ILangExpression expr) throws CompilationException {
         return false;
     }
 
     @Override
-    public Boolean visit(SelectExpression selectStatement, ILangExpression expr) throws AsterixException {
+    public Boolean visit(SelectExpression selectStatement, ILangExpression expr) throws CompilationException {
         return false;
     }
 
     @Override
-    public Boolean visit(UnnestClause unnestClause, ILangExpression expr) throws AsterixException {
+    public Boolean visit(UnnestClause unnestClause, ILangExpression expr) throws CompilationException {
         return expr == unnestClause.getRightExpression();
     }
 
     @Override
-    public Boolean visit(HavingClause havingClause, ILangExpression expr) throws AsterixException {
+    public Boolean visit(HavingClause havingClause, ILangExpression expr) throws CompilationException {
         return false;
     }
 
     @Override
-    public Boolean visit(IndependentSubquery independentSubquery, ILangExpression arg) throws AsterixException {
+    public Boolean visit(IndependentSubquery independentSubquery, ILangExpression arg) throws CompilationException {
         return false;
     }
 
     @Override
-    public Boolean visit(CaseExpression caseExpr, ILangExpression arg) throws AsterixException {
+    public Boolean visit(CaseExpression caseExpr, ILangExpression arg) throws CompilationException {
         return false;
     }
 }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/e65e6ca4/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/visitor/CheckSql92AggregateVisitor.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/visitor/CheckSql92AggregateVisitor.java b/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/visitor/CheckSql92AggregateVisitor.java
index ca25775..1fd110c 100644
--- a/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/visitor/CheckSql92AggregateVisitor.java
+++ b/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/visitor/CheckSql92AggregateVisitor.java
@@ -20,7 +20,7 @@ package org.apache.asterix.lang.sqlpp.visitor;
 
 import java.util.List;
 
-import org.apache.asterix.common.exceptions.AsterixException;
+import org.apache.asterix.common.exceptions.CompilationException;
 import org.apache.asterix.common.functions.FunctionSignature;
 import org.apache.asterix.lang.common.base.Expression;
 import org.apache.asterix.lang.common.base.ILangExpression;
@@ -67,32 +67,32 @@ import org.apache.asterix.lang.sqlpp.visitor.base.AbstractSqlppQueryExpressionVi
 public class CheckSql92AggregateVisitor extends AbstractSqlppQueryExpressionVisitor<Boolean, ILangExpression> {
 
     @Override
-    public Boolean visit(Query q, ILangExpression parentSelectBlock) throws AsterixException {
+    public Boolean visit(Query q, ILangExpression parentSelectBlock) throws CompilationException {
         return false;
     }
 
     @Override
-    public Boolean visit(FunctionDecl fd, ILangExpression parentSelectBlock) throws AsterixException {
+    public Boolean visit(FunctionDecl fd, ILangExpression parentSelectBlock) throws CompilationException {
         return false;
     }
 
     @Override
-    public Boolean visit(LiteralExpr l, ILangExpression parentSelectBlock) throws AsterixException {
+    public Boolean visit(LiteralExpr l, ILangExpression parentSelectBlock) throws CompilationException {
         return false;
     }
 
     @Override
-    public Boolean visit(VariableExpr v, ILangExpression parentSelectBlock) throws AsterixException {
+    public Boolean visit(VariableExpr v, ILangExpression parentSelectBlock) throws CompilationException {
         return false;
     }
 
     @Override
-    public Boolean visit(ListConstructor lc, ILangExpression parentSelectBlock) throws AsterixException {
+    public Boolean visit(ListConstructor lc, ILangExpression parentSelectBlock) throws CompilationException {
         return visitExprList(lc.getExprList(), parentSelectBlock);
     }
 
     @Override
-    public Boolean visit(RecordConstructor rc, ILangExpression parentSelectBlock) throws AsterixException {
+    public Boolean visit(RecordConstructor rc, ILangExpression parentSelectBlock) throws CompilationException {
         for (FieldBinding fieldBinding : rc.getFbList()) {
             ILangExpression leftExpr = fieldBinding.getLeftExpr();
             ILangExpression rightExpr = fieldBinding.getRightExpr();
@@ -107,22 +107,22 @@ public class CheckSql92AggregateVisitor extends AbstractSqlppQueryExpressionVisi
     }
 
     @Override
-    public Boolean visit(OperatorExpr ifbo, ILangExpression parentSelectBlock) throws AsterixException {
+    public Boolean visit(OperatorExpr ifbo, ILangExpression parentSelectBlock) throws CompilationException {
         return visitExprList(ifbo.getExprList(), parentSelectBlock);
     }
 
     @Override
-    public Boolean visit(FieldAccessor fa, ILangExpression parentSelectBlock) throws AsterixException {
+    public Boolean visit(FieldAccessor fa, ILangExpression parentSelectBlock) throws CompilationException {
         return fa.getExpr().accept(this, parentSelectBlock);
     }
 
     @Override
-    public Boolean visit(IndexAccessor ia, ILangExpression parentSelectBlock) throws AsterixException {
+    public Boolean visit(IndexAccessor ia, ILangExpression parentSelectBlock) throws CompilationException {
         return ia.getExpr().accept(this, parentSelectBlock);
     }
 
     @Override
-    public Boolean visit(IfExpr ifexpr, ILangExpression parentSelectBlock) throws AsterixException {
+    public Boolean visit(IfExpr ifexpr, ILangExpression parentSelectBlock) throws CompilationException {
         if (ifexpr.getCondExpr().accept(this, parentSelectBlock)) {
             return true;
         } else {
@@ -132,17 +132,17 @@ public class CheckSql92AggregateVisitor extends AbstractSqlppQueryExpressionVisi
     }
 
     @Override
-    public Boolean visit(QuantifiedExpression qe, ILangExpression parentSelectBlock) throws AsterixException {
+    public Boolean visit(QuantifiedExpression qe, ILangExpression parentSelectBlock) throws CompilationException {
         return false;
     }
 
     @Override
-    public Boolean visit(UnaryExpr u, ILangExpression parentSelectBlock) throws AsterixException {
+    public Boolean visit(UnaryExpr u, ILangExpression parentSelectBlock) throws CompilationException {
         return u.getExpr().accept(this, parentSelectBlock);
     }
 
     @Override
-    public Boolean visit(CallExpr pf, ILangExpression parentSelectBlock) throws AsterixException {
+    public Boolean visit(CallExpr pf, ILangExpression parentSelectBlock) throws CompilationException {
         FunctionSignature fs = pf.getFunctionSignature();
         if (FunctionMapUtil.isSql92AggregateFunction(fs)) {
             return true;
@@ -156,52 +156,52 @@ public class CheckSql92AggregateVisitor extends AbstractSqlppQueryExpressionVisi
     }
 
     @Override
-    public Boolean visit(LetClause lc, ILangExpression parentSelectBlock) throws AsterixException {
+    public Boolean visit(LetClause lc, ILangExpression parentSelectBlock) throws CompilationException {
         return false;
     }
 
     @Override
-    public Boolean visit(WhereClause wc, ILangExpression parentSelectBlock) throws AsterixException {
+    public Boolean visit(WhereClause wc, ILangExpression parentSelectBlock) throws CompilationException {
         return false;
     }
 
     @Override
-    public Boolean visit(OrderbyClause oc, ILangExpression parentSelectBlock) throws AsterixException {
+    public Boolean visit(OrderbyClause oc, ILangExpression parentSelectBlock) throws CompilationException {
         return false;
     }
 
     @Override
-    public Boolean visit(GroupbyClause gc, ILangExpression parentSelectBlock) throws AsterixException {
+    public Boolean visit(GroupbyClause gc, ILangExpression parentSelectBlock) throws CompilationException {
         return false;
     }
 
     @Override
-    public Boolean visit(LimitClause lc, ILangExpression parentSelectBlock) throws AsterixException {
+    public Boolean visit(LimitClause lc, ILangExpression parentSelectBlock) throws CompilationException {
         return false;
     }
 
     @Override
-    public Boolean visit(FromClause fromClause, ILangExpression parentSelectBlock) throws AsterixException {
+    public Boolean visit(FromClause fromClause, ILangExpression parentSelectBlock) throws CompilationException {
         return false;
     }
 
     @Override
-    public Boolean visit(FromTerm fromTerm, ILangExpression parentSelectBlock) throws AsterixException {
+    public Boolean visit(FromTerm fromTerm, ILangExpression parentSelectBlock) throws CompilationException {
         return false;
     }
 
     @Override
-    public Boolean visit(JoinClause joinClause, ILangExpression parentSelectBlock) throws AsterixException {
+    public Boolean visit(JoinClause joinClause, ILangExpression parentSelectBlock) throws CompilationException {
         return false;
     }
 
     @Override
-    public Boolean visit(NestClause nestClause, ILangExpression parentSelectBlock) throws AsterixException {
+    public Boolean visit(NestClause nestClause, ILangExpression parentSelectBlock) throws CompilationException {
         return false;
     }
 
     @Override
-    public Boolean visit(Projection projection, ILangExpression parentSelectBlock) throws AsterixException {
+    public Boolean visit(Projection projection, ILangExpression parentSelectBlock) throws CompilationException {
         if (projection.star()) {
             return false;
         }
@@ -209,12 +209,12 @@ public class CheckSql92AggregateVisitor extends AbstractSqlppQueryExpressionVisi
     }
 
     @Override
-    public Boolean visit(SelectBlock selectBlock, ILangExpression parentSelectBlock) throws AsterixException {
+    public Boolean visit(SelectBlock selectBlock, ILangExpression parentSelectBlock) throws CompilationException {
         return selectBlock.getSelectClause().accept(this, selectBlock);
     }
 
     @Override
-    public Boolean visit(SelectClause selectClause, ILangExpression parentSelectBlock) throws AsterixException {
+    public Boolean visit(SelectClause selectClause, ILangExpression parentSelectBlock) throws CompilationException {
         if (selectClause.selectElement()) {
             return selectClause.getSelectElement().accept(this, parentSelectBlock);
         } else {
@@ -223,12 +223,12 @@ public class CheckSql92AggregateVisitor extends AbstractSqlppQueryExpressionVisi
     }
 
     @Override
-    public Boolean visit(SelectElement selectElement, ILangExpression parentSelectBlock) throws AsterixException {
+    public Boolean visit(SelectElement selectElement, ILangExpression parentSelectBlock) throws CompilationException {
         return selectElement.getExpression().accept(this, parentSelectBlock);
     }
 
     @Override
-    public Boolean visit(SelectRegular selectRegular, ILangExpression parentSelectBlock) throws AsterixException {
+    public Boolean visit(SelectRegular selectRegular, ILangExpression parentSelectBlock) throws CompilationException {
         for (Projection projection : selectRegular.getProjections()) {
             if (projection.accept(this, parentSelectBlock)) {
                 return true;
@@ -239,26 +239,28 @@ public class CheckSql92AggregateVisitor extends AbstractSqlppQueryExpressionVisi
 
     @Override
     public Boolean visit(SelectSetOperation selectSetOperation, ILangExpression parentSelectBlock)
-            throws AsterixException {
+            throws CompilationException {
         return false;
     }
 
     @Override
-    public Boolean visit(SelectExpression selectStatement, ILangExpression parentSelectBlock) throws AsterixException {
+    public Boolean visit(SelectExpression selectStatement, ILangExpression parentSelectBlock)
+            throws CompilationException {
         return false;
     }
 
     @Override
-    public Boolean visit(UnnestClause unnestClause, ILangExpression parentSelectBlock) throws AsterixException {
+    public Boolean visit(UnnestClause unnestClause, ILangExpression parentSelectBlock) throws CompilationException {
         return false;
     }
 
     @Override
-    public Boolean visit(HavingClause havingClause, ILangExpression parentSelectBlock) throws AsterixException {
+    public Boolean visit(HavingClause havingClause, ILangExpression parentSelectBlock) throws CompilationException {
         return false;
     }
 
-    private Boolean visitExprList(List<Expression> exprs, ILangExpression parentSelectBlock) throws AsterixException {
+    private Boolean visitExprList(List<Expression> exprs, ILangExpression parentSelectBlock)
+            throws CompilationException {
         for (Expression item : exprs) {
             if (item.accept(this, parentSelectBlock)) {
                 return true;
@@ -268,12 +270,12 @@ public class CheckSql92AggregateVisitor extends AbstractSqlppQueryExpressionVisi
     }
 
     @Override
-    public Boolean visit(IndependentSubquery independentSubquery, ILangExpression arg) throws AsterixException {
+    public Boolean visit(IndependentSubquery independentSubquery, ILangExpression arg) throws CompilationException {
         return false;
     }
 
     @Override
-    public Boolean visit(CaseExpression caseExpr, ILangExpression arg) throws AsterixException {
+    public Boolean visit(CaseExpression caseExpr, ILangExpression arg) throws CompilationException {
         return caseExpr.getConditionExpr().accept(this, arg) || visitExprList(caseExpr.getWhenExprs(), arg)
                 || visitExprList(caseExpr.getThenExprs(), arg) || caseExpr.getElseExpr().accept(this, arg);
     }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/e65e6ca4/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/visitor/CheckSubqueryVisitor.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/visitor/CheckSubqueryVisitor.java b/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/visitor/CheckSubqueryVisitor.java
index e772df5..7f93b2f 100644
--- a/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/visitor/CheckSubqueryVisitor.java
+++ b/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/visitor/CheckSubqueryVisitor.java
@@ -21,7 +21,7 @@ package org.apache.asterix.lang.sqlpp.visitor;
 
 import java.util.List;
 
-import org.apache.asterix.common.exceptions.AsterixException;
+import org.apache.asterix.common.exceptions.CompilationException;
 import org.apache.asterix.lang.common.base.Expression;
 import org.apache.asterix.lang.common.base.ILangExpression;
 import org.apache.asterix.lang.common.clause.GroupbyClause;
@@ -72,7 +72,7 @@ import org.apache.hyracks.algebricks.common.utils.Pair;
 public class CheckSubqueryVisitor extends AbstractSqlppQueryExpressionVisitor<Boolean, ILangExpression> {
 
     @Override
-    public Boolean visit(FromClause fromClause, ILangExpression arg) throws AsterixException {
+    public Boolean visit(FromClause fromClause, ILangExpression arg) throws CompilationException {
         for (FromTerm fromTerm : fromClause.getFromTerms()) {
             if (fromTerm.accept(this, arg)) {
                 return false;
@@ -82,7 +82,7 @@ public class CheckSubqueryVisitor extends AbstractSqlppQueryExpressionVisitor<Bo
     }
 
     @Override
-    public Boolean visit(FromTerm fromTerm, ILangExpression arg) throws AsterixException {
+    public Boolean visit(FromTerm fromTerm, ILangExpression arg) throws CompilationException {
         if (visit(fromTerm.getLeftExpression(), arg)) {
             return true;
         }
@@ -95,17 +95,17 @@ public class CheckSubqueryVisitor extends AbstractSqlppQueryExpressionVisitor<Bo
     }
 
     @Override
-    public Boolean visit(JoinClause joinClause, ILangExpression arg) throws AsterixException {
+    public Boolean visit(JoinClause joinClause, ILangExpression arg) throws CompilationException {
         return visit(joinClause.getRightExpression(), arg) || visit(joinClause.getConditionExpression(), arg);
     }
 
     @Override
-    public Boolean visit(NestClause nestClause, ILangExpression arg) throws AsterixException {
+    public Boolean visit(NestClause nestClause, ILangExpression arg) throws CompilationException {
         return nestClause.accept(this, arg);
     }
 
     @Override
-    public Boolean visit(Projection projection, ILangExpression arg) throws AsterixException {
+    public Boolean visit(Projection projection, ILangExpression arg) throws CompilationException {
         if (projection.star()) {
             return false;
         }
@@ -113,7 +113,7 @@ public class CheckSubqueryVisitor extends AbstractSqlppQueryExpressionVisitor<Bo
     }
 
     @Override
-    public Boolean visit(SelectBlock selectBlock, ILangExpression arg) throws AsterixException {
+    public Boolean visit(SelectBlock selectBlock, ILangExpression arg) throws CompilationException {
         boolean hasSubquery = visit(selectBlock.getFromClause(), arg) || visit(selectBlock.getGroupbyClause(), arg)
                 || visit(selectBlock.getHavingClause(), arg) || visit(selectBlock.getWhereClause(), arg);
         return hasSubquery || visit(selectBlock.getSelectClause(), arg) || visit(selectBlock.getLetList(), arg)
@@ -121,22 +121,22 @@ public class CheckSubqueryVisitor extends AbstractSqlppQueryExpressionVisitor<Bo
     }
 
     @Override
-    public Boolean visit(SelectClause selectClause, ILangExpression arg) throws AsterixException {
+    public Boolean visit(SelectClause selectClause, ILangExpression arg) throws CompilationException {
         return visit(selectClause.getSelectElement(), arg) || visit(selectClause.getSelectRegular(), arg);
     }
 
     @Override
-    public Boolean visit(SelectElement selectElement, ILangExpression arg) throws AsterixException {
+    public Boolean visit(SelectElement selectElement, ILangExpression arg) throws CompilationException {
         return visit(selectElement.getExpression(), arg);
     }
 
     @Override
-    public Boolean visit(SelectRegular selectRegular, ILangExpression arg) throws AsterixException {
+    public Boolean visit(SelectRegular selectRegular, ILangExpression arg) throws CompilationException {
         return visit(selectRegular.getProjections(), arg);
     }
 
     @Override
-    public Boolean visit(SelectSetOperation selectSetOperation, ILangExpression arg) throws AsterixException {
+    public Boolean visit(SelectSetOperation selectSetOperation, ILangExpression arg) throws CompilationException {
         if (selectSetOperation.getLeftInput().accept(this, arg)) {
             return true;
         }
@@ -149,7 +149,7 @@ public class CheckSubqueryVisitor extends AbstractSqlppQueryExpressionVisitor<Bo
     }
 
     @Override
-    public Boolean visit(SelectExpression selectStatement, ILangExpression arg) throws AsterixException {
+    public Boolean visit(SelectExpression selectStatement, ILangExpression arg) throws CompilationException {
         if (selectStatement.isSubquery()) {
             return true;
         }
@@ -159,53 +159,53 @@ public class CheckSubqueryVisitor extends AbstractSqlppQueryExpressionVisitor<Bo
     }
 
     @Override
-    public Boolean visit(UnnestClause unnestClause, ILangExpression arg) throws AsterixException {
+    public Boolean visit(UnnestClause unnestClause, ILangExpression arg) throws CompilationException {
         return visit(unnestClause.getRightExpression(), arg);
     }
 
     @Override
-    public Boolean visit(HavingClause havingClause, ILangExpression arg) throws AsterixException {
+    public Boolean visit(HavingClause havingClause, ILangExpression arg) throws CompilationException {
         return visit(havingClause.getFilterExpression(), arg);
     }
 
     @Override
-    public Boolean visit(IndependentSubquery independentSubquery, ILangExpression arg) throws AsterixException {
+    public Boolean visit(IndependentSubquery independentSubquery, ILangExpression arg) throws CompilationException {
         return visit(independentSubquery.getExpr(), arg);
     }
 
     @Override
-    public Boolean visit(CaseExpression caseExpression, ILangExpression arg) throws AsterixException {
+    public Boolean visit(CaseExpression caseExpression, ILangExpression arg) throws CompilationException {
         return visit(caseExpression.getConditionExpr(), arg) || visit(caseExpression.getWhenExprs(), arg)
                 || visit(caseExpression.getThenExprs(), arg) || visit(caseExpression.getElseExpr(), arg);
     }
 
     @Override
-    public Boolean visit(Query q, ILangExpression arg) throws AsterixException {
+    public Boolean visit(Query q, ILangExpression arg) throws CompilationException {
         return visit(q.getBody(), arg);
     }
 
     @Override
-    public Boolean visit(FunctionDecl fd, ILangExpression arg) throws AsterixException {
+    public Boolean visit(FunctionDecl fd, ILangExpression arg) throws CompilationException {
         return fd.getFuncBody().accept(this, arg);
     }
 
     @Override
-    public Boolean visit(LiteralExpr l, ILangExpression arg) throws AsterixException {
+    public Boolean visit(LiteralExpr l, ILangExpression arg) throws CompilationException {
         return false;
     }
 
     @Override
-    public Boolean visit(VariableExpr v, ILangExpression arg) throws AsterixException {
+    public Boolean visit(VariableExpr v, ILangExpression arg) throws CompilationException {
         return false;
     }
 
     @Override
-    public Boolean visit(ListConstructor lc, ILangExpression arg) throws AsterixException {
+    public Boolean visit(ListConstructor lc, ILangExpression arg) throws CompilationException {
         return visit(lc.getExprList(), arg);
     }
 
     @Override
-    public Boolean visit(RecordConstructor rc, ILangExpression arg) throws AsterixException {
+    public Boolean visit(RecordConstructor rc, ILangExpression arg) throws CompilationException {
         for (FieldBinding fb : rc.getFbList()) {
             if (visit(fb.getLeftExpr(), arg)) {
                 return true;
@@ -218,27 +218,27 @@ public class CheckSubqueryVisitor extends AbstractSqlppQueryExpressionVisitor<Bo
     }
 
     @Override
-    public Boolean visit(OperatorExpr operatorExpr, ILangExpression arg) throws AsterixException {
+    public Boolean visit(OperatorExpr operatorExpr, ILangExpression arg) throws CompilationException {
         return visit(operatorExpr.getExprList(), arg);
     }
 
     @Override
-    public Boolean visit(FieldAccessor fa, ILangExpression arg) throws AsterixException {
+    public Boolean visit(FieldAccessor fa, ILangExpression arg) throws CompilationException {
         return visit(fa.getExpr(), arg);
     }
 
     @Override
-    public Boolean visit(IndexAccessor ia, ILangExpression arg) throws AsterixException {
+    public Boolean visit(IndexAccessor ia, ILangExpression arg) throws CompilationException {
         return visit(ia.getExpr(), arg) || visit(ia.getIndexExpr(), arg);
     }
 
     @Override
-    public Boolean visit(IfExpr ifexpr, ILangExpression arg) throws AsterixException {
+    public Boolean visit(IfExpr ifexpr, ILangExpression arg) throws CompilationException {
         return visit(ifexpr.getCondExpr(), arg) || visit(ifexpr.getThenExpr(), arg) || visit(ifexpr.getElseExpr(), arg);
     }
 
     @Override
-    public Boolean visit(QuantifiedExpression qe, ILangExpression arg) throws AsterixException {
+    public Boolean visit(QuantifiedExpression qe, ILangExpression arg) throws CompilationException {
         for (QuantifiedPair qf : qe.getQuantifiedList()) {
             if (visit(qf.getExpr(), arg)) {
                 return true;
@@ -248,22 +248,22 @@ public class CheckSubqueryVisitor extends AbstractSqlppQueryExpressionVisitor<Bo
     }
 
     @Override
-    public Boolean visit(LetClause lc, ILangExpression arg) throws AsterixException {
+    public Boolean visit(LetClause lc, ILangExpression arg) throws CompilationException {
         return visit(lc.getBindingExpr(), arg);
     }
 
     @Override
-    public Boolean visit(WhereClause wc, ILangExpression arg) throws AsterixException {
+    public Boolean visit(WhereClause wc, ILangExpression arg) throws CompilationException {
         return visit(wc.getWhereExpr(), arg);
     }
 
     @Override
-    public Boolean visit(OrderbyClause oc, ILangExpression arg) throws AsterixException {
+    public Boolean visit(OrderbyClause oc, ILangExpression arg) throws CompilationException {
         return visit(oc.getOrderbyList(), arg);
     }
 
     @Override
-    public Boolean visit(GroupbyClause gc, ILangExpression arg) throws AsterixException {
+    public Boolean visit(GroupbyClause gc, ILangExpression arg) throws CompilationException {
         for (GbyVariableExpressionPair key : gc.getGbyPairList()) {
             if (visit(key.getExpr(), arg)) {
                 return true;
@@ -283,21 +283,21 @@ public class CheckSubqueryVisitor extends AbstractSqlppQueryExpressionVisitor<Bo
     }
 
     @Override
-    public Boolean visit(LimitClause lc, ILangExpression arg) throws AsterixException {
+    public Boolean visit(LimitClause lc, ILangExpression arg) throws CompilationException {
         return visit(lc.getLimitExpr(), arg) || visit(lc.getOffset(), arg);
     }
 
     @Override
-    public Boolean visit(UnaryExpr u, ILangExpression arg) throws AsterixException {
+    public Boolean visit(UnaryExpr u, ILangExpression arg) throws CompilationException {
         return visit(u.getExpr(), arg);
     }
 
     @Override
-    public Boolean visit(CallExpr callExpr, ILangExpression arg) throws AsterixException {
+    public Boolean visit(CallExpr callExpr, ILangExpression arg) throws CompilationException {
         return visit(callExpr.getExprList(), arg);
     }
 
-    private boolean visit(List<?> langExprs, ILangExpression arg) throws AsterixException {
+    private boolean visit(List<?> langExprs, ILangExpression arg) throws CompilationException {
         for (Object o : langExprs) {
             ILangExpression langExpr = (ILangExpression) o;
             if (langExpr.accept(this, arg)) {
@@ -307,7 +307,7 @@ public class CheckSubqueryVisitor extends AbstractSqlppQueryExpressionVisitor<Bo
         return false;
     }
 
-    private boolean visit(ILangExpression langExpr, ILangExpression arg) throws AsterixException {
+    private boolean visit(ILangExpression langExpr, ILangExpression arg) throws CompilationException {
         if (langExpr == null) {
             return false;
         }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/e65e6ca4/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/visitor/DeepCopyVisitor.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/visitor/DeepCopyVisitor.java b/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/visitor/DeepCopyVisitor.java
index f6d3e7f..7c2a174 100644
--- a/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/visitor/DeepCopyVisitor.java
+++ b/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/visitor/DeepCopyVisitor.java
@@ -24,7 +24,7 @@ import java.util.List;
 import java.util.Map;
 import java.util.Map.Entry;
 
-import org.apache.asterix.common.exceptions.AsterixException;
+import org.apache.asterix.common.exceptions.CompilationException;
 import org.apache.asterix.lang.common.base.Expression;
 import org.apache.asterix.lang.common.base.ILangExpression;
 import org.apache.asterix.lang.common.clause.GroupbyClause;
@@ -74,7 +74,7 @@ import org.apache.hyracks.algebricks.common.utils.Pair;
 public class DeepCopyVisitor extends AbstractSqlppQueryExpressionVisitor<ILangExpression, Void> {
 
     @Override
-    public FromClause visit(FromClause fromClause, Void arg) throws AsterixException {
+    public FromClause visit(FromClause fromClause, Void arg) throws CompilationException {
         List<FromTerm> fromTerms = new ArrayList<>();
         for (FromTerm fromTerm : fromClause.getFromTerms()) {
             fromTerms.add((FromTerm) fromTerm.accept(this, arg));
@@ -83,7 +83,7 @@ public class DeepCopyVisitor extends AbstractSqlppQueryExpressionVisitor<ILangEx
     }
 
     @Override
-    public FromTerm visit(FromTerm fromTerm, Void arg) throws AsterixException {
+    public FromTerm visit(FromTerm fromTerm, Void arg) throws CompilationException {
         // Visit the left expression of a from term.
         Expression fromExpr = (Expression) fromTerm.getLeftExpression().accept(this, arg);
         VariableExpr fromVar = (VariableExpr) fromTerm.getLeftVariable().accept(this, arg);
@@ -99,7 +99,7 @@ public class DeepCopyVisitor extends AbstractSqlppQueryExpressionVisitor<ILangEx
     }
 
     @Override
-    public JoinClause visit(JoinClause joinClause, Void arg) throws AsterixException {
+    public JoinClause visit(JoinClause joinClause, Void arg) throws CompilationException {
         Expression rightExpression = (Expression) joinClause.getRightExpression().accept(this, arg);
         VariableExpr rightVar = (VariableExpr) joinClause.getRightVariable().accept(this, arg);
         VariableExpr rightPositionVar = joinClause.getPositionalVariable() == null ? null
@@ -110,7 +110,7 @@ public class DeepCopyVisitor extends AbstractSqlppQueryExpressionVisitor<ILangEx
     }
 
     @Override
-    public NestClause visit(NestClause nestClause, Void arg) throws AsterixException {
+    public NestClause visit(NestClause nestClause, Void arg) throws CompilationException {
         Expression rightExpression = (Expression) nestClause.getRightExpression().accept(this, arg);
         VariableExpr rightVar = (VariableExpr) nestClause.getRightVariable().accept(this, arg);
         VariableExpr rightPositionVar = nestClause.getPositionalVariable() == null ? null
@@ -121,7 +121,7 @@ public class DeepCopyVisitor extends AbstractSqlppQueryExpressionVisitor<ILangEx
     }
 
     @Override
-    public UnnestClause visit(UnnestClause unnestClause, Void arg) throws AsterixException {
+    public UnnestClause visit(UnnestClause unnestClause, Void arg) throws CompilationException {
         Expression rightExpression = (Expression) unnestClause.getRightExpression().accept(this, arg);
         VariableExpr rightVar = (VariableExpr) unnestClause.getRightVariable().accept(this, arg);
         VariableExpr rightPositionVar = unnestClause.getPositionalVariable() == null ? null
@@ -130,14 +130,14 @@ public class DeepCopyVisitor extends AbstractSqlppQueryExpressionVisitor<ILangEx
     }
 
     @Override
-    public Projection visit(Projection projection, Void arg) throws AsterixException {
+    public Projection visit(Projection projection, Void arg) throws CompilationException {
         return new Projection(projection.star() ? null : (Expression) projection.getExpression().accept(this, arg),
                 projection.getName(),
                 projection.star(), projection.exprStar());
     }
 
     @Override
-    public SelectBlock visit(SelectBlock selectBlock, Void arg) throws AsterixException {
+    public SelectBlock visit(SelectBlock selectBlock, Void arg) throws CompilationException {
         FromClause fromClause = null;
         List<LetClause> letClauses = new ArrayList<>();
         WhereClause whereClause = null;
@@ -177,7 +177,7 @@ public class DeepCopyVisitor extends AbstractSqlppQueryExpressionVisitor<ILangEx
     }
 
     @Override
-    public SelectClause visit(SelectClause selectClause, Void arg) throws AsterixException {
+    public SelectClause visit(SelectClause selectClause, Void arg) throws CompilationException {
         SelectElement selectElement = null;
         SelectRegular selectRegular = null;
         if (selectClause.selectElement()) {
@@ -190,12 +190,12 @@ public class DeepCopyVisitor extends AbstractSqlppQueryExpressionVisitor<ILangEx
     }
 
     @Override
-    public SelectElement visit(SelectElement selectElement, Void arg) throws AsterixException {
+    public SelectElement visit(SelectElement selectElement, Void arg) throws CompilationException {
         return new SelectElement((Expression) selectElement.getExpression().accept(this, arg));
     }
 
     @Override
-    public SelectRegular visit(SelectRegular selectRegular, Void arg) throws AsterixException {
+    public SelectRegular visit(SelectRegular selectRegular, Void arg) throws CompilationException {
         List<Projection> projections = new ArrayList<>();
         for (Projection projection : selectRegular.getProjections()) {
             projections.add((Projection) projection.accept(this, arg));
@@ -204,7 +204,7 @@ public class DeepCopyVisitor extends AbstractSqlppQueryExpressionVisitor<ILangEx
     }
 
     @Override
-    public SelectSetOperation visit(SelectSetOperation selectSetOperation, Void arg) throws AsterixException {
+    public SelectSetOperation visit(SelectSetOperation selectSetOperation, Void arg) throws CompilationException {
         SetOperationInput leftInput = selectSetOperation.getLeftInput();
         SetOperationInput newLeftInput;
         if (leftInput.selectBlock()) {
@@ -227,28 +227,28 @@ public class DeepCopyVisitor extends AbstractSqlppQueryExpressionVisitor<ILangEx
     }
 
     @Override
-    public HavingClause visit(HavingClause havingClause, Void arg) throws AsterixException {
+    public HavingClause visit(HavingClause havingClause, Void arg) throws CompilationException {
         return new HavingClause((Expression) havingClause.getFilterExpression().accept(this, arg));
     }
 
     @Override
-    public Query visit(Query q, Void arg) throws AsterixException {
+    public Query visit(Query q, Void arg) throws CompilationException {
         return new Query(q.isExplain(), q.isTopLevel(), (Expression) q.getBody().accept(this, arg), q.getVarCounter(),
                 q.getDataverses(), q.getDatasets());
     }
 
     @Override
-    public FunctionDecl visit(FunctionDecl fd, Void arg) throws AsterixException {
+    public FunctionDecl visit(FunctionDecl fd, Void arg) throws CompilationException {
         return new FunctionDecl(fd.getSignature(), fd.getParamList(), (Expression) fd.getFuncBody().accept(this, arg));
     }
 
     @Override
-    public WhereClause visit(WhereClause whereClause, Void arg) throws AsterixException {
+    public WhereClause visit(WhereClause whereClause, Void arg) throws CompilationException {
         return new WhereClause((Expression) whereClause.getWhereExpr().accept(this, arg));
     }
 
     @Override
-    public OrderbyClause visit(OrderbyClause oc, Void arg) throws AsterixException {
+    public OrderbyClause visit(OrderbyClause oc, Void arg) throws CompilationException {
         List<Expression> newOrderbyList = new ArrayList<>();
         for (Expression orderExpr : oc.getOrderbyList()) {
             newOrderbyList.add((Expression) orderExpr.accept(this, arg));
@@ -257,7 +257,7 @@ public class DeepCopyVisitor extends AbstractSqlppQueryExpressionVisitor<ILangEx
     }
 
     @Override
-    public GroupbyClause visit(GroupbyClause gc, Void arg) throws AsterixException {
+    public GroupbyClause visit(GroupbyClause gc, Void arg) throws CompilationException {
         List<GbyVariableExpressionPair> gbyPairList = new ArrayList<>();
         List<GbyVariableExpressionPair> decorPairList = new ArrayList<>();
         Map<Expression, VariableExpr> withVarMap = new HashMap<>();
@@ -288,20 +288,20 @@ public class DeepCopyVisitor extends AbstractSqlppQueryExpressionVisitor<ILangEx
     }
 
     @Override
-    public LimitClause visit(LimitClause limitClause, Void arg) throws AsterixException {
+    public LimitClause visit(LimitClause limitClause, Void arg) throws CompilationException {
         Expression limitExpr = (Expression) limitClause.getLimitExpr().accept(this, arg);
         Expression offsetExpr = limitClause.hasOffset() ? (Expression) limitClause.getOffset().accept(this, arg) : null;
         return new LimitClause(limitExpr, offsetExpr);
     }
 
     @Override
-    public LetClause visit(LetClause letClause, Void arg) throws AsterixException {
+    public LetClause visit(LetClause letClause, Void arg) throws CompilationException {
         return new LetClause((VariableExpr) letClause.getVarExpr().accept(this, arg),
                 (Expression) letClause.getBindingExpr().accept(this, arg));
     }
 
     @Override
-    public SelectExpression visit(SelectExpression selectExpression, Void arg) throws AsterixException {
+    public SelectExpression visit(SelectExpression selectExpression, Void arg) throws CompilationException {
         List<LetClause> lets = new ArrayList<>();
         SelectSetOperation select;
         OrderbyClause orderby = null;
@@ -334,17 +334,17 @@ public class DeepCopyVisitor extends AbstractSqlppQueryExpressionVisitor<ILangEx
     }
 
     @Override
-    public LiteralExpr visit(LiteralExpr l, Void arg) throws AsterixException {
+    public LiteralExpr visit(LiteralExpr l, Void arg) throws CompilationException {
         return l;
     }
 
     @Override
-    public ListConstructor visit(ListConstructor lc, Void arg) throws AsterixException {
+    public ListConstructor visit(ListConstructor lc, Void arg) throws CompilationException {
         return new ListConstructor(lc.getType(), copyExprList(lc.getExprList(), arg));
     }
 
     @Override
-    public RecordConstructor visit(RecordConstructor rc, Void arg) throws AsterixException {
+    public RecordConstructor visit(RecordConstructor rc, Void arg) throws CompilationException {
         List<FieldBinding> bindings = new ArrayList<>();
         for (FieldBinding binding : rc.getFbList()) {
             FieldBinding fb = new FieldBinding((Expression) binding.getLeftExpr().accept(this, arg),
@@ -355,13 +355,13 @@ public class DeepCopyVisitor extends AbstractSqlppQueryExpressionVisitor<ILangEx
     }
 
     @Override
-    public OperatorExpr visit(OperatorExpr operatorExpr, Void arg) throws AsterixException {
+    public OperatorExpr visit(OperatorExpr operatorExpr, Void arg) throws CompilationException {
         return new OperatorExpr(copyExprList(operatorExpr.getExprList(), arg), operatorExpr.getExprBroadcastIdx(),
                 operatorExpr.getOpList(), operatorExpr.isCurrentop());
     }
 
     @Override
-    public IfExpr visit(IfExpr ifExpr, Void arg) throws AsterixException {
+    public IfExpr visit(IfExpr ifExpr, Void arg) throws CompilationException {
         Expression conditionExpr = (Expression) ifExpr.getCondExpr().accept(this, arg);
         Expression thenExpr = (Expression) ifExpr.getThenExpr().accept(this, arg);
         Expression elseExpr = (Expression) ifExpr.getElseExpr().accept(this, arg);
@@ -369,7 +369,7 @@ public class DeepCopyVisitor extends AbstractSqlppQueryExpressionVisitor<ILangEx
     }
 
     @Override
-    public QuantifiedExpression visit(QuantifiedExpression qe, Void arg) throws AsterixException {
+    public QuantifiedExpression visit(QuantifiedExpression qe, Void arg) throws CompilationException {
         List<QuantifiedPair> quantifiedPairs = new ArrayList<>();
         for (QuantifiedPair pair : qe.getQuantifiedList()) {
             Expression expr = (Expression) pair.getExpr().accept(this, arg);
@@ -381,7 +381,7 @@ public class DeepCopyVisitor extends AbstractSqlppQueryExpressionVisitor<ILangEx
     }
 
     @Override
-    public CallExpr visit(CallExpr callExpr, Void arg) throws AsterixException {
+    public CallExpr visit(CallExpr callExpr, Void arg) throws CompilationException {
         List<Expression> newExprList = new ArrayList<>();
         for (Expression expr : callExpr.getExprList()) {
             newExprList.add((Expression) expr.accept(this, arg));
@@ -390,24 +390,24 @@ public class DeepCopyVisitor extends AbstractSqlppQueryExpressionVisitor<ILangEx
     }
 
     @Override
-    public VariableExpr visit(VariableExpr varExpr, Void arg) throws AsterixException {
+    public VariableExpr visit(VariableExpr varExpr, Void arg) throws CompilationException {
         VariableExpr clonedVar = new VariableExpr(new VarIdentifier(varExpr.getVar()));
         clonedVar.setIsNewVar(varExpr.getIsNewVar());
         return clonedVar;
     }
 
     @Override
-    public UnaryExpr visit(UnaryExpr u, Void arg) throws AsterixException {
+    public UnaryExpr visit(UnaryExpr u, Void arg) throws CompilationException {
         return new UnaryExpr(u.getExprType(), (Expression) u.getExpr().accept(this, arg));
     }
 
     @Override
-    public FieldAccessor visit(FieldAccessor fa, Void arg) throws AsterixException {
+    public FieldAccessor visit(FieldAccessor fa, Void arg) throws CompilationException {
         return new FieldAccessor((Expression) fa.getExpr().accept(this, arg), fa.getIdent());
     }
 
     @Override
-    public Expression visit(IndexAccessor ia, Void arg) throws AsterixException {
+    public Expression visit(IndexAccessor ia, Void arg) throws CompilationException {
         Expression expr = (Expression) ia.getExpr().accept(this, arg);
         Expression indexExpr = null;
         if (ia.getIndexExpr() != null) {
@@ -417,12 +417,12 @@ public class DeepCopyVisitor extends AbstractSqlppQueryExpressionVisitor<ILangEx
     }
 
     @Override
-    public ILangExpression visit(IndependentSubquery independentSubquery, Void arg) throws AsterixException {
+    public ILangExpression visit(IndependentSubquery independentSubquery, Void arg) throws CompilationException {
         return new IndependentSubquery((Expression) independentSubquery.getExpr().accept(this, arg));
     }
 
     @Override
-    public ILangExpression visit(CaseExpression caseExpr, Void arg) throws AsterixException {
+    public ILangExpression visit(CaseExpression caseExpr, Void arg) throws CompilationException {
         Expression conditionExpr = (Expression) caseExpr.getConditionExpr().accept(this, arg);
         List<Expression> whenExprList = copyExprList(caseExpr.getWhenExprs(), arg);
         List<Expression> thenExprList = copyExprList(caseExpr.getThenExprs(), arg);
@@ -430,7 +430,7 @@ public class DeepCopyVisitor extends AbstractSqlppQueryExpressionVisitor<ILangEx
         return new CaseExpression(conditionExpr, whenExprList, thenExprList, elseExpr);
     }
 
-    private List<Expression> copyExprList(List<Expression> exprs, Void arg) throws AsterixException {
+    private List<Expression> copyExprList(List<Expression> exprs, Void arg) throws CompilationException {
         List<Expression> newExprList = new ArrayList<>();
         for (Expression expr : exprs) {
             newExprList.add((Expression) expr.accept(this, arg));

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/e65e6ca4/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/visitor/FreeVariableVisitor.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/visitor/FreeVariableVisitor.java b/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/visitor/FreeVariableVisitor.java
index 3a9bebf..e152b9b 100644
--- a/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/visitor/FreeVariableVisitor.java
+++ b/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/visitor/FreeVariableVisitor.java
@@ -22,9 +22,9 @@ import java.util.Collection;
 import java.util.HashSet;
 import java.util.List;
 
-import org.apache.asterix.common.exceptions.AsterixException;
-import org.apache.asterix.lang.common.base.Expression;
+import org.apache.asterix.common.exceptions.CompilationException;
 import org.apache.asterix.lang.common.base.Clause.ClauseType;
+import org.apache.asterix.lang.common.base.Expression;
 import org.apache.asterix.lang.common.clause.GroupbyClause;
 import org.apache.asterix.lang.common.clause.LetClause;
 import org.apache.asterix.lang.common.clause.LimitClause;
@@ -71,7 +71,7 @@ import org.apache.hyracks.algebricks.common.utils.Pair;
 public class FreeVariableVisitor extends AbstractSqlppQueryExpressionVisitor<Void, Collection<VariableExpr>> {
 
     @Override
-    public Void visit(FromClause fromClause, Collection<VariableExpr> freeVars) throws AsterixException {
+    public Void visit(FromClause fromClause, Collection<VariableExpr> freeVars) throws CompilationException {
         Collection<VariableExpr> bindingVars = new HashSet<>();
         for (FromTerm fromTerm : fromClause.getFromTerms()) {
             Collection<VariableExpr> fromTermFreeVars = new HashSet<>();
@@ -91,7 +91,7 @@ public class FreeVariableVisitor extends AbstractSqlppQueryExpressionVisitor<Voi
     }
 
     @Override
-    public Void visit(FromTerm fromTerm, Collection<VariableExpr> freeVars) throws AsterixException {
+    public Void visit(FromTerm fromTerm, Collection<VariableExpr> freeVars) throws CompilationException {
         // The encountered binding variables so far in the fromterm.
         Collection<VariableExpr> bindingVariables = new HashSet<>();
 
@@ -125,25 +125,25 @@ public class FreeVariableVisitor extends AbstractSqlppQueryExpressionVisitor<Voi
     }
 
     @Override
-    public Void visit(JoinClause joinClause, Collection<VariableExpr> freeVars) throws AsterixException {
+    public Void visit(JoinClause joinClause, Collection<VariableExpr> freeVars) throws CompilationException {
         visitJoinAndNest(joinClause, joinClause.getConditionExpression(), freeVars);
         return null;
     }
 
     @Override
-    public Void visit(NestClause nestClause, Collection<VariableExpr> freeVars) throws AsterixException {
+    public Void visit(NestClause nestClause, Collection<VariableExpr> freeVars) throws CompilationException {
         visitJoinAndNest(nestClause, nestClause.getConditionExpression(), freeVars);
         return null;
     }
 
     @Override
-    public Void visit(UnnestClause unnestClause, Collection<VariableExpr> freeVars) throws AsterixException {
+    public Void visit(UnnestClause unnestClause, Collection<VariableExpr> freeVars) throws CompilationException {
         unnestClause.getRightExpression().accept(this, freeVars);
         return null;
     }
 
     @Override
-    public Void visit(Projection projection, Collection<VariableExpr> freeVars) throws AsterixException {
+    public Void visit(Projection projection, Collection<VariableExpr> freeVars) throws CompilationException {
         if (!projection.star()) {
             projection.getExpression().accept(this, freeVars);
         }
@@ -151,7 +151,7 @@ public class FreeVariableVisitor extends AbstractSqlppQueryExpressionVisitor<Voi
     }
 
     @Override
-    public Void visit(SelectBlock selectBlock, Collection<VariableExpr> freeVars) throws AsterixException {
+    public Void visit(SelectBlock selectBlock, Collection<VariableExpr> freeVars) throws CompilationException {
         Collection<VariableExpr> selectFreeVars = new HashSet<>();
         Collection<VariableExpr> fromFreeVars = new HashSet<>();
         Collection<VariableExpr> letsFreeVars = new HashSet<>();
@@ -213,7 +213,7 @@ public class FreeVariableVisitor extends AbstractSqlppQueryExpressionVisitor<Voi
     }
 
     @Override
-    public Void visit(SelectClause selectClause, Collection<VariableExpr> freeVars) throws AsterixException {
+    public Void visit(SelectClause selectClause, Collection<VariableExpr> freeVars) throws CompilationException {
         if (selectClause.selectElement()) {
             selectClause.getSelectElement().accept(this, freeVars);
         }
@@ -224,13 +224,13 @@ public class FreeVariableVisitor extends AbstractSqlppQueryExpressionVisitor<Voi
     }
 
     @Override
-    public Void visit(SelectElement selectElement, Collection<VariableExpr> freeVars) throws AsterixException {
+    public Void visit(SelectElement selectElement, Collection<VariableExpr> freeVars) throws CompilationException {
         selectElement.getExpression().accept(this, freeVars);
         return null;
     }
 
     @Override
-    public Void visit(SelectRegular selectRegular, Collection<VariableExpr> freeVars) throws AsterixException {
+    public Void visit(SelectRegular selectRegular, Collection<VariableExpr> freeVars) throws CompilationException {
         for (Projection projection : selectRegular.getProjections()) {
             projection.accept(this, freeVars);
         }
@@ -239,7 +239,7 @@ public class FreeVariableVisitor extends AbstractSqlppQueryExpressionVisitor<Voi
 
     @Override
     public Void visit(SelectSetOperation selectSetOperation, Collection<VariableExpr> freeVars)
-            throws AsterixException {
+            throws CompilationException {
         selectSetOperation.getLeftInput().accept(this, freeVars);
         for (SetOperationRight right : selectSetOperation.getRightInputs()) {
             right.getSetOperationRightInput().accept(this, freeVars);
@@ -248,37 +248,37 @@ public class FreeVariableVisitor extends AbstractSqlppQueryExpressionVisitor<Voi
     }
 
     @Override
-    public Void visit(HavingClause havingClause, Collection<VariableExpr> freeVars) throws AsterixException {
+    public Void visit(HavingClause havingClause, Collection<VariableExpr> freeVars) throws CompilationException {
         havingClause.getFilterExpression().accept(this, freeVars);
         return null;
     }
 
     @Override
-    public Void visit(Query q, Collection<VariableExpr> freeVars) throws AsterixException {
+    public Void visit(Query q, Collection<VariableExpr> freeVars) throws CompilationException {
         q.getBody().accept(this, freeVars);
         return null;
     }
 
     @Override
-    public Void visit(FunctionDecl fd, Collection<VariableExpr> freeVars) throws AsterixException {
+    public Void visit(FunctionDecl fd, Collection<VariableExpr> freeVars) throws CompilationException {
         fd.getFuncBody().accept(this, freeVars);
         return null;
     }
 
     @Override
-    public Void visit(WhereClause whereClause, Collection<VariableExpr> freeVars) throws AsterixException {
+    public Void visit(WhereClause whereClause, Collection<VariableExpr> freeVars) throws CompilationException {
         whereClause.getWhereExpr().accept(this, freeVars);
         return null;
     }
 
     @Override
-    public Void visit(OrderbyClause oc, Collection<VariableExpr> freeVars) throws AsterixException {
+    public Void visit(OrderbyClause oc, Collection<VariableExpr> freeVars) throws CompilationException {
         visit(oc.getOrderbyList(), freeVars);
         return null;
     }
 
     @Override
-    public Void visit(GroupbyClause gc, Collection<VariableExpr> freeVars) throws AsterixException {
+    public Void visit(GroupbyClause gc, Collection<VariableExpr> freeVars) throws CompilationException {
         // Puts all group-by variables into the symbol set of the new scope.
         for (GbyVariableExpressionPair gbyVarExpr : gc.getGbyPairList()) {
             gbyVarExpr.getExpr().accept(this, freeVars);
@@ -295,19 +295,20 @@ public class FreeVariableVisitor extends AbstractSqlppQueryExpressionVisitor<Voi
     }
 
     @Override
-    public Void visit(LimitClause limitClause, Collection<VariableExpr> freeVars) throws AsterixException {
+    public Void visit(LimitClause limitClause, Collection<VariableExpr> freeVars) throws CompilationException {
         limitClause.getLimitExpr().accept(this, freeVars);
         return null;
     }
 
     @Override
-    public Void visit(LetClause letClause, Collection<VariableExpr> freeVars) throws AsterixException {
+    public Void visit(LetClause letClause, Collection<VariableExpr> freeVars) throws CompilationException {
         letClause.getBindingExpr().accept(this, freeVars);
         return null;
     }
 
     @Override
-    public Void visit(SelectExpression selectExpression, Collection<VariableExpr> freeVars) throws AsterixException {
+    public Void visit(SelectExpression selectExpression, Collection<VariableExpr> freeVars)
+            throws CompilationException {
         Collection<VariableExpr> letsFreeVars = new HashSet<>();
         Collection<VariableExpr> selectFreeVars = new HashSet<>();
         visitLetClauses(selectExpression.getLetList(), letsFreeVars);
@@ -335,18 +336,18 @@ public class FreeVariableVisitor extends AbstractSqlppQueryExpressionVisitor<Voi
     }
 
     @Override
-    public Void visit(LiteralExpr l, Collection<VariableExpr> freeVars) throws AsterixException {
+    public Void visit(LiteralExpr l, Collection<VariableExpr> freeVars) throws CompilationException {
         return null;
     }
 
     @Override
-    public Void visit(ListConstructor lc, Collection<VariableExpr> freeVars) throws AsterixException {
+    public Void visit(ListConstructor lc, Collection<VariableExpr> freeVars) throws CompilationException {
         visit(lc.getExprList(), freeVars);
         return null;
     }
 
     @Override
-    public Void visit(RecordConstructor rc, Collection<VariableExpr> freeVars) throws AsterixException {
+    public Void visit(RecordConstructor rc, Collection<VariableExpr> freeVars) throws CompilationException {
         for (FieldBinding binding : rc.getFbList()) {
             binding.getLeftExpr().accept(this, freeVars);
             binding.getRightExpr().accept(this, freeVars);
@@ -355,13 +356,13 @@ public class FreeVariableVisitor extends AbstractSqlppQueryExpressionVisitor<Voi
     }
 
     @Override
-    public Void visit(OperatorExpr operatorExpr, Collection<VariableExpr> freeVars) throws AsterixException {
+    public Void visit(OperatorExpr operatorExpr, Collection<VariableExpr> freeVars) throws CompilationException {
         visit(operatorExpr.getExprList(), freeVars);
         return null;
     }
 
     @Override
-    public Void visit(IfExpr ifExpr, Collection<VariableExpr> freeVars) throws AsterixException {
+    public Void visit(IfExpr ifExpr, Collection<VariableExpr> freeVars) throws CompilationException {
         ifExpr.getCondExpr().accept(this, freeVars);
         ifExpr.getThenExpr().accept(this, freeVars);
         ifExpr.getElseExpr().accept(this, freeVars);
@@ -369,7 +370,7 @@ public class FreeVariableVisitor extends AbstractSqlppQueryExpressionVisitor<Voi
     }
 
     @Override
-    public Void visit(QuantifiedExpression qe, Collection<VariableExpr> freeVars) throws AsterixException {
+    public Void visit(QuantifiedExpression qe, Collection<VariableExpr> freeVars) throws CompilationException {
         for (QuantifiedPair pair : qe.getQuantifiedList()) {
             pair.getExpr().accept(this, freeVars);
         }
@@ -378,7 +379,7 @@ public class FreeVariableVisitor extends AbstractSqlppQueryExpressionVisitor<Voi
     }
 
     @Override
-    public Void visit(CallExpr callExpr, Collection<VariableExpr> freeVars) throws AsterixException {
+    public Void visit(CallExpr callExpr, Collection<VariableExpr> freeVars) throws CompilationException {
         for (Expression expr : callExpr.getExprList()) {
             expr.accept(this, freeVars);
         }
@@ -386,25 +387,25 @@ public class FreeVariableVisitor extends AbstractSqlppQueryExpressionVisitor<Voi
     }
 
     @Override
-    public Void visit(VariableExpr varExpr, Collection<VariableExpr> freeVars) throws AsterixException {
+    public Void visit(VariableExpr varExpr, Collection<VariableExpr> freeVars) throws CompilationException {
         freeVars.add(varExpr);
         return null;
     }
 
     @Override
-    public Void visit(UnaryExpr u, Collection<VariableExpr> freeVars) throws AsterixException {
+    public Void visit(UnaryExpr u, Collection<VariableExpr> freeVars) throws CompilationException {
         u.getExpr().accept(this, freeVars);
         return null;
     }
 
     @Override
-    public Void visit(FieldAccessor fa, Collection<VariableExpr> freeVars) throws AsterixException {
+    public Void visit(FieldAccessor fa, Collection<VariableExpr> freeVars) throws CompilationException {
         fa.getExpr().accept(this, freeVars);
         return null;
     }
 
     @Override
-    public Void visit(IndexAccessor ia, Collection<VariableExpr> freeVars) throws AsterixException {
+    public Void visit(IndexAccessor ia, Collection<VariableExpr> freeVars) throws CompilationException {
         ia.getExpr().accept(this, freeVars);
         if (ia.getIndexExpr() != null) {
             ia.getIndexExpr();
@@ -414,13 +415,13 @@ public class FreeVariableVisitor extends AbstractSqlppQueryExpressionVisitor<Voi
 
     @Override
     public Void visit(IndependentSubquery independentSubquery, Collection<VariableExpr> freeVars)
-            throws AsterixException {
+            throws CompilationException {
         independentSubquery.getExpr().accept(this, freeVars);
         return null;
     }
 
     @Override
-    public Void visit(CaseExpression caseExpr, Collection<VariableExpr> freeVars) throws AsterixException {
+    public Void visit(CaseExpression caseExpr, Collection<VariableExpr> freeVars) throws CompilationException {
         caseExpr.getConditionExpr().accept(this, freeVars);
         visit(caseExpr.getWhenExprs(), freeVars);
         visit(caseExpr.getThenExprs(), freeVars);
@@ -429,7 +430,7 @@ public class FreeVariableVisitor extends AbstractSqlppQueryExpressionVisitor<Voi
     }
 
     private void visitLetClauses(List<LetClause> letClauses, Collection<VariableExpr> freeVars)
-            throws AsterixException {
+            throws CompilationException {
         if (letClauses == null || letClauses.isEmpty()) {
             return;
         }
@@ -448,7 +449,7 @@ public class FreeVariableVisitor extends AbstractSqlppQueryExpressionVisitor<Voi
     }
 
     private void visitJoinAndNest(AbstractBinaryCorrelateClause clause, Expression condition,
-            Collection<VariableExpr> freeVars) throws AsterixException {
+            Collection<VariableExpr> freeVars) throws CompilationException {
         clause.getRightExpression().accept(this, freeVars);
         Collection<VariableExpr> conditionFreeVars = new HashSet<>();
         condition.accept(this, freeVars);
@@ -461,7 +462,7 @@ public class FreeVariableVisitor extends AbstractSqlppQueryExpressionVisitor<Voi
         freeVars.addAll(conditionFreeVars);
     }
 
-    private void visit(List<Expression> exprs, Collection<VariableExpr> arg) throws AsterixException {
+    private void visit(List<Expression> exprs, Collection<VariableExpr> arg) throws CompilationException {
         for (Expression expr : exprs) {
             expr.accept(this, arg);
         }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/e65e6ca4/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/visitor/SqlppAstPrintVisitor.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/visitor/SqlppAstPrintVisitor.java b/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/visitor/SqlppAstPrintVisitor.java
index 30caa4b..e52bee3 100644
--- a/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/visitor/SqlppAstPrintVisitor.java
+++ b/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/visitor/SqlppAstPrintVisitor.java
@@ -21,7 +21,7 @@ package org.apache.asterix.lang.sqlpp.visitor;
 import java.io.PrintWriter;
 import java.util.List;
 
-import org.apache.asterix.common.exceptions.AsterixException;
+import org.apache.asterix.common.exceptions.CompilationException;
 import org.apache.asterix.common.functions.FunctionSignature;
 import org.apache.asterix.lang.common.base.Expression;
 import org.apache.asterix.lang.common.clause.GroupbyClause;
@@ -67,7 +67,7 @@ public class SqlppAstPrintVisitor extends QueryPrintVisitor implements ISqlppVis
     }
 
     @Override
-    public Void visit(FromClause fromClause, Integer step) throws AsterixException {
+    public Void visit(FromClause fromClause, Integer step) throws CompilationException {
         out.print(skip(step) + "FROM [");
         int index = 0;
         for (FromTerm fromTerm : fromClause.getFromTerms()) {
@@ -82,7 +82,7 @@ public class SqlppAstPrintVisitor extends QueryPrintVisitor implements ISqlppVis
     }
 
     @Override
-    public Void visit(FromTerm fromTerm, Integer step) throws AsterixException {
+    public Void visit(FromTerm fromTerm, Integer step) throws CompilationException {
         fromTerm.getLeftExpression().accept(this, step);
         out.print(skip(step) + "AS ");
         fromTerm.getLeftVariable().accept(this, 0);
@@ -99,7 +99,7 @@ public class SqlppAstPrintVisitor extends QueryPrintVisitor implements ISqlppVis
     }
 
     @Override
-    public Void visit(JoinClause joinClause, Integer step) throws AsterixException {
+    public Void visit(JoinClause joinClause, Integer step) throws CompilationException {
         out.println(skip(step) + joinClause.getJoinType() + " JOIN");
         joinClause.getRightExpression().accept(this, step + 1);
         out.print(skip(step + 1) + "AS ");
@@ -114,7 +114,7 @@ public class SqlppAstPrintVisitor extends QueryPrintVisitor implements ISqlppVis
     }
 
     @Override
-    public Void visit(NestClause nestClause, Integer step) throws AsterixException {
+    public Void visit(NestClause nestClause, Integer step) throws CompilationException {
         out.println(skip(step) + nestClause.getJoinType() + " NEST");
         nestClause.getRightExpression().accept(this, step + 1);
         out.print(skip(step + 1) + "AS ");
@@ -129,7 +129,7 @@ public class SqlppAstPrintVisitor extends QueryPrintVisitor implements ISqlppVis
     }
 
     @Override
-    public Void visit(Projection projection, Integer step) throws AsterixException {
+    public Void visit(Projection projection, Integer step) throws CompilationException {
         if (projection.star()) {
             out.println(skip(step) + "*");
         } else {
@@ -140,7 +140,7 @@ public class SqlppAstPrintVisitor extends QueryPrintVisitor implements ISqlppVis
     }
 
     @Override
-    public Void visit(SelectBlock selectBlock, Integer step) throws AsterixException {
+    public Void visit(SelectBlock selectBlock, Integer step) throws CompilationException {
         selectBlock.getSelectClause().accept(this, step);
         if (selectBlock.hasFromClause()) {
             selectBlock.getFromClause().accept(this, step);
@@ -168,7 +168,7 @@ public class SqlppAstPrintVisitor extends QueryPrintVisitor implements ISqlppVis
     }
 
     @Override
-    public Void visit(SelectClause selectClause, Integer step) throws AsterixException {
+    public Void visit(SelectClause selectClause, Integer step) throws CompilationException {
         if (selectClause.selectRegular()) {
             selectClause.getSelectRegular().accept(this, step);
         }
@@ -179,7 +179,7 @@ public class SqlppAstPrintVisitor extends QueryPrintVisitor implements ISqlppVis
     }
 
     @Override
-    public Void visit(SelectElement selectElement, Integer step) throws AsterixException {
+    public Void visit(SelectElement selectElement, Integer step) throws CompilationException {
         out.println(skip(step) + "SELECT ELEMENT [");
         selectElement.getExpression().accept(this, step);
         out.println(skip(step) + "]");
@@ -187,7 +187,7 @@ public class SqlppAstPrintVisitor extends QueryPrintVisitor implements ISqlppVis
     }
 
     @Override
-    public Void visit(SelectRegular selectRegular, Integer step) throws AsterixException {
+    public Void visit(SelectRegular selectRegular, Integer step) throws CompilationException {
         out.println(skip(step) + "SELECT [");
         for (Projection projection : selectRegular.getProjections()) {
             projection.accept(this, step);
@@ -197,7 +197,7 @@ public class SqlppAstPrintVisitor extends QueryPrintVisitor implements ISqlppVis
     }
 
     @Override
-    public Void visit(SelectSetOperation selectSetOperation, Integer step) throws AsterixException {
+    public Void visit(SelectSetOperation selectSetOperation, Integer step) throws CompilationException {
         selectSetOperation.getLeftInput().accept(this, step);
         if (selectSetOperation.hasRightInputs()) {
             for (SetOperationRight right : selectSetOperation.getRightInputs()) {
@@ -210,7 +210,7 @@ public class SqlppAstPrintVisitor extends QueryPrintVisitor implements ISqlppVis
     }
 
     @Override
-    public Void visit(SelectExpression selectStatement, Integer step) throws AsterixException {
+    public Void visit(SelectExpression selectStatement, Integer step) throws CompilationException {
         if (selectStatement.isSubquery()) {
             out.println(skip(step) + "(");
         }
@@ -234,7 +234,7 @@ public class SqlppAstPrintVisitor extends QueryPrintVisitor implements ISqlppVis
     }
 
     @Override
-    public Void visit(UnnestClause unnestClause, Integer step) throws AsterixException {
+    public Void visit(UnnestClause unnestClause, Integer step) throws CompilationException {
         out.println(skip(step) + unnestClause.getJoinType() + " UNNEST");
         unnestClause.getRightExpression().accept(this, step + 1);
         out.print(skip(step + 1) + " AS ");
@@ -247,14 +247,14 @@ public class SqlppAstPrintVisitor extends QueryPrintVisitor implements ISqlppVis
     }
 
     @Override
-    public Void visit(HavingClause havingClause, Integer step) throws AsterixException {
+    public Void visit(HavingClause havingClause, Integer step) throws CompilationException {
         out.println(skip(step) + " HAVING");
         havingClause.getFilterExpression().accept(this, step + 1);
         return null;
     }
 
     @Override
-    public Void visit(CallExpr pf, Integer step) throws AsterixException {
+    public Void visit(CallExpr pf, Integer step) throws CompilationException {
         FunctionSignature functionSignature = pf.getFunctionSignature();
         FunctionSignature normalizedFunctionSignature =
                 FunctionMapUtil.normalizeBuiltinFunctionSignature(functionSignature, false);
@@ -270,7 +270,7 @@ public class SqlppAstPrintVisitor extends QueryPrintVisitor implements ISqlppVis
     }
 
     @Override
-    public Void visit(GroupbyClause gc, Integer step) throws AsterixException {
+    public Void visit(GroupbyClause gc, Integer step) throws CompilationException {
         if (gc.isGroupAll()) {
             out.println(skip(step) + "Group All");
             return null;
@@ -300,13 +300,13 @@ public class SqlppAstPrintVisitor extends QueryPrintVisitor implements ISqlppVis
     }
 
     @Override
-    public Void visit(IndependentSubquery independentSubquery, Integer arg) throws AsterixException {
+    public Void visit(IndependentSubquery independentSubquery, Integer arg) throws CompilationException {
         independentSubquery.getExpr().accept(this, arg);
         return null;
     }
 
     @Override
-    public Void visit(CaseExpression caseExpr, Integer step) throws AsterixException {
+    public Void visit(CaseExpression caseExpr, Integer step) throws CompilationException {
         out.print(skip(step) + "CASE");
         caseExpr.getConditionExpr().accept(this, step + 2);
         out.println();


Mime
View raw message