asterixdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dl...@apache.org
Subject asterixdb git commit: [NO ISSUE][COMP] Expression cleanup
Date Mon, 20 Nov 2017 21:08:13 GMT
Repository: asterixdb
Updated Branches:
  refs/heads/master fae8224e2 -> f9fe6dda8


[NO ISSUE][COMP] Expression cleanup

- user model changes: no
- storage format changes: no
- interface changes: no

Details:
- Remove unused IndependentSubquery expression
- Make all expressions extend AbstractExpression
- Cleanup QueryPrintVisitor and subclasses

Change-Id: Ib5f9f06b313cde52033b59c1bf74a38b7e22588a
Reviewed-on: https://asterix-gerrit.ics.uci.edu/2164
Sonar-Qube: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Contrib: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Integration-Tests: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Reviewed-by: Till Westmann <tillw@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/asterixdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/asterixdb/commit/f9fe6dda
Tree: http://git-wip-us.apache.org/repos/asf/asterixdb/tree/f9fe6dda
Diff: http://git-wip-us.apache.org/repos/asf/asterixdb/diff/f9fe6dda

Branch: refs/heads/master
Commit: f9fe6dda8e68aaa68d39936f1d184dd7c7d0579b
Parents: fae8224
Author: Dmitry Lychagin <dmitry.lychagin@couchbase.com>
Authored: Sat Nov 18 10:21:19 2017 -0800
Committer: Dmitry Lychagin <dmitry.lychagin@couchbase.com>
Committed: Mon Nov 20 13:07:49 2017 -0800

----------------------------------------------------------------------
 .../LangExpressionToPlanTranslator.java         |  2 +-
 .../SqlppExpressionToPlanTranslator.java        | 12 ----
 .../lang/aql/expression/FLWOGRExpression.java   |  3 +-
 .../asterix/lang/aql/expression/UnionExpr.java  |  5 +-
 .../lang/aql/visitor/AQLAstPrintVisitor.java    |  8 ---
 .../lang/aql/visitor/AQLFormatPrintVisitor.java |  9 ---
 .../lang/common/base/AbstractExpression.java    |  2 +-
 .../asterix/lang/common/base/Expression.java    |  6 +-
 .../common/expression/AbstractAccessor.java     |  3 +-
 .../asterix/lang/common/expression/IfExpr.java  |  3 +-
 .../lang/common/expression/ListConstructor.java |  3 +-
 .../lang/common/expression/LiteralExpr.java     |  5 +-
 .../lang/common/expression/OperatorExpr.java    |  3 +-
 .../common/expression/QuantifiedExpression.java |  3 +-
 .../common/expression/RecordConstructor.java    |  4 +-
 .../lang/common/expression/UnaryExpr.java       |  3 +-
 .../lang/common/expression/VariableExpr.java    |  4 +-
 .../lang/common/visitor/FormatPrintVisitor.java | 12 ++--
 .../lang/common/visitor/QueryPrintVisitor.java  | 14 ++--
 .../lang/sqlpp/expression/CaseExpression.java   |  4 +-
 .../sqlpp/expression/IndependentSubquery.java   | 74 --------------------
 .../lang/sqlpp/expression/SelectExpression.java |  4 +-
 .../lang/sqlpp/rewrites/SqlppQueryRewriter.java |  7 --
 .../visitor/SqlppInlineUdfsVisitor.java         |  9 ---
 .../CheckDatasetOnlyResolutionVisitor.java      |  6 --
 .../visitor/CheckSql92AggregateVisitor.java     |  6 --
 .../sqlpp/visitor/CheckSubqueryVisitor.java     |  6 --
 .../lang/sqlpp/visitor/DeepCopyVisitor.java     |  6 --
 .../lang/sqlpp/visitor/FreeVariableVisitor.java |  8 ---
 .../sqlpp/visitor/SqlppAstPrintVisitor.java     | 15 ----
 ...SqlppCloneAndSubstituteVariablesVisitor.java |  9 ---
 .../sqlpp/visitor/SqlppFormatPrintVisitor.java  | 14 ----
 .../visitor/base/AbstractSqlppAstVisitor.java   |  6 --
 .../AbstractSqlppExpressionScopingVisitor.java  | 13 ----
 .../AbstractSqlppSimpleExpressionVisitor.java   |  7 --
 .../lang/sqlpp/visitor/base/ISqlppVisitor.java  |  3 -
 36 files changed, 39 insertions(+), 262 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/asterixdb/blob/f9fe6dda/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/translator/LangExpressionToPlanTranslator.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/translator/LangExpressionToPlanTranslator.java b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/translator/LangExpressionToPlanTranslator.java
index 4579e6f..719824b 100644
--- a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/translator/LangExpressionToPlanTranslator.java
+++ b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/translator/LangExpressionToPlanTranslator.java
@@ -1366,7 +1366,7 @@ class LangExpressionToPlanTranslator
                 || k == Kind.FIELD_ACCESSOR_EXPRESSION;
         noNesting = noNesting || k == Kind.INDEX_ACCESSOR_EXPRESSION || k == Kind.UNARY_EXPRESSION
                 || k == Kind.IF_EXPRESSION;
-        return noNesting || k == Kind.INDEPENDENT_SUBQUERY || k == Kind.CASE_EXPRESSION;
+        return noNesting || k == Kind.CASE_EXPRESSION;
 
     }
 

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/f9fe6dda/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/translator/SqlppExpressionToPlanTranslator.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/translator/SqlppExpressionToPlanTranslator.java b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/translator/SqlppExpressionToPlanTranslator.java
index d37c7af..c17b55b 100644
--- a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/translator/SqlppExpressionToPlanTranslator.java
+++ b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/translator/SqlppExpressionToPlanTranslator.java
@@ -54,7 +54,6 @@ import org.apache.asterix.lang.sqlpp.clause.SelectRegular;
 import org.apache.asterix.lang.sqlpp.clause.SelectSetOperation;
 import org.apache.asterix.lang.sqlpp.clause.UnnestClause;
 import org.apache.asterix.lang.sqlpp.expression.CaseExpression;
-import org.apache.asterix.lang.sqlpp.expression.IndependentSubquery;
 import org.apache.asterix.lang.sqlpp.expression.SelectExpression;
 import org.apache.asterix.lang.sqlpp.optype.JoinType;
 import org.apache.asterix.lang.sqlpp.optype.SetOpType;
@@ -169,17 +168,6 @@ class SqlppExpressionToPlanTranslator extends LangExpressionToPlanTranslator imp
     }
 
     @Override
-    public Pair<ILogicalOperator, LogicalVariable> visit(IndependentSubquery independentSubquery,
-            Mutable<ILogicalOperator> tupleSource) throws CompilationException {
-        Pair<ILogicalExpression, Mutable<ILogicalOperator>> eo =
-                langExprToAlgExpression(independentSubquery.getExpr(), tupleSource);
-        LogicalVariable var = context.newVar();
-        AssignOperator assignOp = new AssignOperator(var, new MutableObject<ILogicalExpression>(eo.first));
-        assignOp.getInputs().add(eo.second);
-        return new Pair<>(assignOp, var);
-    }
-
-    @Override
     public Pair<ILogicalOperator, LogicalVariable> visit(SelectSetOperation selectSetOperation,
             Mutable<ILogicalOperator> tupSource) throws CompilationException {
         SetOperationInput leftInput = selectSetOperation.getLeftInput();

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/f9fe6dda/asterixdb/asterix-lang-aql/src/main/java/org/apache/asterix/lang/aql/expression/FLWOGRExpression.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-lang-aql/src/main/java/org/apache/asterix/lang/aql/expression/FLWOGRExpression.java b/asterixdb/asterix-lang-aql/src/main/java/org/apache/asterix/lang/aql/expression/FLWOGRExpression.java
index 10143f2..54fd8cf 100644
--- a/asterixdb/asterix-lang-aql/src/main/java/org/apache/asterix/lang/aql/expression/FLWOGRExpression.java
+++ b/asterixdb/asterix-lang-aql/src/main/java/org/apache/asterix/lang/aql/expression/FLWOGRExpression.java
@@ -22,12 +22,13 @@ import java.util.List;
 
 import org.apache.asterix.common.exceptions.CompilationException;
 import org.apache.asterix.lang.aql.visitor.base.IAQLVisitor;
+import org.apache.asterix.lang.common.base.AbstractExpression;
 import org.apache.asterix.lang.common.base.Clause;
 import org.apache.asterix.lang.common.base.Clause.ClauseType;
 import org.apache.asterix.lang.common.base.Expression;
 import org.apache.asterix.lang.common.visitor.base.ILangVisitor;
 
-public class FLWOGRExpression implements Expression {
+public class FLWOGRExpression extends AbstractExpression {
     private List<Clause> clauseList;
     private Expression returnExpr;
 

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/f9fe6dda/asterixdb/asterix-lang-aql/src/main/java/org/apache/asterix/lang/aql/expression/UnionExpr.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-lang-aql/src/main/java/org/apache/asterix/lang/aql/expression/UnionExpr.java b/asterixdb/asterix-lang-aql/src/main/java/org/apache/asterix/lang/aql/expression/UnionExpr.java
index 133cb46..bb29762 100644
--- a/asterixdb/asterix-lang-aql/src/main/java/org/apache/asterix/lang/aql/expression/UnionExpr.java
+++ b/asterixdb/asterix-lang-aql/src/main/java/org/apache/asterix/lang/aql/expression/UnionExpr.java
@@ -23,15 +23,16 @@ import java.util.List;
 
 import org.apache.asterix.common.exceptions.CompilationException;
 import org.apache.asterix.lang.aql.visitor.base.IAQLVisitor;
+import org.apache.asterix.lang.common.base.AbstractExpression;
 import org.apache.asterix.lang.common.base.Expression;
 import org.apache.asterix.lang.common.visitor.base.ILangVisitor;
 
-public class UnionExpr implements Expression {
+public class UnionExpr extends AbstractExpression {
 
     private List<Expression> exprs;
 
     public UnionExpr() {
-        exprs = new ArrayList<Expression>();
+        exprs = new ArrayList<>();
     }
 
     public UnionExpr(List<Expression> exprs) {

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/f9fe6dda/asterixdb/asterix-lang-aql/src/main/java/org/apache/asterix/lang/aql/visitor/AQLAstPrintVisitor.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-lang-aql/src/main/java/org/apache/asterix/lang/aql/visitor/AQLAstPrintVisitor.java b/asterixdb/asterix-lang-aql/src/main/java/org/apache/asterix/lang/aql/visitor/AQLAstPrintVisitor.java
index 1f76f75..0c34b83 100644
--- a/asterixdb/asterix-lang-aql/src/main/java/org/apache/asterix/lang/aql/visitor/AQLAstPrintVisitor.java
+++ b/asterixdb/asterix-lang-aql/src/main/java/org/apache/asterix/lang/aql/visitor/AQLAstPrintVisitor.java
@@ -32,16 +32,8 @@ import org.apache.asterix.lang.common.visitor.QueryPrintVisitor;
 
 class AQLAstPrintVisitor extends QueryPrintVisitor implements IAQLVisitor<Void, Integer> {
 
-    private final PrintWriter out;
-
-    public AQLAstPrintVisitor() {
-        super();
-        out = new PrintWriter(System.out);
-    }
-
     public AQLAstPrintVisitor(PrintWriter out) {
         super(out);
-        this.out = out;
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/f9fe6dda/asterixdb/asterix-lang-aql/src/main/java/org/apache/asterix/lang/aql/visitor/AQLFormatPrintVisitor.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-lang-aql/src/main/java/org/apache/asterix/lang/aql/visitor/AQLFormatPrintVisitor.java b/asterixdb/asterix-lang-aql/src/main/java/org/apache/asterix/lang/aql/visitor/AQLFormatPrintVisitor.java
index a12f089..eea398f 100644
--- a/asterixdb/asterix-lang-aql/src/main/java/org/apache/asterix/lang/aql/visitor/AQLFormatPrintVisitor.java
+++ b/asterixdb/asterix-lang-aql/src/main/java/org/apache/asterix/lang/aql/visitor/AQLFormatPrintVisitor.java
@@ -31,16 +31,8 @@ import org.apache.asterix.lang.common.visitor.FormatPrintVisitor;
 
 public class AQLFormatPrintVisitor extends FormatPrintVisitor implements IAQLVisitor<Void, Integer> {
 
-    private final PrintWriter out;
-
-    public AQLFormatPrintVisitor() {
-        super();
-        out = new PrintWriter(System.out);
-    }
-
     public AQLFormatPrintVisitor(PrintWriter out) {
         super(out);
-        this.out = out;
     }
 
     @Override
@@ -80,5 +72,4 @@ public class AQLFormatPrintVisitor extends FormatPrintVisitor implements IAQLVis
         out.println();
         return null;
     }
-
 }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/f9fe6dda/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/base/AbstractExpression.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/base/AbstractExpression.java b/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/base/AbstractExpression.java
index 536b195..44a05ef 100644
--- a/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/base/AbstractExpression.java
+++ b/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/base/AbstractExpression.java
@@ -28,7 +28,7 @@ public abstract class AbstractExpression implements Expression {
 
     public void addHint(IExpressionAnnotation hint) {
         if (hints == null) {
-            hints = new ArrayList<IExpressionAnnotation>();
+            hints = new ArrayList<>();
         }
         hints.add(hint);
     }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/f9fe6dda/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/base/Expression.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/base/Expression.java b/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/base/Expression.java
index 7da34fe..3afff76 100644
--- a/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/base/Expression.java
+++ b/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/base/Expression.java
@@ -19,9 +19,9 @@
 package org.apache.asterix.lang.common.base;
 
 public interface Expression extends ILangExpression {
-    public abstract Kind getKind();
+    Kind getKind();
 
-    public enum Kind {
+    enum Kind {
         LITERAL_EXPRESSION,
         FLWOGR_EXPRESSION,
         IF_EXPRESSION,
@@ -38,8 +38,6 @@ public interface Expression extends ILangExpression {
         UNION_EXPRESSION,
         SELECT_EXPRESSION,
         PRIMARY_EXPRESSION,
-        INDEPENDENT_SUBQUERY,
         CASE_EXPRESSION
     }
-
 }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/f9fe6dda/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/expression/AbstractAccessor.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/expression/AbstractAccessor.java b/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/expression/AbstractAccessor.java
index 2b7b748..eb35c9c 100644
--- a/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/expression/AbstractAccessor.java
+++ b/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/expression/AbstractAccessor.java
@@ -18,10 +18,11 @@
  */
 package org.apache.asterix.lang.common.expression;
 
+import org.apache.asterix.lang.common.base.AbstractExpression;
 import org.apache.asterix.lang.common.base.Expression;
 import org.apache.commons.lang.ObjectUtils;
 
-public abstract class AbstractAccessor implements Expression {
+public abstract class AbstractAccessor extends AbstractExpression {
     protected Expression expr;
 
     public AbstractAccessor(Expression expr) {

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/f9fe6dda/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/expression/IfExpr.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/expression/IfExpr.java b/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/expression/IfExpr.java
index 26b9c83..c833109 100644
--- a/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/expression/IfExpr.java
+++ b/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/expression/IfExpr.java
@@ -19,11 +19,12 @@
 package org.apache.asterix.lang.common.expression;
 
 import org.apache.asterix.common.exceptions.CompilationException;
+import org.apache.asterix.lang.common.base.AbstractExpression;
 import org.apache.asterix.lang.common.base.Expression;
 import org.apache.asterix.lang.common.visitor.base.ILangVisitor;
 import org.apache.commons.lang3.ObjectUtils;
 
-public class IfExpr implements Expression {
+public class IfExpr extends AbstractExpression {
     private Expression condExpr;
     private Expression thenExpr;
     private Expression elseExpr;

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/f9fe6dda/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/expression/ListConstructor.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/expression/ListConstructor.java b/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/expression/ListConstructor.java
index 9a6d3f6..2a527d5 100644
--- a/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/expression/ListConstructor.java
+++ b/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/expression/ListConstructor.java
@@ -21,11 +21,12 @@ package org.apache.asterix.lang.common.expression;
 import java.util.List;
 
 import org.apache.asterix.common.exceptions.CompilationException;
+import org.apache.asterix.lang.common.base.AbstractExpression;
 import org.apache.asterix.lang.common.base.Expression;
 import org.apache.asterix.lang.common.visitor.base.ILangVisitor;
 import org.apache.commons.lang3.ObjectUtils;
 
-public class ListConstructor implements Expression {
+public class ListConstructor extends AbstractExpression {
     private List<Expression> exprList;
     private Type type;
 

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/f9fe6dda/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/expression/LiteralExpr.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/expression/LiteralExpr.java b/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/expression/LiteralExpr.java
index 600a82c..095f098 100644
--- a/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/expression/LiteralExpr.java
+++ b/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/expression/LiteralExpr.java
@@ -19,12 +19,12 @@
 package org.apache.asterix.lang.common.expression;
 
 import org.apache.asterix.common.exceptions.CompilationException;
-import org.apache.asterix.lang.common.base.Expression;
+import org.apache.asterix.lang.common.base.AbstractExpression;
 import org.apache.asterix.lang.common.base.Literal;
 import org.apache.asterix.lang.common.visitor.base.ILangVisitor;
 import org.apache.commons.lang3.ObjectUtils;
 
-public class LiteralExpr implements Expression {
+public class LiteralExpr extends AbstractExpression {
     private Literal value;
 
     public LiteralExpr() {
@@ -69,5 +69,4 @@ public class LiteralExpr implements Expression {
         LiteralExpr target = (LiteralExpr) object;
         return ObjectUtils.equals(value, target.value);
     }
-
 }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/f9fe6dda/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/expression/OperatorExpr.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/expression/OperatorExpr.java b/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/expression/OperatorExpr.java
index ff10895..b35aa91 100644
--- a/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/expression/OperatorExpr.java
+++ b/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/expression/OperatorExpr.java
@@ -20,7 +20,6 @@ package org.apache.asterix.lang.common.expression;
 
 import java.util.ArrayList;
 import java.util.List;
-import java.util.Optional;
 
 import org.apache.asterix.common.exceptions.CompilationException;
 import org.apache.asterix.lang.common.base.AbstractExpression;
@@ -33,7 +32,7 @@ public class OperatorExpr extends AbstractExpression {
     private List<Expression> exprList;
     private List<OperatorType> opList;
     private List<Integer> exprBroadcastIdx;
-    private boolean currentop = false;
+    private boolean currentop;
 
     public OperatorExpr() {
         super();

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/f9fe6dda/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/expression/QuantifiedExpression.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/expression/QuantifiedExpression.java b/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/expression/QuantifiedExpression.java
index 40322d7..2a42da4 100644
--- a/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/expression/QuantifiedExpression.java
+++ b/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/expression/QuantifiedExpression.java
@@ -21,12 +21,13 @@ package org.apache.asterix.lang.common.expression;
 import java.util.List;
 
 import org.apache.asterix.common.exceptions.CompilationException;
+import org.apache.asterix.lang.common.base.AbstractExpression;
 import org.apache.asterix.lang.common.base.Expression;
 import org.apache.asterix.lang.common.struct.QuantifiedPair;
 import org.apache.asterix.lang.common.visitor.base.ILangVisitor;
 import org.apache.commons.lang3.ObjectUtils;
 
-public class QuantifiedExpression implements Expression {
+public class QuantifiedExpression extends AbstractExpression {
     private List<QuantifiedPair> quantifiedList;
     private Expression satisfiesExpr;
     private Quantifier quantifier;

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/f9fe6dda/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/expression/RecordConstructor.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/expression/RecordConstructor.java b/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/expression/RecordConstructor.java
index 6b17461..1aa8ff1 100644
--- a/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/expression/RecordConstructor.java
+++ b/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/expression/RecordConstructor.java
@@ -21,11 +21,11 @@ package org.apache.asterix.lang.common.expression;
 import java.util.List;
 
 import org.apache.asterix.common.exceptions.CompilationException;
-import org.apache.asterix.lang.common.base.Expression;
+import org.apache.asterix.lang.common.base.AbstractExpression;
 import org.apache.asterix.lang.common.visitor.base.ILangVisitor;
 import org.apache.commons.lang3.ObjectUtils;
 
-public class RecordConstructor implements Expression {
+public class RecordConstructor extends AbstractExpression {
     private List<FieldBinding> fbList;
 
     public RecordConstructor() {

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/f9fe6dda/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/expression/UnaryExpr.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/expression/UnaryExpr.java b/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/expression/UnaryExpr.java
index 99197c6..f341601 100644
--- a/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/expression/UnaryExpr.java
+++ b/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/expression/UnaryExpr.java
@@ -21,12 +21,13 @@ package org.apache.asterix.lang.common.expression;
 import java.util.Optional;
 
 import org.apache.asterix.common.exceptions.CompilationException;
+import org.apache.asterix.lang.common.base.AbstractExpression;
 import org.apache.asterix.lang.common.base.Expression;
 import org.apache.asterix.lang.common.struct.UnaryExprType;
 import org.apache.asterix.lang.common.visitor.base.ILangVisitor;
 import org.apache.commons.lang3.ObjectUtils;
 
-public class UnaryExpr implements Expression {
+public class UnaryExpr extends AbstractExpression {
     private UnaryExprType unaryExprType;
     private Expression expr;
 

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/f9fe6dda/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/expression/VariableExpr.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/expression/VariableExpr.java b/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/expression/VariableExpr.java
index 8fcd2ad..e55e40d 100644
--- a/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/expression/VariableExpr.java
+++ b/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/expression/VariableExpr.java
@@ -19,12 +19,12 @@
 package org.apache.asterix.lang.common.expression;
 
 import org.apache.asterix.common.exceptions.CompilationException;
-import org.apache.asterix.lang.common.base.Expression;
+import org.apache.asterix.lang.common.base.AbstractExpression;
 import org.apache.asterix.lang.common.struct.VarIdentifier;
 import org.apache.asterix.lang.common.visitor.base.ILangVisitor;
 import org.apache.commons.lang3.ObjectUtils;
 
-public class VariableExpr implements Expression {
+public class VariableExpr extends AbstractExpression {
     private VarIdentifier var;
     private boolean isNewVar;
 

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/f9fe6dda/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 c74ee5d..5a3a530 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
@@ -108,17 +108,13 @@ public class FormatPrintVisitor implements ILangVisitor<Void, Integer> {
     private final static String CREATE = "create ";
     private final static String FEED = " feed ";
     private final static String DEFAULT_DATAVERSE_FORMAT = "org.apache.asterix.runtime.formats.NonTaggedDataFormat";
-    private final PrintWriter out;
+    protected final PrintWriter out;
     protected Set<Character> validIdentifierChars = new HashSet<Character>();
     protected Set<Character> validIdentifierStartChars = new HashSet<Character>();
     protected String dataverseSymbol = " dataverse ";
     protected String datasetSymbol = " dataset ";
     protected String assignSymbol = ":=";
 
-    public FormatPrintVisitor() {
-        this(new PrintWriter(System.out));
-    }
-
     public FormatPrintVisitor(PrintWriter out) {
         this.out = out;
         for (char ch = 'a'; ch <= 'z'; ++ch) {
@@ -137,7 +133,7 @@ public class FormatPrintVisitor implements ILangVisitor<Void, Integer> {
     }
 
     protected String skip(int step) {
-        StringBuffer sb = new StringBuffer();
+        StringBuilder sb = new StringBuilder();
         for (int i = 0; i < step; i++) {
             sb.append("  ");
         }
@@ -190,9 +186,9 @@ public class FormatPrintVisitor implements ILangVisitor<Void, Integer> {
         if (lc.getType().equals(ListConstructor.Type.ORDERED_LIST_CONSTRUCTOR)) {
             ordered = true;
         }
-        out.print(ordered == true ? "[" : "{{");
+        out.print(ordered ? "[" : "{{");
         printDelimitedExpressions(lc.getExprList(), COMMA, step + 2);
-        out.print(ordered == true ? "]" : "}}");
+        out.print(ordered ? "]" : "}}");
         return null;
     }
 

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/f9fe6dda/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/visitor/QueryPrintVisitor.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/visitor/QueryPrintVisitor.java b/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/visitor/QueryPrintVisitor.java
index 5e01321..ff55880 100644
--- a/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/visitor/QueryPrintVisitor.java
+++ b/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/visitor/QueryPrintVisitor.java
@@ -65,19 +65,15 @@ import org.apache.asterix.lang.common.struct.OperatorType;
 import org.apache.asterix.lang.common.struct.QuantifiedPair;
 import org.apache.asterix.lang.common.visitor.base.AbstractQueryExpressionVisitor;
 
-public class QueryPrintVisitor extends AbstractQueryExpressionVisitor<Void, Integer> {
-    private final PrintWriter out;
+public abstract class QueryPrintVisitor extends AbstractQueryExpressionVisitor<Void, Integer> {
+    protected final PrintWriter out;
 
-    public QueryPrintVisitor() {
-        out = new PrintWriter(System.out);
-    }
-
-    public QueryPrintVisitor(PrintWriter out) {
+    protected QueryPrintVisitor(PrintWriter out) {
         this.out = out;
     }
 
     protected String skip(int step) {
-        StringBuffer sb = new StringBuffer();
+        StringBuilder sb = new StringBuilder();
         for (int i = 0; i < step; i++) {
             sb.append("  ");
         }
@@ -121,7 +117,7 @@ public class QueryPrintVisitor extends AbstractQueryExpressionVisitor<Void, Inte
             ordered = true;
         }
 
-        out.println(skip(step) + (ordered == true ? "OrderedListConstructor " : "UnorderedListConstructor ") + "[");
+        out.println(skip(step) + (ordered ? "OrderedListConstructor " : "UnorderedListConstructor ") + "[");
         for (Expression e : lc.getExprList()) {
             e.accept(this, step + 1);
         }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/f9fe6dda/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/expression/CaseExpression.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/expression/CaseExpression.java b/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/expression/CaseExpression.java
index 05300d1..7163e3c 100644
--- a/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/expression/CaseExpression.java
+++ b/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/expression/CaseExpression.java
@@ -23,6 +23,7 @@ import java.util.ArrayList;
 import java.util.List;
 
 import org.apache.asterix.common.exceptions.CompilationException;
+import org.apache.asterix.lang.common.base.AbstractExpression;
 import org.apache.asterix.lang.common.base.Expression;
 import org.apache.asterix.lang.common.expression.LiteralExpr;
 import org.apache.asterix.lang.common.literal.NullLiteral;
@@ -30,7 +31,7 @@ import org.apache.asterix.lang.common.visitor.base.ILangVisitor;
 import org.apache.asterix.lang.sqlpp.visitor.base.ISqlppVisitor;
 import org.apache.commons.lang3.ObjectUtils;
 
-public class CaseExpression implements Expression {
+public class CaseExpression extends AbstractExpression {
 
     private Expression conditionExpr;
     private List<Expression> whenExprs = new ArrayList<>();
@@ -125,5 +126,4 @@ public class CaseExpression implements Expression {
         return ObjectUtils.equals(conditionExpr, target.conditionExpr) && ObjectUtils.equals(elseExpr, target.elseExpr)
                 && ObjectUtils.equals(thenExprs, target.thenExprs) && ObjectUtils.equals(thenExprs, thenExprs);
     }
-
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/f9fe6dda/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/expression/IndependentSubquery.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/expression/IndependentSubquery.java b/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/expression/IndependentSubquery.java
deleted file mode 100644
index 24a6217..0000000
--- a/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/expression/IndependentSubquery.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.asterix.lang.sqlpp.expression;
-
-import org.apache.asterix.common.exceptions.CompilationException;
-import org.apache.asterix.lang.common.base.Expression;
-import org.apache.asterix.lang.common.visitor.base.ILangVisitor;
-import org.apache.asterix.lang.sqlpp.visitor.base.ISqlppVisitor;
-
-public class IndependentSubquery implements Expression {
-
-    private Expression expr;
-
-    public IndependentSubquery(Expression enclosedExpr) {
-        this.expr = enclosedExpr;
-    }
-
-    @Override
-    public <R, T> R accept(ILangVisitor<R, T> visitor, T arg) throws CompilationException {
-        return ((ISqlppVisitor<R, T>) visitor).visit(this, arg);
-    }
-
-    @Override
-    public Kind getKind() {
-        return Kind.INDEPENDENT_SUBQUERY;
-    }
-
-    public void setExpr(Expression expr) {
-        this.expr = expr;
-    }
-
-    public Expression getExpr() {
-        return this.expr;
-    }
-
-    @Override
-    public String toString() {
-        return String.valueOf(expr);
-    }
-
-    @Override
-    public int hashCode() {
-        return expr.hashCode();
-    }
-
-    @Override
-    public boolean equals(Object object) {
-        if (this == object) {
-            return true;
-        }
-        if (!(object instanceof IndependentSubquery)) {
-            return false;
-        }
-        IndependentSubquery target = (IndependentSubquery) object;
-        return this.expr.equals(target.getExpr());
-    }
-}

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/f9fe6dda/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/expression/SelectExpression.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/expression/SelectExpression.java b/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/expression/SelectExpression.java
index 0fb687a..16eab44 100644
--- a/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/expression/SelectExpression.java
+++ b/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/expression/SelectExpression.java
@@ -22,7 +22,7 @@ import java.util.ArrayList;
 import java.util.List;
 
 import org.apache.asterix.common.exceptions.CompilationException;
-import org.apache.asterix.lang.common.base.Expression;
+import org.apache.asterix.lang.common.base.AbstractExpression;
 import org.apache.asterix.lang.common.clause.LetClause;
 import org.apache.asterix.lang.common.clause.LimitClause;
 import org.apache.asterix.lang.common.clause.OrderbyClause;
@@ -31,7 +31,7 @@ import org.apache.asterix.lang.sqlpp.clause.SelectSetOperation;
 import org.apache.asterix.lang.sqlpp.visitor.base.ISqlppVisitor;
 import org.apache.commons.lang3.ObjectUtils;
 
-public class SelectExpression implements Expression {
+public class SelectExpression extends AbstractExpression {
 
     private List<LetClause> letList = new ArrayList<>();
     private SelectSetOperation selectSetOperation;

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/f9fe6dda/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/rewrites/SqlppQueryRewriter.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/rewrites/SqlppQueryRewriter.java b/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/rewrites/SqlppQueryRewriter.java
index 60ccea6..a2de694 100644
--- a/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/rewrites/SqlppQueryRewriter.java
+++ b/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/rewrites/SqlppQueryRewriter.java
@@ -46,7 +46,6 @@ import org.apache.asterix.lang.sqlpp.clause.SelectRegular;
 import org.apache.asterix.lang.sqlpp.clause.SelectSetOperation;
 import org.apache.asterix.lang.sqlpp.clause.UnnestClause;
 import org.apache.asterix.lang.sqlpp.expression.CaseExpression;
-import org.apache.asterix.lang.sqlpp.expression.IndependentSubquery;
 import org.apache.asterix.lang.sqlpp.expression.SelectExpression;
 import org.apache.asterix.lang.sqlpp.parser.FunctionParser;
 import org.apache.asterix.lang.sqlpp.parser.SqlppParserFactory;
@@ -384,12 +383,6 @@ class SqlppQueryRewriter implements IQueryRewriter {
         }
 
         @Override
-        public Void visit(IndependentSubquery independentSubquery, Void arg) throws CompilationException {
-            independentSubquery.getExpr().accept(this, arg);
-            return null;
-        }
-
-        @Override
         public Void visit(CaseExpression caseExpression, Void arg) throws CompilationException {
             caseExpression.getConditionExpr().accept(this, arg);
             for (Expression expr : caseExpression.getWhenExprs()) {

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/f9fe6dda/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/rewrites/visitor/SqlppInlineUdfsVisitor.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/rewrites/visitor/SqlppInlineUdfsVisitor.java b/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/rewrites/visitor/SqlppInlineUdfsVisitor.java
index 640b9b08..3bd29ef 100644
--- a/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/rewrites/visitor/SqlppInlineUdfsVisitor.java
+++ b/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/rewrites/visitor/SqlppInlineUdfsVisitor.java
@@ -43,7 +43,6 @@ import org.apache.asterix.lang.sqlpp.clause.SelectRegular;
 import org.apache.asterix.lang.sqlpp.clause.SelectSetOperation;
 import org.apache.asterix.lang.sqlpp.clause.UnnestClause;
 import org.apache.asterix.lang.sqlpp.expression.CaseExpression;
-import org.apache.asterix.lang.sqlpp.expression.IndependentSubquery;
 import org.apache.asterix.lang.sqlpp.expression.SelectExpression;
 import org.apache.asterix.lang.sqlpp.struct.SetOperationRight;
 import org.apache.asterix.lang.sqlpp.util.SqlppRewriteUtil;
@@ -226,14 +225,6 @@ public class SqlppInlineUdfsVisitor extends AbstractInlineUdfsVisitor
     }
 
     @Override
-    public Boolean visit(IndependentSubquery independentSubquery, List<FunctionDecl> funcs)
-            throws CompilationException {
-        Pair<Boolean, Expression> p = inlineUdfsInExpr(independentSubquery.getExpr(), funcs);
-        independentSubquery.setExpr(p.second);
-        return p.first;
-    }
-
-    @Override
     public Boolean visit(CaseExpression caseExpr, List<FunctionDecl> funcs) throws CompilationException {
         Pair<Boolean, Expression> result = inlineUdfsInExpr(caseExpr.getConditionExpr(), funcs);
         caseExpr.setConditionExpr(result.second);

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/f9fe6dda/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 cab7b5b..fe0c3a9 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
@@ -53,7 +53,6 @@ import org.apache.asterix.lang.sqlpp.clause.SelectRegular;
 import org.apache.asterix.lang.sqlpp.clause.SelectSetOperation;
 import org.apache.asterix.lang.sqlpp.clause.UnnestClause;
 import org.apache.asterix.lang.sqlpp.expression.CaseExpression;
-import org.apache.asterix.lang.sqlpp.expression.IndependentSubquery;
 import org.apache.asterix.lang.sqlpp.expression.SelectExpression;
 import org.apache.asterix.lang.sqlpp.visitor.base.AbstractSqlppQueryExpressionVisitor;
 
@@ -226,11 +225,6 @@ public class CheckDatasetOnlyResolutionVisitor extends AbstractSqlppQueryExpress
     }
 
     @Override
-    public Boolean visit(IndependentSubquery independentSubquery, ILangExpression arg) throws CompilationException {
-        return false;
-    }
-
-    @Override
     public Boolean visit(CaseExpression caseExpr, ILangExpression arg) throws CompilationException {
         return false;
     }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/f9fe6dda/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 1fd110c..cd91405 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
@@ -56,7 +56,6 @@ import org.apache.asterix.lang.sqlpp.clause.SelectRegular;
 import org.apache.asterix.lang.sqlpp.clause.SelectSetOperation;
 import org.apache.asterix.lang.sqlpp.clause.UnnestClause;
 import org.apache.asterix.lang.sqlpp.expression.CaseExpression;
-import org.apache.asterix.lang.sqlpp.expression.IndependentSubquery;
 import org.apache.asterix.lang.sqlpp.expression.SelectExpression;
 import org.apache.asterix.lang.sqlpp.util.FunctionMapUtil;
 import org.apache.asterix.lang.sqlpp.visitor.base.AbstractSqlppQueryExpressionVisitor;
@@ -270,11 +269,6 @@ public class CheckSql92AggregateVisitor extends AbstractSqlppQueryExpressionVisi
     }
 
     @Override
-    public Boolean visit(IndependentSubquery independentSubquery, ILangExpression arg) throws CompilationException {
-        return false;
-    }
-
-    @Override
     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/f9fe6dda/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 7f93b2f..c53d8d2 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
@@ -60,7 +60,6 @@ import org.apache.asterix.lang.sqlpp.clause.SelectRegular;
 import org.apache.asterix.lang.sqlpp.clause.SelectSetOperation;
 import org.apache.asterix.lang.sqlpp.clause.UnnestClause;
 import org.apache.asterix.lang.sqlpp.expression.CaseExpression;
-import org.apache.asterix.lang.sqlpp.expression.IndependentSubquery;
 import org.apache.asterix.lang.sqlpp.expression.SelectExpression;
 import org.apache.asterix.lang.sqlpp.struct.SetOperationRight;
 import org.apache.asterix.lang.sqlpp.visitor.base.AbstractSqlppQueryExpressionVisitor;
@@ -169,11 +168,6 @@ public class CheckSubqueryVisitor extends AbstractSqlppQueryExpressionVisitor<Bo
     }
 
     @Override
-    public Boolean visit(IndependentSubquery independentSubquery, ILangExpression arg) throws CompilationException {
-        return visit(independentSubquery.getExpr(), arg);
-    }
-
-    @Override
     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);

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/f9fe6dda/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 37e4e26..0d3f320 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
@@ -64,7 +64,6 @@ import org.apache.asterix.lang.sqlpp.clause.SelectRegular;
 import org.apache.asterix.lang.sqlpp.clause.SelectSetOperation;
 import org.apache.asterix.lang.sqlpp.clause.UnnestClause;
 import org.apache.asterix.lang.sqlpp.expression.CaseExpression;
-import org.apache.asterix.lang.sqlpp.expression.IndependentSubquery;
 import org.apache.asterix.lang.sqlpp.expression.SelectExpression;
 import org.apache.asterix.lang.sqlpp.struct.SetOperationInput;
 import org.apache.asterix.lang.sqlpp.struct.SetOperationRight;
@@ -415,11 +414,6 @@ public class DeepCopyVisitor extends AbstractSqlppQueryExpressionVisitor<ILangEx
     }
 
     @Override
-    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 CompilationException {
         Expression conditionExpr = (Expression) caseExpr.getConditionExpr().accept(this, arg);
         List<Expression> whenExprList = copyExprList(caseExpr.getWhenExprs(), arg);

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/f9fe6dda/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 e152b9b..6c38334 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
@@ -61,7 +61,6 @@ import org.apache.asterix.lang.sqlpp.clause.SelectRegular;
 import org.apache.asterix.lang.sqlpp.clause.SelectSetOperation;
 import org.apache.asterix.lang.sqlpp.clause.UnnestClause;
 import org.apache.asterix.lang.sqlpp.expression.CaseExpression;
-import org.apache.asterix.lang.sqlpp.expression.IndependentSubquery;
 import org.apache.asterix.lang.sqlpp.expression.SelectExpression;
 import org.apache.asterix.lang.sqlpp.struct.SetOperationRight;
 import org.apache.asterix.lang.sqlpp.util.SqlppVariableUtil;
@@ -414,13 +413,6 @@ public class FreeVariableVisitor extends AbstractSqlppQueryExpressionVisitor<Voi
     }
 
     @Override
-    public Void visit(IndependentSubquery independentSubquery, Collection<VariableExpr> freeVars)
-            throws CompilationException {
-        independentSubquery.getExpr().accept(this, freeVars);
-        return null;
-    }
-
-    @Override
     public Void visit(CaseExpression caseExpr, Collection<VariableExpr> freeVars) throws CompilationException {
         caseExpr.getConditionExpr().accept(this, freeVars);
         visit(caseExpr.getWhenExprs(), freeVars);

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/f9fe6dda/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 e52bee3..38d09f9 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
@@ -44,7 +44,6 @@ import org.apache.asterix.lang.sqlpp.clause.SelectRegular;
 import org.apache.asterix.lang.sqlpp.clause.SelectSetOperation;
 import org.apache.asterix.lang.sqlpp.clause.UnnestClause;
 import org.apache.asterix.lang.sqlpp.expression.CaseExpression;
-import org.apache.asterix.lang.sqlpp.expression.IndependentSubquery;
 import org.apache.asterix.lang.sqlpp.expression.SelectExpression;
 import org.apache.asterix.lang.sqlpp.struct.SetOperationRight;
 import org.apache.asterix.lang.sqlpp.util.FunctionMapUtil;
@@ -54,16 +53,8 @@ import org.apache.hyracks.algebricks.common.utils.Pair;
 
 public class SqlppAstPrintVisitor extends QueryPrintVisitor implements ISqlppVisitor<Void, Integer> {
 
-    private final PrintWriter out;
-
-    public SqlppAstPrintVisitor() {
-        super();
-        out = new PrintWriter(System.out);
-    }
-
     public SqlppAstPrintVisitor(PrintWriter out) {
         super(out);
-        this.out = out;
     }
 
     @Override
@@ -300,12 +291,6 @@ public class SqlppAstPrintVisitor extends QueryPrintVisitor implements ISqlppVis
     }
 
     @Override
-    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 CompilationException {
         out.print(skip(step) + "CASE");
         caseExpr.getConditionExpr().accept(this, step + 2);

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/f9fe6dda/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/visitor/SqlppCloneAndSubstituteVariablesVisitor.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/visitor/SqlppCloneAndSubstituteVariablesVisitor.java b/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/visitor/SqlppCloneAndSubstituteVariablesVisitor.java
index 8904241..844856d 100644
--- a/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/visitor/SqlppCloneAndSubstituteVariablesVisitor.java
+++ b/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/visitor/SqlppCloneAndSubstituteVariablesVisitor.java
@@ -49,7 +49,6 @@ import org.apache.asterix.lang.sqlpp.clause.SelectRegular;
 import org.apache.asterix.lang.sqlpp.clause.SelectSetOperation;
 import org.apache.asterix.lang.sqlpp.clause.UnnestClause;
 import org.apache.asterix.lang.sqlpp.expression.CaseExpression;
-import org.apache.asterix.lang.sqlpp.expression.IndependentSubquery;
 import org.apache.asterix.lang.sqlpp.expression.SelectExpression;
 import org.apache.asterix.lang.sqlpp.struct.SetOperationInput;
 import org.apache.asterix.lang.sqlpp.struct.SetOperationRight;
@@ -381,14 +380,6 @@ public class SqlppCloneAndSubstituteVariablesVisitor extends CloneAndSubstituteV
     }
 
     @Override
-    public Pair<ILangExpression, VariableSubstitutionEnvironment> visit(IndependentSubquery independentSubquery,
-            VariableSubstitutionEnvironment env) throws CompilationException {
-        Pair<ILangExpression, VariableSubstitutionEnvironment> p = independentSubquery.getExpr().accept(this, env);
-        IndependentSubquery newSubquery = new IndependentSubquery((Expression) p.first);
-        return new Pair<>(newSubquery, p.second);
-    }
-
-    @Override
     public Pair<ILangExpression, VariableSubstitutionEnvironment> visit(CaseExpression caseExpr,
             VariableSubstitutionEnvironment env) throws CompilationException {
         Expression conditionExpr = (Expression) caseExpr.getConditionExpr().accept(this, env).first;

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/f9fe6dda/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/visitor/SqlppFormatPrintVisitor.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/visitor/SqlppFormatPrintVisitor.java b/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/visitor/SqlppFormatPrintVisitor.java
index a62a1cc..51444e8 100644
--- a/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/visitor/SqlppFormatPrintVisitor.java
+++ b/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/visitor/SqlppFormatPrintVisitor.java
@@ -43,7 +43,6 @@ import org.apache.asterix.lang.sqlpp.clause.SelectRegular;
 import org.apache.asterix.lang.sqlpp.clause.SelectSetOperation;
 import org.apache.asterix.lang.sqlpp.clause.UnnestClause;
 import org.apache.asterix.lang.sqlpp.expression.CaseExpression;
-import org.apache.asterix.lang.sqlpp.expression.IndependentSubquery;
 import org.apache.asterix.lang.sqlpp.expression.SelectExpression;
 import org.apache.asterix.lang.sqlpp.struct.SetOperationRight;
 import org.apache.asterix.lang.sqlpp.util.SqlppVariableUtil;
@@ -51,15 +50,8 @@ import org.apache.asterix.lang.sqlpp.visitor.base.ISqlppVisitor;
 
 public class SqlppFormatPrintVisitor extends FormatPrintVisitor implements ISqlppVisitor<Void, Integer> {
 
-    private final PrintWriter out;
-
-    public SqlppFormatPrintVisitor() {
-        this(new PrintWriter(System.out));
-    }
-
     public SqlppFormatPrintVisitor(PrintWriter out) {
         super(out);
-        this.out = out;
 
         // Initialize symbols
         dataverseSymbol = " database ";
@@ -309,12 +301,6 @@ public class SqlppFormatPrintVisitor extends FormatPrintVisitor implements ISqlp
     }
 
     @Override
-    public Void visit(IndependentSubquery independentSubquery, Integer step) throws CompilationException {
-        independentSubquery.getExpr().accept(this, step);
-        return null;
-    }
-
-    @Override
     public Void visit(CaseExpression caseExpr, Integer step) throws CompilationException {
         out.print(skip(step) + "case ");
         caseExpr.getConditionExpr().accept(this, step + 2);

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/f9fe6dda/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/visitor/base/AbstractSqlppAstVisitor.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/visitor/base/AbstractSqlppAstVisitor.java b/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/visitor/base/AbstractSqlppAstVisitor.java
index ec17484..5396768 100644
--- a/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/visitor/base/AbstractSqlppAstVisitor.java
+++ b/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/visitor/base/AbstractSqlppAstVisitor.java
@@ -33,7 +33,6 @@ import org.apache.asterix.lang.sqlpp.clause.SelectRegular;
 import org.apache.asterix.lang.sqlpp.clause.SelectSetOperation;
 import org.apache.asterix.lang.sqlpp.clause.UnnestClause;
 import org.apache.asterix.lang.sqlpp.expression.CaseExpression;
-import org.apache.asterix.lang.sqlpp.expression.IndependentSubquery;
 import org.apache.asterix.lang.sqlpp.expression.SelectExpression;
 
 /**
@@ -107,11 +106,6 @@ public abstract class AbstractSqlppAstVisitor<R, T> extends AbstractAstVisitor<R
     }
 
     @Override
-    public R visit(IndependentSubquery independentSubquery, T arg) throws CompilationException {
-        return null;
-    }
-
-    @Override
     public R visit(CaseExpression caseExpr, T arg) throws CompilationException {
         return null;
     }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/f9fe6dda/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/visitor/base/AbstractSqlppExpressionScopingVisitor.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/visitor/base/AbstractSqlppExpressionScopingVisitor.java b/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/visitor/base/AbstractSqlppExpressionScopingVisitor.java
index a935b3b..2f9cb32 100644
--- a/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/visitor/base/AbstractSqlppExpressionScopingVisitor.java
+++ b/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/visitor/base/AbstractSqlppExpressionScopingVisitor.java
@@ -54,7 +54,6 @@ import org.apache.asterix.lang.sqlpp.clause.JoinClause;
 import org.apache.asterix.lang.sqlpp.clause.NestClause;
 import org.apache.asterix.lang.sqlpp.clause.SelectSetOperation;
 import org.apache.asterix.lang.sqlpp.clause.UnnestClause;
-import org.apache.asterix.lang.sqlpp.expression.IndependentSubquery;
 import org.apache.asterix.lang.sqlpp.expression.SelectExpression;
 import org.apache.asterix.lang.sqlpp.struct.SetOperationRight;
 import org.apache.asterix.lang.sqlpp.util.SqlppVariableUtil;
@@ -317,18 +316,6 @@ public class AbstractSqlppExpressionScopingVisitor extends AbstractSqlppSimpleEx
     }
 
     @Override
-    public Expression visit(IndependentSubquery independentSubquery, ILangExpression arg) throws CompilationException {
-        // Masks parent scopes so as that the subquery is independent of the environment.
-        // In this way, free variables defined in the subquery will not be resolved using
-        // variables defined in the parent scope.
-        Scope scope = new Scope(scopeChecker, scopeChecker.getCurrentScope(), true);
-        scopeChecker.pushExistingScope(scope);
-        independentSubquery.setExpr(visit(independentSubquery.getExpr(), independentSubquery));
-        scopeChecker.removeCurrentScope();
-        return independentSubquery;
-    }
-
-    @Override
     public Expression visit(QuantifiedExpression qe, ILangExpression arg) throws CompilationException {
         scopeChecker.createNewScope();
         for (QuantifiedPair pair : qe.getQuantifiedList()) {

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/f9fe6dda/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/visitor/base/AbstractSqlppSimpleExpressionVisitor.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/visitor/base/AbstractSqlppSimpleExpressionVisitor.java b/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/visitor/base/AbstractSqlppSimpleExpressionVisitor.java
index a2e43a2..4d35914 100644
--- a/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/visitor/base/AbstractSqlppSimpleExpressionVisitor.java
+++ b/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/visitor/base/AbstractSqlppSimpleExpressionVisitor.java
@@ -60,7 +60,6 @@ import org.apache.asterix.lang.sqlpp.clause.SelectRegular;
 import org.apache.asterix.lang.sqlpp.clause.SelectSetOperation;
 import org.apache.asterix.lang.sqlpp.clause.UnnestClause;
 import org.apache.asterix.lang.sqlpp.expression.CaseExpression;
-import org.apache.asterix.lang.sqlpp.expression.IndependentSubquery;
 import org.apache.asterix.lang.sqlpp.expression.SelectExpression;
 import org.apache.asterix.lang.sqlpp.struct.SetOperationRight;
 
@@ -337,12 +336,6 @@ public class AbstractSqlppSimpleExpressionVisitor
     }
 
     @Override
-    public Expression visit(IndependentSubquery independentSubquery, ILangExpression arg) throws CompilationException {
-        independentSubquery.setExpr(visit(independentSubquery.getExpr(), arg));
-        return independentSubquery;
-    }
-
-    @Override
     public Expression visit(CaseExpression caseExpr, ILangExpression arg) throws CompilationException {
         caseExpr.setConditionExpr(visit(caseExpr.getConditionExpr(), arg));
         caseExpr.setWhenExprs(visit(caseExpr.getWhenExprs(), arg));

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/f9fe6dda/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/visitor/base/ISqlppVisitor.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/visitor/base/ISqlppVisitor.java b/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/visitor/base/ISqlppVisitor.java
index 639f3b5..02d9142 100644
--- a/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/visitor/base/ISqlppVisitor.java
+++ b/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/visitor/base/ISqlppVisitor.java
@@ -33,7 +33,6 @@ import org.apache.asterix.lang.sqlpp.clause.SelectRegular;
 import org.apache.asterix.lang.sqlpp.clause.SelectSetOperation;
 import org.apache.asterix.lang.sqlpp.clause.UnnestClause;
 import org.apache.asterix.lang.sqlpp.expression.CaseExpression;
-import org.apache.asterix.lang.sqlpp.expression.IndependentSubquery;
 import org.apache.asterix.lang.sqlpp.expression.SelectExpression;
 
 public interface ISqlppVisitor<R, T> extends ILangVisitor<R, T> {
@@ -64,7 +63,5 @@ public interface ISqlppVisitor<R, T> extends ILangVisitor<R, T> {
 
     R visit(HavingClause havingClause, T arg) throws CompilationException;
 
-    R visit(IndependentSubquery independentSubquery, T arg) throws CompilationException;
-
     R visit(CaseExpression caseExpression, T arg) throws CompilationException;
 }


Mime
View raw message