Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 77124200C22 for ; Mon, 16 Jan 2017 19:46:49 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 75CD0160B41; Mon, 16 Jan 2017 18:46:49 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 11E32160B58 for ; Mon, 16 Jan 2017 19:46:46 +0100 (CET) Received: (qmail 70378 invoked by uid 500); 16 Jan 2017 18:46:46 -0000 Mailing-List: contact commits-help@asterixdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@asterixdb.apache.org Delivered-To: mailing list commits@asterixdb.apache.org Received: (qmail 70255 invoked by uid 99); 16 Jan 2017 18:46:46 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 16 Jan 2017 18:46:46 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id DCC84DFCF2; Mon, 16 Jan 2017 18:46:45 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: sjaco002@apache.org To: commits@asterixdb.apache.org Date: Mon, 16 Jan 2017 18:46:48 -0000 Message-Id: <4f678071254844809154b02cb6e7c4e7@git.apache.org> In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [4/7] asterixdb git commit: Change the compilation related Exception archived-at: Mon, 16 Jan 2017 18:46:49 -0000 http://git-wip-us.apache.org/repos/asf/asterixdb/blob/e65e6ca4/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/visitor/AbstractInlineUdfsVisitor.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/visitor/AbstractInlineUdfsVisitor.java b/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/visitor/AbstractInlineUdfsVisitor.java index 725d7f4..858a8c2 100644 --- a/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/visitor/AbstractInlineUdfsVisitor.java +++ b/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/visitor/AbstractInlineUdfsVisitor.java @@ -22,7 +22,7 @@ import java.util.ArrayList; import java.util.Iterator; 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.Expression.Kind; @@ -84,17 +84,17 @@ public abstract class AbstractInlineUdfsVisitor extends AbstractQueryExpressionV * @return a query expression which is upto a specific langauge, e.g., FLWOGR in AQL and expression query in SQL++. */ protected abstract Expression generateQueryExpression(List letClauses, Expression returnExpr) - throws AsterixException; + throws CompilationException; @Override - public Boolean visit(Query q, List arg) throws AsterixException { + public Boolean visit(Query q, List arg) throws CompilationException { Pair p = inlineUdfsInExpr(q.getBody(), arg); q.setBody(p.second); return p.first; } @Override - public Boolean visit(FunctionDecl fd, List arg) throws AsterixException { + public Boolean visit(FunctionDecl fd, List arg) throws CompilationException { // Careful, we should only do this after analyzing the graph of function // calls. Pair p = inlineUdfsInExpr(fd.getFuncBody(), arg); @@ -103,14 +103,14 @@ public abstract class AbstractInlineUdfsVisitor extends AbstractQueryExpressionV } @Override - public Boolean visit(ListConstructor lc, List arg) throws AsterixException { + public Boolean visit(ListConstructor lc, List arg) throws CompilationException { Pair> p = inlineUdfsInExprList(lc.getExprList(), arg); lc.setExprList(p.second); return p.first; } @Override - public Boolean visit(RecordConstructor rc, List arg) throws AsterixException { + public Boolean visit(RecordConstructor rc, List arg) throws CompilationException { boolean changed = false; for (FieldBinding b : rc.getFbList()) { Pair leftExprInlined = inlineUdfsInExpr(b.getLeftExpr(), arg); @@ -124,35 +124,35 @@ public abstract class AbstractInlineUdfsVisitor extends AbstractQueryExpressionV } @Override - public Boolean visit(CallExpr pf, List arg) throws AsterixException { + public Boolean visit(CallExpr pf, List arg) throws CompilationException { Pair> p = inlineUdfsInExprList(pf.getExprList(), arg); pf.setExprList(p.second); return p.first; } @Override - public Boolean visit(OperatorExpr ifbo, List arg) throws AsterixException { + public Boolean visit(OperatorExpr ifbo, List arg) throws CompilationException { Pair> p = inlineUdfsInExprList(ifbo.getExprList(), arg); ifbo.setExprList(p.second); return p.first; } @Override - public Boolean visit(FieldAccessor fa, List arg) throws AsterixException { + public Boolean visit(FieldAccessor fa, List arg) throws CompilationException { Pair p = inlineUdfsInExpr(fa.getExpr(), arg); fa.setExpr(p.second); return p.first; } @Override - public Boolean visit(IndexAccessor fa, List arg) throws AsterixException { + public Boolean visit(IndexAccessor fa, List arg) throws CompilationException { Pair p = inlineUdfsInExpr(fa.getExpr(), arg); fa.setExpr(p.second); return p.first; } @Override - public Boolean visit(IfExpr ifexpr, List arg) throws AsterixException { + public Boolean visit(IfExpr ifexpr, List arg) throws CompilationException { Pair p1 = inlineUdfsInExpr(ifexpr.getCondExpr(), arg); ifexpr.setCondExpr(p1.second); Pair p2 = inlineUdfsInExpr(ifexpr.getThenExpr(), arg); @@ -163,7 +163,7 @@ public abstract class AbstractInlineUdfsVisitor extends AbstractQueryExpressionV } @Override - public Boolean visit(QuantifiedExpression qe, List arg) throws AsterixException { + public Boolean visit(QuantifiedExpression qe, List arg) throws CompilationException { boolean changed = false; for (QuantifiedPair t : qe.getQuantifiedList()) { Pair p = inlineUdfsInExpr(t.getExpr(), arg); @@ -178,28 +178,28 @@ public abstract class AbstractInlineUdfsVisitor extends AbstractQueryExpressionV } @Override - public Boolean visit(LetClause lc, List arg) throws AsterixException { + public Boolean visit(LetClause lc, List arg) throws CompilationException { Pair p = inlineUdfsInExpr(lc.getBindingExpr(), arg); lc.setBindingExpr(p.second); return p.first; } @Override - public Boolean visit(WhereClause wc, List arg) throws AsterixException { + public Boolean visit(WhereClause wc, List arg) throws CompilationException { Pair p = inlineUdfsInExpr(wc.getWhereExpr(), arg); wc.setWhereExpr(p.second); return p.first; } @Override - public Boolean visit(OrderbyClause oc, List arg) throws AsterixException { + public Boolean visit(OrderbyClause oc, List arg) throws CompilationException { Pair> p = inlineUdfsInExprList(oc.getOrderbyList(), arg); oc.setOrderbyList(p.second); return p.first; } @Override - public Boolean visit(GroupbyClause gc, List arg) throws AsterixException { + public Boolean visit(GroupbyClause gc, List arg) throws CompilationException { boolean changed = false; for (GbyVariableExpressionPair p : gc.getGbyPairList()) { Pair be = inlineUdfsInExpr(p.getExpr(), arg); @@ -219,7 +219,7 @@ public abstract class AbstractInlineUdfsVisitor extends AbstractQueryExpressionV } @Override - public Boolean visit(LimitClause lc, List arg) throws AsterixException { + public Boolean visit(LimitClause lc, List arg) throws CompilationException { Pair p1 = inlineUdfsInExpr(lc.getLimitExpr(), arg); lc.setLimitExpr(p1.second); boolean changed = p1.first; @@ -232,22 +232,22 @@ public abstract class AbstractInlineUdfsVisitor extends AbstractQueryExpressionV } @Override - public Boolean visit(UnaryExpr u, List arg) throws AsterixException { + public Boolean visit(UnaryExpr u, List arg) throws CompilationException { return u.getExpr().accept(this, arg); } @Override - public Boolean visit(VariableExpr v, List arg) throws AsterixException { + public Boolean visit(VariableExpr v, List arg) throws CompilationException { return false; } @Override - public Boolean visit(LiteralExpr l, List arg) throws AsterixException { + public Boolean visit(LiteralExpr l, List arg) throws CompilationException { return false; } @Override - public Boolean visit(InsertStatement insert, List arg) throws AsterixException { + public Boolean visit(InsertStatement insert, List arg) throws CompilationException { boolean changed = false; Expression returnExpression = insert.getReturnExpression(); if (returnExpression != null) { @@ -261,7 +261,7 @@ public abstract class AbstractInlineUdfsVisitor extends AbstractQueryExpressionV } protected Pair inlineUdfsInExpr(Expression expr, List arg) - throws AsterixException { + throws CompilationException { if (expr.getKind() != Kind.CALL_EXPRESSION) { boolean r = expr.accept(this, arg); return new Pair<>(r, expr); @@ -308,7 +308,7 @@ public abstract class AbstractInlineUdfsVisitor extends AbstractQueryExpressionV } protected Pair> inlineUdfsInExprList(List exprList, List fds) - throws AsterixException { + throws CompilationException { ArrayList newList = new ArrayList<>(); boolean changed = false; for (Expression e : exprList) { @@ -321,7 +321,7 @@ public abstract class AbstractInlineUdfsVisitor extends AbstractQueryExpressionV return new Pair<>(changed, newList); } - protected Expression rewriteFunctionBody(Expression expr) throws AsterixException { + protected Expression rewriteFunctionBody(Expression expr) throws CompilationException { Query wrappedQuery = new Query(false); wrappedQuery.setBody(expr); wrappedQuery.setTopLevel(false); http://git-wip-us.apache.org/repos/asf/asterixdb/blob/e65e6ca4/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/visitor/CloneAndSubstituteVariablesVisitor.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/visitor/CloneAndSubstituteVariablesVisitor.java b/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/visitor/CloneAndSubstituteVariablesVisitor.java index 3fdb141..9b419f1 100644 --- a/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/visitor/CloneAndSubstituteVariablesVisitor.java +++ b/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/visitor/CloneAndSubstituteVariablesVisitor.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.Expression.Kind; import org.apache.asterix.lang.common.base.ILangExpression; @@ -68,7 +68,7 @@ public class CloneAndSubstituteVariablesVisitor extends @Override public Pair visit(LetClause lc, - VariableSubstitutionEnvironment env) throws AsterixException { + VariableSubstitutionEnvironment env) throws CompilationException { Pair p1 = lc.getBindingExpr().accept(this, env); VariableExpr varExpr = lc.getVarExpr(); VariableExpr newVe = generateNewVariable(context, varExpr); @@ -78,7 +78,7 @@ public class CloneAndSubstituteVariablesVisitor extends @Override public Pair visit(GroupbyClause gc, - VariableSubstitutionEnvironment env) throws AsterixException { + VariableSubstitutionEnvironment env) throws CompilationException { VariableSubstitutionEnvironment newSubs = env; List newGbyList = VariableCloneAndSubstitutionUtil.substInVarExprPair(context, gc.getGbyPairList(), newSubs, this); @@ -112,7 +112,7 @@ public class CloneAndSubstituteVariablesVisitor extends @Override public Pair visit(QuantifiedExpression qe, - VariableSubstitutionEnvironment env) throws AsterixException { + VariableSubstitutionEnvironment env) throws CompilationException { List oldPairs = qe.getQuantifiedList(); List newPairs = new ArrayList<>(oldPairs.size()); VariableSubstitutionEnvironment newSubs = env; @@ -131,7 +131,7 @@ public class CloneAndSubstituteVariablesVisitor extends @Override public Pair visit(WhereClause wc, - VariableSubstitutionEnvironment env) throws AsterixException { + VariableSubstitutionEnvironment env) throws CompilationException { Pair p1 = wc.getWhereExpr().accept(this, env); WhereClause newW = new WhereClause((Expression) p1.first); return new Pair<>(newW, p1.second); @@ -139,7 +139,7 @@ public class CloneAndSubstituteVariablesVisitor extends @Override public Pair visit(CallExpr pf, - VariableSubstitutionEnvironment env) throws AsterixException { + VariableSubstitutionEnvironment env) throws CompilationException { List exprList = VariableCloneAndSubstitutionUtil.visitAndCloneExprList(pf.getExprList(), env, this); CallExpr f = new CallExpr(pf.getFunctionSignature(), exprList); return new Pair<>(f, env); @@ -147,16 +147,17 @@ public class CloneAndSubstituteVariablesVisitor extends @Override public Pair visit(FunctionDecl fd, - VariableSubstitutionEnvironment env) throws AsterixException { + VariableSubstitutionEnvironment env) throws CompilationException { List newList = new ArrayList<>(fd.getParamList().size()); for (VarIdentifier vi : fd.getParamList()) { VariableExpr varExpr = new VariableExpr(vi); if (!env.constainsOldVar(varExpr)) { - throw new AsterixException("Parameter " + vi + " does not appear in the substitution list."); + throw new CompilationException("Parameter " + vi + " does not appear in the substitution list."); } Expression newExpr = env.findSubstitution(varExpr); if (newExpr.getKind() != Kind.VARIABLE_EXPRESSION) { - throw new AsterixException("Parameter " + vi + " cannot be substituted by a non-variable expression."); + throw new CompilationException( + "Parameter " + vi + " cannot be substituted by a non-variable expression."); } newList.add(((VariableExpr) newExpr).getVar()); } @@ -168,7 +169,7 @@ public class CloneAndSubstituteVariablesVisitor extends @Override public Pair visit(IfExpr ifexpr, - VariableSubstitutionEnvironment env) throws AsterixException { + VariableSubstitutionEnvironment env) throws CompilationException { Pair p1 = ifexpr.getCondExpr().accept(this, env); Pair p2 = ifexpr.getThenExpr().accept(this, env); Pair p3 = ifexpr.getElseExpr().accept(this, env); @@ -178,7 +179,7 @@ public class CloneAndSubstituteVariablesVisitor extends @Override public Pair visit(LimitClause lc, - VariableSubstitutionEnvironment env) throws AsterixException { + VariableSubstitutionEnvironment env) throws CompilationException { Pair p1 = lc.getLimitExpr().accept(this, env); Pair p2; Expression lcOffsetExpr = lc.getOffset(); @@ -193,7 +194,7 @@ public class CloneAndSubstituteVariablesVisitor extends @Override public Pair visit(ListConstructor lc, - VariableSubstitutionEnvironment env) throws AsterixException { + VariableSubstitutionEnvironment env) throws CompilationException { List oldExprList = lc.getExprList(); List exprs = VariableCloneAndSubstitutionUtil.visitAndCloneExprList(oldExprList, env, this); ListConstructor c = new ListConstructor(lc.getType(), exprs); @@ -202,13 +203,13 @@ public class CloneAndSubstituteVariablesVisitor extends @Override public Pair visit(LiteralExpr l, - VariableSubstitutionEnvironment env) throws AsterixException { + VariableSubstitutionEnvironment env) throws CompilationException { return new Pair<>(l, env); } @Override public Pair visit(OperatorExpr op, - VariableSubstitutionEnvironment env) throws AsterixException { + VariableSubstitutionEnvironment env) throws CompilationException { List oldExprList = op.getExprList(); List exprs = new ArrayList<>(oldExprList.size()); for (Expression e : oldExprList) { @@ -221,7 +222,7 @@ public class CloneAndSubstituteVariablesVisitor extends @Override public Pair visit(OrderbyClause oc, - VariableSubstitutionEnvironment env) throws AsterixException { + VariableSubstitutionEnvironment env) throws CompilationException { List exprList = VariableCloneAndSubstitutionUtil.visitAndCloneExprList(oc.getOrderbyList(), env, this); OrderbyClause oc2 = new OrderbyClause(exprList, oc.getModifierList()); @@ -233,7 +234,7 @@ public class CloneAndSubstituteVariablesVisitor extends @Override public Pair visit(Query q, VariableSubstitutionEnvironment env) - throws AsterixException { + throws CompilationException { Query newQ = new Query(q.isExplain()); Pair p1 = q.getBody().accept(this, env); newQ.setBody((Expression) p1.first); @@ -242,7 +243,7 @@ public class CloneAndSubstituteVariablesVisitor extends @Override public Pair visit(RecordConstructor rc, - VariableSubstitutionEnvironment env) throws AsterixException { + VariableSubstitutionEnvironment env) throws CompilationException { List oldFbs = rc.getFbList(); ArrayList newFbs = new ArrayList<>(oldFbs.size()); for (FieldBinding fb : oldFbs) { @@ -257,7 +258,7 @@ public class CloneAndSubstituteVariablesVisitor extends @Override public Pair visit(UnaryExpr u, - VariableSubstitutionEnvironment env) throws AsterixException { + VariableSubstitutionEnvironment env) throws CompilationException { Pair p1 = u.getExpr().accept(this, env); UnaryExpr newU = new UnaryExpr(u.getExprType(), (Expression) p1.first); return new Pair<>(newU, env); @@ -265,7 +266,7 @@ public class CloneAndSubstituteVariablesVisitor extends @Override public Pair visit(IndexAccessor ia, - VariableSubstitutionEnvironment env) throws AsterixException { + VariableSubstitutionEnvironment env) throws CompilationException { Pair p1 = ia.getExpr().accept(this, env); Expression indexExpr = null; if (!ia.isAny()) { @@ -279,7 +280,7 @@ public class CloneAndSubstituteVariablesVisitor extends @Override public Pair visit(FieldAccessor fa, - VariableSubstitutionEnvironment env) throws AsterixException { + VariableSubstitutionEnvironment env) throws CompilationException { Pair p = fa.getExpr().accept(this, env); FieldAccessor newF = new FieldAccessor((Expression) p.first, fa.getIdent()); return new Pair<>(newF, p.second); @@ -287,13 +288,13 @@ public class CloneAndSubstituteVariablesVisitor extends @Override public Pair visit(VariableExpr v, - VariableSubstitutionEnvironment env) throws AsterixException { + VariableSubstitutionEnvironment env) throws CompilationException { return new Pair<>(rewriteVariableExpr(v, env), env); } // Replace a variable expression if the variable is to-be substituted. protected Expression rewriteVariableExpr(VariableExpr expr, VariableSubstitutionEnvironment env) - throws AsterixException { + throws CompilationException { if (env.constainsOldVar(expr)) { return env.findSubstitution(expr); } else { @@ -329,10 +330,10 @@ public class CloneAndSubstituteVariablesVisitor extends * @param env, * the variable substitution environment. * @return a pair of an ILangExpression and a variable substitution environment. - * @throws AsterixException + * @throws CompilationException */ protected Pair visitUnnesBindingExpression(Expression expr, - VariableSubstitutionEnvironment env) throws AsterixException { + VariableSubstitutionEnvironment env) throws CompilationException { return expr.accept(this, env); } http://git-wip-us.apache.org/repos/asf/asterixdb/blob/e65e6ca4/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/visitor/FormatPrintVisitor.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/visitor/FormatPrintVisitor.java b/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/visitor/FormatPrintVisitor.java index 7a96fac..eefed9d 100644 --- a/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/visitor/FormatPrintVisitor.java +++ b/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/visitor/FormatPrintVisitor.java @@ -30,7 +30,7 @@ import java.util.Set; 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.exceptions.CompilationException; import org.apache.asterix.common.functions.FunctionSignature; import org.apache.asterix.lang.common.base.Expression; import org.apache.asterix.lang.common.base.Literal; @@ -145,7 +145,7 @@ public class FormatPrintVisitor implements ILangVisitor { } @Override - public Void visit(Query q, Integer step) throws AsterixException { + public Void visit(Query q, Integer step) throws CompilationException { if (q.getBody() != null) { q.getBody().accept(this, step); } @@ -185,7 +185,7 @@ public class FormatPrintVisitor implements ILangVisitor { } @Override - public Void visit(ListConstructor lc, Integer step) throws AsterixException { + public Void visit(ListConstructor lc, Integer step) throws CompilationException { boolean ordered = false; if (lc.getType().equals(ListConstructor.Type.ORDERED_LIST_CONSTRUCTOR)) { ordered = true; @@ -197,7 +197,7 @@ public class FormatPrintVisitor implements ILangVisitor { } @Override - public Void visit(RecordConstructor rc, Integer step) throws AsterixException { + public Void visit(RecordConstructor rc, Integer step) throws CompilationException { out.print("{"); // print all field bindings int size = rc.getFbList().size(); @@ -215,7 +215,7 @@ public class FormatPrintVisitor implements ILangVisitor { } @Override - public Void visit(CallExpr callExpr, Integer step) throws AsterixException { + public Void visit(CallExpr callExpr, Integer step) throws CompilationException { printHints(callExpr.getHints(), step); out.print(generateFullName(callExpr.getFunctionSignature().getNamespace(), callExpr.getFunctionSignature().getName()) + "("); @@ -225,7 +225,7 @@ public class FormatPrintVisitor implements ILangVisitor { } @Override - public Void visit(OperatorExpr operatorExpr, Integer step) throws AsterixException { + public Void visit(OperatorExpr operatorExpr, Integer step) throws CompilationException { List exprList = operatorExpr.getExprList(); List opList = operatorExpr.getOpList(); if (operatorExpr.isCurrentop()) { @@ -247,7 +247,7 @@ public class FormatPrintVisitor implements ILangVisitor { } @Override - public Void visit(IfExpr ifexpr, Integer step) throws AsterixException { + public Void visit(IfExpr ifexpr, Integer step) throws CompilationException { out.print("if ("); ifexpr.getCondExpr().accept(this, step + 2); out.println(")"); @@ -260,7 +260,7 @@ public class FormatPrintVisitor implements ILangVisitor { } @Override - public Void visit(QuantifiedExpression qe, Integer step) throws AsterixException { + public Void visit(QuantifiedExpression qe, Integer step) throws CompilationException { out.print(qe.getQuantifier().toString().toLowerCase() + " "); // quantifiedList accept visitor int index = 0; @@ -279,7 +279,7 @@ public class FormatPrintVisitor implements ILangVisitor { } @Override - public Void visit(LetClause lc, Integer step) throws AsterixException { + public Void visit(LetClause lc, Integer step) throws CompilationException { out.print(skip(step) + "let "); lc.getVarExpr().accept(this, 0); out.print(assignSymbol); @@ -289,7 +289,7 @@ public class FormatPrintVisitor implements ILangVisitor { } @Override - public Void visit(WhereClause wc, Integer step) throws AsterixException { + public Void visit(WhereClause wc, Integer step) throws CompilationException { out.print(skip(step) + "where "); wc.getWhereExpr().accept(this, step + 1); out.println(); @@ -297,7 +297,7 @@ public class FormatPrintVisitor implements ILangVisitor { } @Override - public Void visit(OrderbyClause oc, Integer step) throws AsterixException { + public Void visit(OrderbyClause oc, Integer step) throws CompilationException { out.print(skip(step) + "order by "); List mlist = oc.getModifierList(); List list = oc.getOrderbyList(); @@ -318,7 +318,7 @@ public class FormatPrintVisitor implements ILangVisitor { } @Override - public Void visit(GroupbyClause gc, Integer step) throws AsterixException { + public Void visit(GroupbyClause gc, Integer step) throws CompilationException { if (gc.hasHashGroupByHint()) { out.println(skip(step) + "/* +hash */"); } @@ -351,7 +351,7 @@ public class FormatPrintVisitor implements ILangVisitor { } @Override - public Void visit(LimitClause lc, Integer step) throws AsterixException { + public Void visit(LimitClause lc, Integer step) throws CompilationException { out.print(skip(step) + "limit "); lc.getLimitExpr().accept(this, step + 1); if (lc.getOffset() != null) { @@ -363,7 +363,7 @@ public class FormatPrintVisitor implements ILangVisitor { } @Override - public Void visit(FunctionDecl fd, Integer step) throws AsterixException { + public Void visit(FunctionDecl fd, Integer step) throws CompilationException { out.print(skip(step) + "declare function " + generateFullName(null, fd.getSignature().getName()) + "("); List parameters = new ArrayList(); parameters.addAll(fd.getParamList()); @@ -377,21 +377,21 @@ public class FormatPrintVisitor implements ILangVisitor { } @Override - public Void visit(UnaryExpr u, Integer step) throws AsterixException { + public Void visit(UnaryExpr u, Integer step) throws CompilationException { out.print(u.getExprType() == UnaryExprType.NEGATIVE ? "-" : ""); u.getExpr().accept(this, 0); return null; } @Override - public Void visit(FieldAccessor fa, Integer step) throws AsterixException { + public Void visit(FieldAccessor fa, Integer step) throws CompilationException { fa.getExpr().accept(this, step + 1); out.print("." + normalize(fa.getIdent().getValue())); return null; } @Override - public Void visit(IndexAccessor fa, Integer step) throws AsterixException { + public Void visit(IndexAccessor fa, Integer step) throws CompilationException { fa.getExpr().accept(this, step + 1); out.print("["); if (fa.isAny()) { @@ -404,7 +404,7 @@ public class FormatPrintVisitor implements ILangVisitor { } @Override - public Void visit(TypeDecl t, Integer step) throws AsterixException { + public Void visit(TypeDecl t, Integer step) throws CompilationException { out.println(skip(step) + "create type " + generateFullName(t.getDataverseName(), t.getIdent()) + generateIfNotExists(t.getIfNotExists()) + " as"); t.getTypeDef().accept(this, step + 1); @@ -413,7 +413,7 @@ public class FormatPrintVisitor implements ILangVisitor { } @Override - public Void visit(TypeReferenceExpression t, Integer arg) throws AsterixException { + public Void visit(TypeReferenceExpression t, Integer arg) throws CompilationException { if (t.getIdent().first != null && t.getIdent().first.getValue() != null) { out.print(normalize(t.getIdent().first.getValue())); out.print('.'); @@ -423,7 +423,7 @@ public class FormatPrintVisitor implements ILangVisitor { } @Override - public Void visit(RecordTypeDefinition r, Integer step) throws AsterixException { + public Void visit(RecordTypeDefinition r, Integer step) throws CompilationException { if (r.getRecordKind() == RecordKind.CLOSED) { out.print(" closed "); } @@ -454,7 +454,7 @@ public class FormatPrintVisitor implements ILangVisitor { } @Override - public Void visit(OrderedListTypeDefinition x, Integer step) throws AsterixException { + public Void visit(OrderedListTypeDefinition x, Integer step) throws CompilationException { out.print("["); x.getItemTypeExpression().accept(this, step + 2); out.print("]"); @@ -462,7 +462,7 @@ public class FormatPrintVisitor implements ILangVisitor { } @Override - public Void visit(UnorderedListTypeDefinition x, Integer step) throws AsterixException { + public Void visit(UnorderedListTypeDefinition x, Integer step) throws CompilationException { out.print("{{"); x.getItemTypeExpression().accept(this, step + 2); out.print("}}"); @@ -470,7 +470,7 @@ public class FormatPrintVisitor implements ILangVisitor { } @Override - public Void visit(DatasetDecl dd, Integer step) throws AsterixException { + public Void visit(DatasetDecl dd, Integer step) throws CompilationException { if (dd.getDatasetType() == DatasetType.INTERNAL) { String temp = dd.getDatasetDetailsDecl().isTemp() ? "temporary" : ""; out.print(skip(step) + "create " + temp + datasetSymbol + generateFullName(dd.getDataverse(), dd.getName()) @@ -518,13 +518,13 @@ public class FormatPrintVisitor implements ILangVisitor { } @Override - public Void visit(DataverseDecl dv, Integer step) throws AsterixException { + public Void visit(DataverseDecl dv, Integer step) throws CompilationException { out.println(skip(step) + "use " + dataverseSymbol + normalize(dv.getDataverseName().getValue()) + ";\n\n"); return null; } @Override - public Void visit(WriteStatement ws, Integer step) throws AsterixException { + public Void visit(WriteStatement ws, Integer step) throws CompilationException { out.print(skip(step) + "write output to " + ws.getNcName() + ":" + revertStringToQuoted(ws.getFileName())); if (ws.getWriterClassName() != null) { out.print(" using " + ws.getWriterClassName()); @@ -534,21 +534,21 @@ public class FormatPrintVisitor implements ILangVisitor { } @Override - public Void visit(SetStatement ss, Integer step) throws AsterixException { + public Void visit(SetStatement ss, Integer step) throws CompilationException { out.println(skip(step) + "set " + revertStringToQuoted(ss.getPropName()) + " " + revertStringToQuoted(ss.getPropValue()) + ";\n"); return null; } @Override - public Void visit(DisconnectFeedStatement ss, Integer step) throws AsterixException { + public Void visit(DisconnectFeedStatement ss, Integer step) throws CompilationException { out.println(skip(step) + "disconnect " + FEED + generateFullName(ss.getDataverseName(), ss.getFeedName()) + " from " + datasetSymbol + generateFullName(ss.getDataverseName(), ss.getDatasetName()) + ";"); return null; } @Override - public Void visit(NodegroupDecl ngd, Integer step) throws AsterixException { + public Void visit(NodegroupDecl ngd, Integer step) throws CompilationException { out.println( CREATE + " nodegroup " + ngd.getNodegroupName() + generateIfNotExists(ngd.getIfNotExists()) + " on "); out.print(skip(step + 2)); @@ -559,7 +559,7 @@ public class FormatPrintVisitor implements ILangVisitor { } @Override - public Void visit(LoadStatement stmtLoad, Integer step) throws AsterixException { + public Void visit(LoadStatement stmtLoad, Integer step) throws CompilationException { out.print(skip(step) + "load " + datasetSymbol + generateFullName(stmtLoad.getDataverseName(), stmtLoad.getDatasetName()) + " using " + revertStringToQuoted(stmtLoad.getAdapter()) + " "); @@ -570,7 +570,7 @@ public class FormatPrintVisitor implements ILangVisitor { } @Override - public Void visit(DropDatasetStatement del, Integer step) throws AsterixException { + public Void visit(DropDatasetStatement del, Integer step) throws CompilationException { out.println( skip(step) + "drop " + datasetSymbol + generateFullName(del.getDataverseName(), del.getDatasetName()) + generateIfExists(del.getIfExists()) + SEMICOLON); @@ -578,7 +578,7 @@ public class FormatPrintVisitor implements ILangVisitor { } @Override - public Void visit(InsertStatement insert, Integer step) throws AsterixException { + public Void visit(InsertStatement insert, Integer step) throws CompilationException { out.print(skip(step) + "insert into " + datasetSymbol + generateFullName(insert.getDataverseName(), insert.getDatasetName())); out.print("("); @@ -589,7 +589,7 @@ public class FormatPrintVisitor implements ILangVisitor { } @Override - public Void visit(DeleteStatement del, Integer step) throws AsterixException { + public Void visit(DeleteStatement del, Integer step) throws CompilationException { out.print(skip(step) + "delete "); del.getVariableExpr().accept(this, step + 2); out.println( @@ -603,7 +603,7 @@ public class FormatPrintVisitor implements ILangVisitor { } @Override - public Void visit(UpdateStatement update, Integer step) throws AsterixException { + public Void visit(UpdateStatement update, Integer step) throws CompilationException { out.println(skip(step) + "update "); update.getVariableExpr().accept(this, step + 2); out.print(" in "); @@ -623,7 +623,7 @@ public class FormatPrintVisitor implements ILangVisitor { } @Override - public Void visit(UpdateClause del, Integer step) throws AsterixException { + public Void visit(UpdateClause del, Integer step) throws CompilationException { if (del.hasSet()) { out.println(skip(step) + "set "); del.getTarget().accept(this, step + 2); @@ -654,7 +654,7 @@ public class FormatPrintVisitor implements ILangVisitor { } @Override - public Void visit(CreateIndexStatement cis, Integer step) throws AsterixException { + public Void visit(CreateIndexStatement cis, Integer step) throws CompilationException { out.print(skip(step) + CREATE + " index "); out.print(normalize(cis.getIndexName().getValue()) + " "); out.print(generateIfNotExists(cis.getIfNotExists())); @@ -691,7 +691,7 @@ public class FormatPrintVisitor implements ILangVisitor { } @Override - public Void visit(CreateDataverseStatement del, Integer step) throws AsterixException { + public Void visit(CreateDataverseStatement del, Integer step) throws CompilationException { out.print(CREATE + dataverseSymbol); out.print(normalize(del.getDataverseName().getValue())); out.print(generateIfNotExists(del.getIfNotExists())); @@ -706,7 +706,7 @@ public class FormatPrintVisitor implements ILangVisitor { } @Override - public Void visit(IndexDropStatement del, Integer step) throws AsterixException { + public Void visit(IndexDropStatement del, Integer step) throws CompilationException { out.print(skip(step) + "drop index "); out.print(generateFullName(del.getDataverseName(), del.getDatasetName())); out.print("." + del.getIndexName()); @@ -715,7 +715,7 @@ public class FormatPrintVisitor implements ILangVisitor { } @Override - public Void visit(NodeGroupDropStatement del, Integer step) throws AsterixException { + public Void visit(NodeGroupDropStatement del, Integer step) throws CompilationException { out.print(skip(step) + "drop nodegroup "); out.print(del.getNodeGroupName()); out.println(generateIfExists(del.getIfExists()) + SEMICOLON); @@ -723,7 +723,7 @@ public class FormatPrintVisitor implements ILangVisitor { } @Override - public Void visit(DataverseDropStatement del, Integer step) throws AsterixException { + public Void visit(DataverseDropStatement del, Integer step) throws CompilationException { out.print(skip(step) + "drop " + dataverseSymbol); out.print(normalize(del.getDataverseName().getValue())); out.println(generateIfExists(del.getIfExists()) + SEMICOLON); @@ -731,7 +731,7 @@ public class FormatPrintVisitor implements ILangVisitor { } @Override - public Void visit(TypeDropStatement del, Integer step) throws AsterixException { + public Void visit(TypeDropStatement del, Integer step) throws CompilationException { out.print(skip(step) + "drop type "); out.print(generateFullName(del.getDataverseName(), del.getTypeName())); out.println(generateIfExists(del.getIfExists()) + SEMICOLON); @@ -739,7 +739,7 @@ public class FormatPrintVisitor implements ILangVisitor { } @Override - public Void visit(ConnectFeedStatement connectFeedStmt, Integer step) throws AsterixException { + public Void visit(ConnectFeedStatement connectFeedStmt, Integer step) throws CompilationException { out.print(skip(step) + "connect " + FEED); out.print(generateFullName(connectFeedStmt.getDataverseName(), new Identifier(connectFeedStmt.getFeedName()))); out.print(" to " + datasetSymbol @@ -752,7 +752,7 @@ public class FormatPrintVisitor implements ILangVisitor { } @Override - public Void visit(CreatePrimaryFeedStatement cpfs, Integer step) throws AsterixException { + public Void visit(CreatePrimaryFeedStatement cpfs, Integer step) throws CompilationException { out.print(skip(step) + CREATE + " primary feed "); out.print(generateFullName(cpfs.getDataverseName(), cpfs.getFeedName())); out.print(generateIfNotExists(cpfs.getIfNotExists())); @@ -767,7 +767,7 @@ public class FormatPrintVisitor implements ILangVisitor { } @Override - public Void visit(CreateSecondaryFeedStatement csfs, Integer step) throws AsterixException { + public Void visit(CreateSecondaryFeedStatement csfs, Integer step) throws CompilationException { out.print(skip(step) + CREATE + " secondary feed "); out.print(generateFullName(csfs.getDataverseName(), csfs.getFeedName())); out.print(generateIfNotExists(csfs.getIfNotExists())); @@ -781,7 +781,7 @@ public class FormatPrintVisitor implements ILangVisitor { } @Override - public Void visit(FeedDropStatement del, Integer step) throws AsterixException { + public Void visit(FeedDropStatement del, Integer step) throws CompilationException { out.print(skip(step) + "drop " + FEED); out.print(generateFullName(del.getDataverseName(), del.getFeedName())); out.println(generateIfExists(del.getIfExists()) + SEMICOLON); @@ -789,12 +789,12 @@ public class FormatPrintVisitor implements ILangVisitor { } @Override - public Void visit(FeedPolicyDropStatement dfs, Integer step) throws AsterixException { + public Void visit(FeedPolicyDropStatement dfs, Integer step) throws CompilationException { return null; } @Override - public Void visit(CreateFeedPolicyStatement cfps, Integer step) throws AsterixException { + public Void visit(CreateFeedPolicyStatement cfps, Integer step) throws CompilationException { out.print(skip(step) + CREATE + "ingestion policy "); out.print(cfps.getPolicyName()); out.print(generateIfNotExists(cfps.getIfNotExists())); @@ -820,7 +820,7 @@ public class FormatPrintVisitor implements ILangVisitor { } @Override - public Void visit(CreateFunctionStatement cfs, Integer step) throws AsterixException { + public Void visit(CreateFunctionStatement cfs, Integer step) throws CompilationException { out.print(skip(step) + CREATE + " function "); out.print(generateIfNotExists(cfs.getIfNotExists())); out.print(this.generateFullName(cfs.getSignature().getNamespace(), cfs.getSignature().getName())); @@ -834,7 +834,7 @@ public class FormatPrintVisitor implements ILangVisitor { } @Override - public Void visit(FunctionDropStatement del, Integer step) throws AsterixException { + public Void visit(FunctionDropStatement del, Integer step) throws CompilationException { out.print(skip(step) + "drop function "); FunctionSignature funcSignature = del.getFunctionSignature(); out.print(funcSignature.toString()); @@ -843,7 +843,7 @@ public class FormatPrintVisitor implements ILangVisitor { } @Override - public Void visit(CompactStatement del, Integer step) throws AsterixException { + public Void visit(CompactStatement del, Integer step) throws CompilationException { return null; } @@ -883,7 +883,7 @@ public class FormatPrintVisitor implements ILangVisitor { } protected void printDelimitedGbyExpressions(List gbyList, int step) - throws AsterixException { + throws CompilationException { int gbySize = gbyList.size(); int gbyIndex = 0; for (GbyVariableExpressionPair pair : gbyList) { @@ -899,7 +899,7 @@ public class FormatPrintVisitor implements ILangVisitor { } protected void printDelimitedExpressions(List exprs, String delimiter, int step) - throws AsterixException { + throws CompilationException { int index = 0; int size = exprs.size(); for (Expression expr : exprs) { http://git-wip-us.apache.org/repos/asf/asterixdb/blob/e65e6ca4/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/visitor/GatherFunctionCallsVisitor.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/visitor/GatherFunctionCallsVisitor.java b/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/visitor/GatherFunctionCallsVisitor.java index 12c95bb..8842d86 100644 --- a/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/visitor/GatherFunctionCallsVisitor.java +++ b/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/visitor/GatherFunctionCallsVisitor.java @@ -22,7 +22,7 @@ package org.apache.asterix.lang.common.visitor; import java.util.HashSet; import java.util.Set; -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; @@ -56,7 +56,7 @@ public class GatherFunctionCallsVisitor extends AbstractQueryExpressionVisitor calls = new HashSet(); @Override - public Void visit(CallExpr pf, Void arg) throws AsterixException { + public Void visit(CallExpr pf, Void arg) throws CompilationException { calls.add(pf.getFunctionSignature()); for (Expression e : pf.getExprList()) { e.accept(this, arg); @@ -65,13 +65,13 @@ public class GatherFunctionCallsVisitor extends AbstractQueryExpressionVisitor exprList = ifbo.getExprList(); List opList = ifbo.getOpList(); if (ifbo.isCurrentop()) { @@ -173,7 +173,7 @@ public class QueryPrintVisitor extends AbstractQueryExpressionVisitor mlist = oc.getModifierList(); List list = oc.getOrderbyList(); @@ -233,7 +233,7 @@ public class QueryPrintVisitor extends AbstractQueryExpressionVisitor"); @@ -390,7 +390,7 @@ public class QueryPrintVisitor extends AbstractQueryExpressionVisitor