You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@asterixdb.apache.org by bu...@apache.org on 2015/10/31 00:16:54 UTC

[46/51] [partial] incubator-asterixdb git commit: SQL++ parser: 1. refactored asterix-aql to become asterix-lang-common and asterix-lang-aql, where the former is the common part for different languages; 2. added asterix-lang-sqlpp on top of asterix-lang-

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/main/java/org/apache/asterix/api/http/servlet/RESTAPIServlet.java
----------------------------------------------------------------------
diff --git a/asterix-app/src/main/java/org/apache/asterix/api/http/servlet/RESTAPIServlet.java b/asterix-app/src/main/java/org/apache/asterix/api/http/servlet/RESTAPIServlet.java
index e13ac8e..be17229 100644
--- a/asterix-app/src/main/java/org/apache/asterix/api/http/servlet/RESTAPIServlet.java
+++ b/asterix-app/src/main/java/org/apache/asterix/api/http/servlet/RESTAPIServlet.java
@@ -30,25 +30,24 @@ import javax.servlet.http.HttpServlet;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
-import org.apache.commons.io.IOUtils;
-import org.json.JSONObject;
-
 import org.apache.asterix.api.common.SessionConfig;
 import org.apache.asterix.api.common.SessionConfig.OutputFormat;
-import org.apache.asterix.aql.base.Statement;
-import org.apache.asterix.aql.base.Statement.Kind;
-import org.apache.asterix.aql.parser.AQLParser;
-import org.apache.asterix.aql.parser.ParseException;
-import org.apache.asterix.aql.parser.TokenMgrError;
 import org.apache.asterix.aql.translator.AqlTranslator;
 import org.apache.asterix.common.config.GlobalConfig;
 import org.apache.asterix.common.exceptions.AsterixException;
+import org.apache.asterix.lang.aql.parser.AQLParser;
+import org.apache.asterix.lang.aql.parser.TokenMgrError;
+import org.apache.asterix.lang.aql.util.AQLFormatPrintUtil;
+import org.apache.asterix.lang.common.base.Statement;
+import org.apache.asterix.lang.common.base.Statement.Kind;
 import org.apache.asterix.metadata.MetadataManager;
 import org.apache.asterix.result.ResultReader;
 import org.apache.asterix.result.ResultUtils;
+import org.apache.commons.io.IOUtils;
 import org.apache.hyracks.api.client.IHyracksClientConnection;
 import org.apache.hyracks.api.dataset.IHyracksDataset;
 import org.apache.hyracks.client.dataset.HyracksDataset;
+import org.json.JSONObject;
 
 abstract class RESTAPIServlet extends HttpServlet {
     private static final long serialVersionUID = 1L;
@@ -62,8 +61,7 @@ abstract class RESTAPIServlet extends HttpServlet {
      * SessionConfig with the appropriate output writer and output-format
      * based on the Accept: header and other servlet parameters.
      */
-    static SessionConfig initResponse(HttpServletRequest request, HttpServletResponse response)
-        throws IOException {
+    static SessionConfig initResponse(HttpServletRequest request, HttpServletResponse response) throws IOException {
         response.setCharacterEncoding("utf-8");
 
         // CLEAN_JSON output is the default; most generally useful for a
@@ -76,12 +74,10 @@ abstract class RESTAPIServlet extends HttpServlet {
         if (output != null) {
             if (output.equals("CSV")) {
                 format = OutputFormat.CSV;
-            }
-            else if (output.equals("ADM")) {
+            } else if (output.equals("ADM")) {
                 format = OutputFormat.ADM;
             }
-        }
-        else {
+        } else {
             // Second check the Accept: HTTP header.
             if (accept != null) {
                 if (accept.contains("application/x-adm")) {
@@ -93,9 +89,9 @@ abstract class RESTAPIServlet extends HttpServlet {
         }
 
         // If it's JSON, check for the "lossless" flag
-        if (format == OutputFormat.CLEAN_JSON &&
-                ("true".equals(request.getParameter("lossless")) ||
-                (accept != null && accept.contains("lossless=true")))) {
+        if (format == OutputFormat.CLEAN_JSON
+                && ("true".equals(request.getParameter("lossless")) || (accept != null && accept
+                        .contains("lossless=true")))) {
             format = OutputFormat.LOSSLESS_JSON;
         }
 
@@ -113,12 +109,11 @@ abstract class RESTAPIServlet extends HttpServlet {
                 break;
             case CSV: {
                 // Check for header parameter or in Accept:.
-                if ("present".equals(request.getParameter("header")) ||
-                    (accept != null && accept.contains("header=present"))) {
+                if ("present".equals(request.getParameter("header"))
+                        || (accept != null && accept.contains("header=present"))) {
                     response.setContentType("text/csv; header=present");
                     sessionConfig.set(SessionConfig.FORMAT_CSV_HEADER, true);
-                }
-                else {
+                } else {
                     response.setContentType("text/csv; header=absent");
                 }
             }
@@ -168,7 +163,7 @@ abstract class RESTAPIServlet extends HttpServlet {
                 AqlTranslator aqlTranslator = new AqlTranslator(aqlStatements, sessionConfig);
                 aqlTranslator.compileAndExecute(hcc, hds, resultDelivery);
             }
-        } catch (ParseException | TokenMgrError | org.apache.asterix.aqlplus.parser.TokenMgrError pe) {
+        } catch (AsterixException | TokenMgrError | org.apache.asterix.aqlplus.parser.TokenMgrError pe) {
             GlobalConfig.ASTERIX_LOGGER.log(Level.SEVERE, pe.getMessage(), pe);
             String errorMessage = ResultUtils.buildParseExceptionMessage(pe, query);
             JSONObject errorResp = ResultUtils.getErrorResponse(2, errorMessage, "", "");

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/main/java/org/apache/asterix/api/http/servlet/UpdateAPIServlet.java
----------------------------------------------------------------------
diff --git a/asterix-app/src/main/java/org/apache/asterix/api/http/servlet/UpdateAPIServlet.java b/asterix-app/src/main/java/org/apache/asterix/api/http/servlet/UpdateAPIServlet.java
index b436061..d08134f 100644
--- a/asterix-app/src/main/java/org/apache/asterix/api/http/servlet/UpdateAPIServlet.java
+++ b/asterix-app/src/main/java/org/apache/asterix/api/http/servlet/UpdateAPIServlet.java
@@ -23,8 +23,8 @@ import java.util.List;
 
 import javax.servlet.http.HttpServletRequest;
 
-import org.apache.asterix.aql.base.Statement;
-import org.apache.asterix.aql.base.Statement.Kind;
+import org.apache.asterix.lang.common.base.Statement;
+import org.apache.asterix.lang.common.base.Statement.Kind;
 
 public class UpdateAPIServlet extends RESTAPIServlet {
     private static final long serialVersionUID = 1L;

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/main/java/org/apache/asterix/api/java/AsterixJavaClient.java
----------------------------------------------------------------------
diff --git a/asterix-app/src/main/java/org/apache/asterix/api/java/AsterixJavaClient.java b/asterix-app/src/main/java/org/apache/asterix/api/java/AsterixJavaClient.java
index 3276a60..a9b012d 100644
--- a/asterix-app/src/main/java/org/apache/asterix/api/java/AsterixJavaClient.java
+++ b/asterix-app/src/main/java/org/apache/asterix/api/java/AsterixJavaClient.java
@@ -26,11 +26,9 @@ import org.apache.asterix.api.common.APIFramework;
 import org.apache.asterix.api.common.Job;
 import org.apache.asterix.api.common.SessionConfig;
 import org.apache.asterix.api.common.SessionConfig.OutputFormat;
-import org.apache.asterix.aql.base.Statement;
-import org.apache.asterix.aql.parser.AQLParser;
-import org.apache.asterix.aql.parser.ParseException;
 import org.apache.asterix.aql.translator.AqlTranslator;
-import org.apache.asterix.common.exceptions.AsterixException;
+import org.apache.asterix.lang.aql.parser.AQLParser;
+import org.apache.asterix.lang.common.base.Statement;
 import org.apache.asterix.metadata.MetadataManager;
 import org.apache.hyracks.api.client.IHyracksClientConnection;
 import org.apache.hyracks.api.job.JobSpecification;
@@ -59,7 +57,7 @@ public class AsterixJavaClient {
 
     public void compile(boolean optimize, boolean printRewrittenExpressions, boolean printLogicalPlan,
             boolean printOptimizedPlan, boolean printPhysicalOpsOnly, boolean generateBinaryRuntime, boolean printJob)
-            throws Exception {
+                    throws Exception {
         queryJobSpec = null;
         dmlJobs = null;
 
@@ -72,17 +70,11 @@ public class AsterixJavaClient {
             builder.append((char) ch);
         }
         AQLParser parser = new AQLParser(builder.toString());
-        List<Statement> aqlStatements;
-        try {
-            aqlStatements = parser.parse();
-        } catch (ParseException pe) {
-            throw new AsterixException(pe);
-        }
+        List<Statement> aqlStatements = parser.parse();
         MetadataManager.INSTANCE.init();
 
         SessionConfig conf = new SessionConfig(writer, OutputFormat.ADM, optimize, true, generateBinaryRuntime);
-        conf.setOOBData(false, printRewrittenExpressions, printLogicalPlan,
-                        printOptimizedPlan, printJob);
+        conf.setOOBData(false, printRewrittenExpressions, printLogicalPlan, printOptimizedPlan, printJob);
         if (printPhysicalOpsOnly) {
             conf.set(SessionConfig.FORMAT_ONLY_PHYSICAL_OPS, true);
         }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/main/java/org/apache/asterix/aql/translator/AqlTranslator.java
----------------------------------------------------------------------
diff --git a/asterix-app/src/main/java/org/apache/asterix/aql/translator/AqlTranslator.java b/asterix-app/src/main/java/org/apache/asterix/aql/translator/AqlTranslator.java
index dcfbc98..8029e0d 100644
--- a/asterix-app/src/main/java/org/apache/asterix/aql/translator/AqlTranslator.java
+++ b/asterix-app/src/main/java/org/apache/asterix/aql/translator/AqlTranslator.java
@@ -43,50 +43,10 @@ import org.apache.commons.lang3.StringUtils;
 import org.json.JSONArray;
 import org.json.JSONException;
 import org.json.JSONObject;
-
 import org.apache.asterix.api.common.APIFramework;
 import org.apache.asterix.api.common.Job;
 import org.apache.asterix.api.common.SessionConfig;
 import org.apache.asterix.api.common.SessionConfig.OutputFormat;
-import org.apache.asterix.aql.base.Statement;
-import org.apache.asterix.aql.expression.CompactStatement;
-import org.apache.asterix.aql.expression.ConnectFeedStatement;
-import org.apache.asterix.aql.expression.CreateDataverseStatement;
-import org.apache.asterix.aql.expression.CreateFeedPolicyStatement;
-import org.apache.asterix.aql.expression.CreateFeedStatement;
-import org.apache.asterix.aql.expression.CreateFunctionStatement;
-import org.apache.asterix.aql.expression.CreateIndexStatement;
-import org.apache.asterix.aql.expression.CreatePrimaryFeedStatement;
-import org.apache.asterix.aql.expression.CreateSecondaryFeedStatement;
-import org.apache.asterix.aql.expression.DatasetDecl;
-import org.apache.asterix.aql.expression.DataverseDecl;
-import org.apache.asterix.aql.expression.DataverseDropStatement;
-import org.apache.asterix.aql.expression.DeleteStatement;
-import org.apache.asterix.aql.expression.DisconnectFeedStatement;
-import org.apache.asterix.aql.expression.DropStatement;
-import org.apache.asterix.aql.expression.ExternalDetailsDecl;
-import org.apache.asterix.aql.expression.FeedDropStatement;
-import org.apache.asterix.aql.expression.FeedPolicyDropStatement;
-import org.apache.asterix.aql.expression.FunctionDecl;
-import org.apache.asterix.aql.expression.FunctionDropStatement;
-import org.apache.asterix.aql.expression.IDatasetDetailsDecl;
-import org.apache.asterix.aql.expression.Identifier;
-import org.apache.asterix.aql.expression.IndexDropStatement;
-import org.apache.asterix.aql.expression.InsertStatement;
-import org.apache.asterix.aql.expression.InternalDetailsDecl;
-import org.apache.asterix.aql.expression.LoadStatement;
-import org.apache.asterix.aql.expression.NodeGroupDropStatement;
-import org.apache.asterix.aql.expression.NodegroupDecl;
-import org.apache.asterix.aql.expression.Query;
-import org.apache.asterix.aql.expression.RefreshExternalDatasetStatement;
-import org.apache.asterix.aql.expression.RunStatement;
-import org.apache.asterix.aql.expression.SetStatement;
-import org.apache.asterix.aql.expression.SubscribeFeedStatement;
-import org.apache.asterix.aql.expression.TypeDecl;
-import org.apache.asterix.aql.expression.TypeDropStatement;
-import org.apache.asterix.aql.expression.TypeExpression;
-import org.apache.asterix.aql.expression.WriteStatement;
-import org.apache.asterix.aql.util.FunctionUtils;
 import org.apache.asterix.common.config.AsterixCompilerProperties;
 import org.apache.asterix.common.config.DatasetConfig.DatasetType;
 import org.apache.asterix.common.config.DatasetConfig.ExternalDatasetTransactionState;
@@ -116,6 +76,45 @@ import org.apache.asterix.file.ExternalIndexingOperations;
 import org.apache.asterix.file.FeedOperations;
 import org.apache.asterix.file.IndexOperations;
 import org.apache.asterix.formats.nontagged.AqlTypeTraitProvider;
+import org.apache.asterix.lang.aql.statement.SubscribeFeedStatement;
+import org.apache.asterix.lang.aql.util.FunctionUtils;
+import org.apache.asterix.lang.common.base.Statement;
+import org.apache.asterix.lang.common.expression.TypeExpression;
+import org.apache.asterix.lang.common.statement.CompactStatement;
+import org.apache.asterix.lang.common.statement.ConnectFeedStatement;
+import org.apache.asterix.lang.common.statement.CreateDataverseStatement;
+import org.apache.asterix.lang.common.statement.CreateFeedPolicyStatement;
+import org.apache.asterix.lang.common.statement.CreateFeedStatement;
+import org.apache.asterix.lang.common.statement.CreateFunctionStatement;
+import org.apache.asterix.lang.common.statement.CreateIndexStatement;
+import org.apache.asterix.lang.common.statement.CreatePrimaryFeedStatement;
+import org.apache.asterix.lang.common.statement.CreateSecondaryFeedStatement;
+import org.apache.asterix.lang.common.statement.DatasetDecl;
+import org.apache.asterix.lang.common.statement.DataverseDecl;
+import org.apache.asterix.lang.common.statement.DataverseDropStatement;
+import org.apache.asterix.lang.common.statement.DeleteStatement;
+import org.apache.asterix.lang.common.statement.DisconnectFeedStatement;
+import org.apache.asterix.lang.common.statement.DropStatement;
+import org.apache.asterix.lang.common.statement.ExternalDetailsDecl;
+import org.apache.asterix.lang.common.statement.FeedDropStatement;
+import org.apache.asterix.lang.common.statement.FeedPolicyDropStatement;
+import org.apache.asterix.lang.common.statement.FunctionDecl;
+import org.apache.asterix.lang.common.statement.FunctionDropStatement;
+import org.apache.asterix.lang.common.statement.IDatasetDetailsDecl;
+import org.apache.asterix.lang.common.statement.IndexDropStatement;
+import org.apache.asterix.lang.common.statement.InsertStatement;
+import org.apache.asterix.lang.common.statement.InternalDetailsDecl;
+import org.apache.asterix.lang.common.statement.LoadStatement;
+import org.apache.asterix.lang.common.statement.NodeGroupDropStatement;
+import org.apache.asterix.lang.common.statement.NodegroupDecl;
+import org.apache.asterix.lang.common.statement.Query;
+import org.apache.asterix.lang.common.statement.RefreshExternalDatasetStatement;
+import org.apache.asterix.lang.common.statement.RunStatement;
+import org.apache.asterix.lang.common.statement.SetStatement;
+import org.apache.asterix.lang.common.statement.TypeDecl;
+import org.apache.asterix.lang.common.statement.TypeDropStatement;
+import org.apache.asterix.lang.common.statement.WriteStatement;
+import org.apache.asterix.lang.common.struct.Identifier;
 import org.apache.asterix.metadata.IDatasetDetails;
 import org.apache.asterix.metadata.MetadataException;
 import org.apache.asterix.metadata.MetadataManager;

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/main/java/org/apache/asterix/feeds/CentralFeedManager.java
----------------------------------------------------------------------
diff --git a/asterix-app/src/main/java/org/apache/asterix/feeds/CentralFeedManager.java b/asterix-app/src/main/java/org/apache/asterix/feeds/CentralFeedManager.java
index 1945353..8183a06 100644
--- a/asterix-app/src/main/java/org/apache/asterix/feeds/CentralFeedManager.java
+++ b/asterix-app/src/main/java/org/apache/asterix/feeds/CentralFeedManager.java
@@ -25,13 +25,13 @@ import java.util.List;
 
 import org.apache.asterix.api.common.SessionConfig;
 import org.apache.asterix.api.common.SessionConfig.OutputFormat;
-import org.apache.asterix.aql.base.Statement;
-import org.apache.asterix.aql.parser.AQLParser;
 import org.apache.asterix.aql.translator.AqlTranslator;
 import org.apache.asterix.common.exceptions.AsterixException;
 import org.apache.asterix.common.feeds.api.ICentralFeedManager;
 import org.apache.asterix.common.feeds.api.IFeedLoadManager;
 import org.apache.asterix.common.feeds.api.IFeedTrackingManager;
+import org.apache.asterix.lang.aql.parser.AQLParser;
+import org.apache.asterix.lang.common.base.Statement;
 import org.apache.asterix.metadata.feeds.SocketMessageListener;
 import org.apache.asterix.om.util.AsterixAppContextInfo;
 import org.apache.hyracks.api.client.IHyracksClientConnection;
@@ -97,7 +97,8 @@ public class CentralFeedManager implements ICentralFeedManager {
             statements = parser.Statement();
             SessionConfig pc = new SessionConfig(out, OutputFormat.ADM);
             AqlTranslator translator = new AqlTranslator(statements, pc);
-            translator.compileAndExecute(AsterixAppContextInfo.getInstance().getHcc(), null, AqlTranslator.ResultDelivery.SYNC);
+            translator.compileAndExecute(AsterixAppContextInfo.getInstance().getHcc(), null,
+                    AqlTranslator.ResultDelivery.SYNC);
         }
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/main/java/org/apache/asterix/feeds/FeedLifecycleListener.java
----------------------------------------------------------------------
diff --git a/asterix-app/src/main/java/org/apache/asterix/feeds/FeedLifecycleListener.java b/asterix-app/src/main/java/org/apache/asterix/feeds/FeedLifecycleListener.java
index d7da85e..4ca9961 100644
--- a/asterix-app/src/main/java/org/apache/asterix/feeds/FeedLifecycleListener.java
+++ b/asterix-app/src/main/java/org/apache/asterix/feeds/FeedLifecycleListener.java
@@ -35,10 +35,6 @@ import java.util.logging.Logger;
 
 import org.apache.asterix.api.common.SessionConfig;
 import org.apache.asterix.api.common.SessionConfig.OutputFormat;
-import org.apache.asterix.aql.base.Statement;
-import org.apache.asterix.aql.expression.DataverseDecl;
-import org.apache.asterix.aql.expression.DisconnectFeedStatement;
-import org.apache.asterix.aql.expression.Identifier;
 import org.apache.asterix.aql.translator.AqlTranslator;
 import org.apache.asterix.common.api.IClusterManagementWork;
 import org.apache.asterix.common.api.IClusterManagementWork.ClusterState;
@@ -56,6 +52,10 @@ import org.apache.asterix.common.feeds.api.IFeedLifecycleEventSubscriber;
 import org.apache.asterix.common.feeds.api.IFeedLifecycleListener;
 import org.apache.asterix.common.feeds.api.IIntakeProgressTracker;
 import org.apache.asterix.common.feeds.message.StorageReportFeedMessage;
+import org.apache.asterix.lang.common.base.Statement;
+import org.apache.asterix.lang.common.statement.DataverseDecl;
+import org.apache.asterix.lang.common.statement.DisconnectFeedStatement;
+import org.apache.asterix.lang.common.struct.Identifier;
 import org.apache.asterix.metadata.MetadataManager;
 import org.apache.asterix.metadata.MetadataTransactionContext;
 import org.apache.asterix.metadata.cluster.AddNodeWork;

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/main/java/org/apache/asterix/feeds/FeedsActivator.java
----------------------------------------------------------------------
diff --git a/asterix-app/src/main/java/org/apache/asterix/feeds/FeedsActivator.java b/asterix-app/src/main/java/org/apache/asterix/feeds/FeedsActivator.java
index ea40d9b..9e8864c 100644
--- a/asterix-app/src/main/java/org/apache/asterix/feeds/FeedsActivator.java
+++ b/asterix-app/src/main/java/org/apache/asterix/feeds/FeedsActivator.java
@@ -26,11 +26,11 @@ import java.util.logging.Logger;
 
 import org.apache.asterix.api.common.SessionConfig;
 import org.apache.asterix.api.common.SessionConfig.OutputFormat;
-import org.apache.asterix.aql.base.Statement;
-import org.apache.asterix.aql.expression.ConnectFeedStatement;
-import org.apache.asterix.aql.expression.DataverseDecl;
-import org.apache.asterix.aql.expression.Identifier;
 import org.apache.asterix.aql.translator.AqlTranslator;
+import org.apache.asterix.lang.common.base.Statement;
+import org.apache.asterix.lang.common.statement.ConnectFeedStatement;
+import org.apache.asterix.lang.common.statement.DataverseDecl;
+import org.apache.asterix.lang.common.struct.Identifier;
 import org.apache.asterix.om.util.AsterixAppContextInfo;
 import org.apache.hyracks.api.job.JobId;
 

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/test/java/org/apache/asterix/test/aql/AQLTestCase.java
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/java/org/apache/asterix/test/aql/AQLTestCase.java b/asterix-app/src/test/java/org/apache/asterix/test/aql/AQLTestCase.java
index fd56664..618faf6 100644
--- a/asterix-app/src/test/java/org/apache/asterix/test/aql/AQLTestCase.java
+++ b/asterix-app/src/test/java/org/apache/asterix/test/aql/AQLTestCase.java
@@ -27,18 +27,15 @@ import java.io.PrintWriter;
 import java.io.Reader;
 import java.io.StringWriter;
 import java.io.UnsupportedEncodingException;
-import java.util.List;
 
-import junit.framework.TestCase;
-
-import org.junit.Test;
-
-import org.apache.asterix.aql.base.Statement;
-import org.apache.asterix.aql.parser.AQLParser;
-import org.apache.asterix.aql.parser.ParseException;
 import org.apache.asterix.common.config.GlobalConfig;
 import org.apache.asterix.common.exceptions.AsterixException;
+import org.apache.asterix.lang.aql.parser.AQLParser;
+import org.apache.asterix.lang.aql.parser.ParseException;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
+import org.junit.Test;
+
+import junit.framework.TestCase;
 
 public class AQLTestCase extends TestCase {
 
@@ -54,11 +51,10 @@ public class AQLTestCase extends TestCase {
             AlgebricksException {
         Reader fis = new BufferedReader(new InputStreamReader(new FileInputStream(queryFile), "UTF-8"));
         AQLParser parser = new AQLParser(fis);
-        List<Statement> statements;
         GlobalConfig.ASTERIX_LOGGER.info(queryFile.toString());
         try {
-            statements = parser.parse();
-        } catch (ParseException e) {
+            parser.parse();
+        } catch (Exception e) {
             GlobalConfig.ASTERIX_LOGGER.warning("Failed while testing file " + fis);
             StringWriter sw = new StringWriter();
             PrintWriter writer = new PrintWriter(sw);

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/test/java/org/apache/asterix/test/aql/AQLTestSuite.java
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/java/org/apache/asterix/test/aql/AQLTestSuite.java b/asterix-app/src/test/java/org/apache/asterix/test/aql/AQLTestSuite.java
index cef70f2..57a446a 100644
--- a/asterix-app/src/test/java/org/apache/asterix/test/aql/AQLTestSuite.java
+++ b/asterix-app/src/test/java/org/apache/asterix/test/aql/AQLTestSuite.java
@@ -25,14 +25,13 @@ import java.io.UnsupportedEncodingException;
 import junit.framework.Test;
 import junit.framework.TestSuite;
 
+import org.apache.asterix.lang.aql.parser.ParseException;
 import org.apache.commons.lang3.StringUtils;
 
-import org.apache.asterix.aql.parser.ParseException;
-
 public class AQLTestSuite extends TestSuite {
-    private static String AQLTS_PATH = StringUtils.join(new String[] { "src", "test", "resources", "AQLTS",
+    private static String AQLTS_PATH = StringUtils.join(new String[] { "src", "test", "resources", "parserts",
             "queries" + File.separator }, File.separator);
-    private static String AQLTS_SQL_LIKE_PATH = StringUtils.join(new String[] { "src", "test", "resources", "AQLTS",
+    private static String AQLTS_SQL_LIKE_PATH = StringUtils.join(new String[] { "src", "test", "resources", "parserts",
             "queries-sql-like" + File.separator }, File.separator);
 
     public static Test suite() throws ParseException, UnsupportedEncodingException, FileNotFoundException {
@@ -51,9 +50,7 @@ public class AQLTestSuite extends TestSuite {
                 testSuite.addTest(new AQLTestCase(file));
             }
         }
-
         return testSuite;
-
     }
 
     public static void main(String args[]) throws Throwable {

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/test/java/org/apache/asterix/test/dml/DmlTest.java
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/java/org/apache/asterix/test/dml/DmlTest.java b/asterix-app/src/test/java/org/apache/asterix/test/dml/DmlTest.java
index 63ac149..fdd4bc2 100644
--- a/asterix-app/src/test/java/org/apache/asterix/test/dml/DmlTest.java
+++ b/asterix-app/src/test/java/org/apache/asterix/test/dml/DmlTest.java
@@ -25,13 +25,12 @@ import java.io.InputStreamReader;
 import java.io.PrintWriter;
 import java.io.Reader;
 
-import org.junit.Test;
-
 import org.apache.asterix.api.common.AsterixHyracksIntegrationUtil;
 import org.apache.asterix.api.java.AsterixJavaClient;
 import org.apache.asterix.common.exceptions.AsterixException;
-import org.apache.asterix.test.aql.TestsUtils;
+import org.apache.asterix.test.aql.TestExecutor;
 import org.apache.asterix.test.base.AsterixTestHelper;
+import org.junit.Test;
 
 public class DmlTest {
 
@@ -40,12 +39,11 @@ public class DmlTest {
     private static final String SEPARATOR = File.separator;
     private static final String PATH_BASE = "src" + SEPARATOR + "test" + SEPARATOR + "resources" + SEPARATOR + "dmlts"
             + SEPARATOR;
-    private static final String PATH_EXPECTED = PATH_BASE + "results" + SEPARATOR;
     private static final String PATH_SCRIPTS = PATH_BASE + "scripts" + SEPARATOR;
     private static final String LOAD_FOR_ENLIST_FILE = PATH_SCRIPTS + "load-cust.aql";
-    private static final String ENLIST_FILE = PATH_SCRIPTS + "enlist-scan-cust.aql";
 
     private static final PrintWriter ERR = new PrintWriter(System.err);
+    private final TestExecutor testExecutor = new TestExecutor();
 
     @Test
     public void enlistTest() throws Exception {
@@ -68,18 +66,10 @@ public class DmlTest {
             loadReader.close();
         }
         asterixLoad.execute();
-        File enlistFile = new File(ENLIST_FILE);
-        int dot = enlistFile.getName().lastIndexOf('.');
-        String resultFileName = enlistFile.getName().substring(0, dot + 1) + ".adm";
-        File expectedFile = new File(PATH_EXPECTED + SEPARATOR + resultFileName);
-        File actualFile = new File(PATH_ACTUAL + SEPARATOR + resultFileName);
-        // Khurram
-        //TestsUtils.runScriptAndCompareWithResult(AsterixHyracksIntegrationUtil.getHyracksClientConnection(),
-                //enlistFile, ERR, expectedFile, actualFile);
 
         AsterixHyracksIntegrationUtil.deinit();
         for (String d : ASTERIX_DATA_DIRS) {
-            TestsUtils.deleteRec(new File(d));
+            testExecutor.deleteRec(new File(d));
         }
         outdir.delete();
     }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/test/java/org/apache/asterix/test/metadata/MetadataTest.java
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/java/org/apache/asterix/test/metadata/MetadataTest.java b/asterix-app/src/test/java/org/apache/asterix/test/metadata/MetadataTest.java
index 29db874..3788606 100644
--- a/asterix-app/src/test/java/org/apache/asterix/test/metadata/MetadataTest.java
+++ b/asterix-app/src/test/java/org/apache/asterix/test/metadata/MetadataTest.java
@@ -22,6 +22,12 @@ import java.io.File;
 import java.util.ArrayList;
 import java.util.Collection;
 
+import org.apache.asterix.api.common.AsterixHyracksIntegrationUtil;
+import org.apache.asterix.common.config.AsterixPropertiesAccessor;
+import org.apache.asterix.common.config.AsterixTransactionProperties;
+import org.apache.asterix.common.config.GlobalConfig;
+import org.apache.asterix.test.aql.TestExecutor;
+import org.apache.asterix.testframework.context.TestCaseContext;
 import org.apache.commons.io.FileUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.junit.AfterClass;
@@ -31,13 +37,6 @@ import org.junit.runner.RunWith;
 import org.junit.runners.Parameterized;
 import org.junit.runners.Parameterized.Parameters;
 
-import org.apache.asterix.api.common.AsterixHyracksIntegrationUtil;
-import org.apache.asterix.common.config.AsterixPropertiesAccessor;
-import org.apache.asterix.common.config.AsterixTransactionProperties;
-import org.apache.asterix.common.config.GlobalConfig;
-import org.apache.asterix.test.aql.TestsUtils;
-import org.apache.asterix.testframework.context.TestCaseContext;
-
 /**
  * Executes the Metadata tests.
  */
@@ -47,11 +46,12 @@ public class MetadataTest {
     private TestCaseContext tcCtx;
 
     private static final String PATH_ACTUAL = "mdtest" + File.separator;
-    private static final String PATH_BASE = StringUtils.join(new String[] { "src", "test", "resources",
-            "metadata" + File.separator }, File.separator);
+    private static final String PATH_BASE = StringUtils
+            .join(new String[] { "src", "test", "resources", "metadata" + File.separator }, File.separator);
     private static final String TEST_CONFIG_FILE_NAME = "asterix-build-configuration.xml";
 
     private static AsterixTransactionProperties txnProperties;
+    private static final TestExecutor testExecutor = new TestExecutor();
 
     @BeforeClass
     public static void setUp() throws Exception {
@@ -78,7 +78,7 @@ public class MetadataTest {
 
         // clean up the files written by the ASTERIX storage manager
         for (String d : AsterixHyracksIntegrationUtil.getDataDirs()) {
-            TestsUtils.deleteRec(new File(d));
+            testExecutor.deleteRec(new File(d));
         }
     }
 
@@ -107,7 +107,7 @@ public class MetadataTest {
 
     @Test
     public void test() throws Exception {
-        TestsUtils.executeTest(PATH_ACTUAL, tcCtx, null, false);
+        testExecutor.executeTest(PATH_ACTUAL, tcCtx, null, false);
     }
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/test/java/org/apache/asterix/test/querygen/AQLToSQLPPConverter.java
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/java/org/apache/asterix/test/querygen/AQLToSQLPPConverter.java b/asterix-app/src/test/java/org/apache/asterix/test/querygen/AQLToSQLPPConverter.java
new file mode 100644
index 0000000..ede621b
--- /dev/null
+++ b/asterix-app/src/test/java/org/apache/asterix/test/querygen/AQLToSQLPPConverter.java
@@ -0,0 +1,107 @@
+/*
+ * 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.test.querygen;
+
+import java.io.BufferedReader;
+import java.io.BufferedWriter;
+import java.io.DataInputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.InputStreamReader;
+import java.io.OutputStreamWriter;
+import java.util.List;
+
+import org.apache.asterix.lang.aql.parser.AQLParser;
+import org.apache.asterix.lang.aql.util.AQLFormatPrintUtil;
+import org.apache.asterix.lang.common.base.Statement;
+import org.apache.asterix.lang.sqlpp.parser.SQLPPParser;
+import org.apache.commons.io.FileUtils;
+
+public class AQLToSQLPPConverter {
+
+    public static void convert(String dirName) throws Exception {
+        File dir = new File(dirName);
+        File target = new File(dirName + "_sqlpp");
+        FileUtils.deleteQuietly(target);
+        FileUtils.forceMkdir(target);
+        convert(dir, target);
+    }
+
+    private static void convert(File src, File dest) throws Exception {
+        if (src.isFile()) {
+            DataInputStream dis = new DataInputStream(new FileInputStream(src));
+            BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(src)));
+            BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(dest)));
+            try {
+                String line = null;
+                while ((line = reader.readLine()) != null) {
+                    if (line.startsWith("/*") || line.startsWith(" *") || line.startsWith("*")) {
+                        writer.write(line + "\n");
+                    } else {
+                        break;
+                    }
+                }
+                writer.write("\n");
+                AQLParser parser = new AQLParser(dis);
+                List<Statement> statements = parser.parse();
+                dis.close();
+                String sqlString = AQLFormatPrintUtil.toSQLPPString(statements);
+                writer.write(sqlString);
+            } catch (Exception e) {
+                System.out.println("AQL parser fails at: " + src.getAbsolutePath());
+                //e.printStackTrace();
+            } finally {
+                dis.close();
+                reader.close();
+                writer.close();
+            }
+
+            BufferedReader sqlReader = new BufferedReader(new InputStreamReader(new FileInputStream(dest)));
+            try {
+                SQLPPParser sqlParser = new SQLPPParser(sqlReader);
+                sqlParser.parse();
+            } catch (Exception e) {
+                System.out.println("SQL++ parser cannot parse: ");
+                System.out.println(dest.getAbsolutePath());
+                e.printStackTrace();
+            } finally {
+                sqlReader.close();
+            }
+            return;
+        }
+        for (File child : src.listFiles()) {
+            String lastName = child.getName();
+            lastName = lastName.replaceAll("\\.aql", "\\.sqlpp");
+            File targetChild = new File(dest, lastName);
+            if (child.isDirectory()) {
+                FileUtils.forceMkdir(targetChild);
+            } else {
+                targetChild.createNewFile();
+            }
+            convert(child, targetChild);
+        }
+    }
+
+    public static void main(String[] args) throws Exception {
+        convert("src/test/resources/runtimets/queries");
+        convert("src/test/resources/optimizerts/queries");
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/test/java/org/apache/asterix/test/runtime/ExecutionTest.java
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/java/org/apache/asterix/test/runtime/ExecutionTest.java b/asterix-app/src/test/java/org/apache/asterix/test/runtime/ExecutionTest.java
index 9524e0d..2cba6c8 100644
--- a/asterix-app/src/test/java/org/apache/asterix/test/runtime/ExecutionTest.java
+++ b/asterix-app/src/test/java/org/apache/asterix/test/runtime/ExecutionTest.java
@@ -31,6 +31,7 @@ import org.apache.asterix.common.config.AsterixTransactionProperties;
 import org.apache.asterix.common.config.GlobalConfig;
 import org.apache.asterix.external.dataset.adapter.FileSystemBasedAdapter;
 import org.apache.asterix.external.util.IdentitiyResolverFactory;
+import org.apache.asterix.test.aql.TestExecutor;
 import org.apache.asterix.test.aql.TestsUtils;
 import org.apache.asterix.testframework.context.TestCaseContext;
 import org.apache.asterix.testframework.xml.TestGroup;
@@ -53,12 +54,13 @@ public class ExecutionTest {
     protected static final Logger LOGGER = Logger.getLogger(ExecutionTest.class.getName());
 
     protected static final String PATH_ACTUAL = "rttest" + File.separator;
-    protected static final String PATH_BASE = StringUtils.join(
-            new String[] { "src", "test", "resources", "runtimets" }, File.separator);
+    protected static final String PATH_BASE = StringUtils.join(new String[] { "src", "test", "resources", "runtimets" },
+            File.separator);
 
     protected static final String TEST_CONFIG_FILE_NAME = "asterix-build-configuration.xml";
 
     protected static AsterixTransactionProperties txnProperties;
+    private final static TestExecutor testExecutor = new TestExecutor();
 
     protected static TestGroup FailedGroup;
 
@@ -88,7 +90,8 @@ public class ExecutionTest {
 
         HDFSCluster.getInstance().setup();
 
-        // Set the node resolver to be the identity resolver that expects node names
+        // Set the node resolver to be the identity resolver that expects node
+        // names
         // to be node controller ids; a valid assumption in test environment.
         System.setProperty(FileSystemBasedAdapter.NODE_RESOLVER_FACTORY_PROPERTY,
                 IdentitiyResolverFactory.class.getName());
@@ -107,7 +110,7 @@ public class ExecutionTest {
         }
         // clean up the files written by the ASTERIX storage manager
         for (String d : AsterixHyracksIntegrationUtil.getDataDirs()) {
-            TestsUtils.deleteRec(new File(d));
+            testExecutor.deleteRec(new File(d));
         }
         HDFSCluster.getInstance().cleanup();
 
@@ -123,10 +126,9 @@ public class ExecutionTest {
             failedSuite.setQueryOffsetPath("queries");
             failedSuite.getTestGroup().add(FailedGroup);
             marshaller.marshal(failedSuite, temp);
-            System.err.println("The failed.xml is written to :" + temp.getAbsolutePath() +
-                    ". You can copy it to only.xml by the following cmd:" +
-                    "\rcp " + temp.getAbsolutePath() + " " +
-                    Paths.get("./src/test/resources/runtimets/only.xml").toAbsolutePath());
+            System.err.println("The failed.xml is written to :" + temp.getAbsolutePath()
+                    + ". You can copy it to only.xml by the following cmd:" + "\rcp " + temp.getAbsolutePath() + " "
+                    + Paths.get("./src/test/resources/runtimets/only.xml").toAbsolutePath());
         }
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/test/java/org/apache/asterix/test/runtime/RepeatedTest.java
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/java/org/apache/asterix/test/runtime/RepeatedTest.java b/asterix-app/src/test/java/org/apache/asterix/test/runtime/RepeatedTest.java
index 370b8a1..edb05d4 100644
--- a/asterix-app/src/test/java/org/apache/asterix/test/runtime/RepeatedTest.java
+++ b/asterix-app/src/test/java/org/apache/asterix/test/runtime/RepeatedTest.java
@@ -32,13 +32,12 @@ import org.junit.runners.Parameterized.Parameters;
 import org.junit.runners.model.FrameworkMethod;
 import org.junit.runners.model.Statement;
 
-import org.apache.asterix.test.aql.TestsUtils;
+import org.apache.asterix.test.aql.TestExecutor;
 import org.apache.asterix.test.runtime.RepeatRule.Repeat;
 import org.apache.asterix.testframework.context.TestCaseContext;
 
 /**
  * Runs runtime test cases that have been identified in the repeatedtestsuite.xml.
- * 
  * Each test is run 10000 times.
  */
 class RepeatRule implements MethodRule {
@@ -85,7 +84,8 @@ class RepeatRule implements MethodRule {
 public class RepeatedTest extends ExecutionTest {
 
     private int count;
-    
+    private final TestExecutor testExecutor = new TestExecutor();
+
     @Parameters
     public static Collection<Object[]> tests() throws Exception {
         Collection<Object[]> testArgs = buildTestsInXml(TestCaseContext.DEFAULT_REPEADED_TESTSUITE_XML_NAME);
@@ -104,6 +104,6 @@ public class RepeatedTest extends ExecutionTest {
     @Repeat(times = 10000)
     public void test() throws Exception {
         System.err.println("***** Test Count: " + (++count) + " ******");
-        TestsUtils.executeTest(PATH_ACTUAL, tcCtx, null, false);
+        testExecutor.executeTest(PATH_ACTUAL, tcCtx, null, false);
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/test/java/org/apache/asterix/test/sqlpp/OptimizerParserTest.java
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/java/org/apache/asterix/test/sqlpp/OptimizerParserTest.java b/asterix-app/src/test/java/org/apache/asterix/test/sqlpp/OptimizerParserTest.java
new file mode 100644
index 0000000..61c6064
--- /dev/null
+++ b/asterix-app/src/test/java/org/apache/asterix/test/sqlpp/OptimizerParserTest.java
@@ -0,0 +1,133 @@
+/*
+ * 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.test.sqlpp;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.logging.Logger;
+
+import org.apache.asterix.test.base.AsterixTestHelper;
+import org.apache.asterix.test.common.TestHelper;
+import org.junit.AfterClass;
+import org.junit.Assume;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.junit.internal.AssumptionViolatedException;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+import org.junit.runners.Parameterized.Parameters;
+
+@RunWith(Parameterized.class)
+public class OptimizerParserTest {
+
+    private static final Logger LOGGER = Logger.getLogger(OptimizerParserTest.class.getName());
+
+    private static final String SEPARATOR = File.separator;
+    private static final String EXTENSION_QUERY = "sqlpp";
+    private static final String EXTENSION_RESULT = "ast";
+    private static final String FILENAME_IGNORE = "ignore.txt";
+    private static final String FILENAME_ONLY = "only.txt";
+    private static final String PATH_BASE = "src" + SEPARATOR + "test" + SEPARATOR + "resources" + SEPARATOR
+            + "optimizerts" + SEPARATOR;
+    private static final String PATH_QUERIES = PATH_BASE + "queries_sqlpp" + SEPARATOR;
+    private static final String PATH_EXPECTED = PATH_BASE + "results_parser_sqlpp" + SEPARATOR;
+    private static final String PATH_ACTUAL = "opt_parserts" + SEPARATOR;
+
+    private static final ArrayList<String> ignore = AsterixTestHelper.readFile(FILENAME_IGNORE, PATH_BASE);
+    private static final ArrayList<String> only = AsterixTestHelper.readFile(FILENAME_ONLY, PATH_BASE);
+
+    @BeforeClass
+    public static void setUp() throws Exception {
+        System.err.println("Starting SQL++ parser tests for runtime test queries");
+    }
+
+    @AfterClass
+    public static void tearDown() throws Exception {
+        File outdir = new File(PATH_ACTUAL);
+        File[] files = outdir.listFiles();
+        if (files == null || files.length == 0) {
+            outdir.delete();
+        }
+    }
+
+    private static void suiteBuild(File dir, Collection<Object[]> testArgs, String path) {
+        for (File file : dir.listFiles()) {
+            if (file.isDirectory() && !file.getName().startsWith(".")) {
+                suiteBuild(file, testArgs, path + file.getName() + SEPARATOR);
+            }
+            if (file.isFile() && file.getName().endsWith(EXTENSION_QUERY)) {
+                String resultFileName = AsterixTestHelper.extToResExt(file.getName(), EXTENSION_RESULT);
+                File expectedFile = new File(PATH_EXPECTED + path + resultFileName);
+                File actualFile = new File(PATH_ACTUAL + SEPARATOR + path.replace(SEPARATOR, "_") + resultFileName);
+                testArgs.add(new Object[] { file, expectedFile, actualFile });
+            }
+        }
+    }
+
+    @Parameters
+    public static Collection<Object[]> tests() {
+        Collection<Object[]> testArgs = new ArrayList<Object[]>();
+        suiteBuild(new File(PATH_QUERIES), testArgs, "");
+        return testArgs;
+    }
+
+    private File actualFile;
+    private File expectedFile;
+    private File queryFile;
+
+    private ParserTestExecutor parserTestExecutor = new ParserTestExecutor();
+
+    public OptimizerParserTest(File queryFile, File expectedFile, File actualFile) {
+        this.queryFile = queryFile;
+        this.expectedFile = expectedFile;
+        this.actualFile = actualFile;
+    }
+
+    @Test
+    public void test() throws Exception {
+        try {
+            String queryFileShort = queryFile.getPath().substring(PATH_QUERIES.length()).replace(SEPARATOR.charAt(0),
+                    '/');
+            if (!only.isEmpty()) {
+                boolean toRun = TestHelper.isInPrefixList(only, queryFileShort);
+                if (!toRun) {
+                    LOGGER.info("SKIP TEST: \"" + queryFile.getPath()
+                            + "\" \"only.txt\" not empty and not in \"only.txt\".");
+                }
+                Assume.assumeTrue(toRun);
+            }
+            boolean skipped = TestHelper.isInPrefixList(ignore, queryFileShort);
+            if (skipped) {
+                LOGGER.info("SKIP TEST: \"" + queryFile.getPath() + "\" in \"ignore.txt\".");
+            }
+            Assume.assumeTrue(!skipped);
+
+            LOGGER.info("RUN TEST: \"" + queryFile.getPath() + "\"");
+            parserTestExecutor.testSQLPPParser(queryFile, actualFile, expectedFile);
+        } catch (Exception e) {
+            if (!(e instanceof AssumptionViolatedException)) {
+                LOGGER.severe("Test \"" + queryFile.getPath() + "\" FAILED!");
+                throw new Exception("Test \"" + queryFile.getPath() + "\" FAILED!", e);
+            } else {
+                throw e;
+            }
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/test/java/org/apache/asterix/test/sqlpp/ParserTestExecutor.java
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/java/org/apache/asterix/test/sqlpp/ParserTestExecutor.java b/asterix-app/src/test/java/org/apache/asterix/test/sqlpp/ParserTestExecutor.java
new file mode 100644
index 0000000..79ad9ed
--- /dev/null
+++ b/asterix-app/src/test/java/org/apache/asterix/test/sqlpp/ParserTestExecutor.java
@@ -0,0 +1,172 @@
+/*
+ * 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.test.sqlpp;
+
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.InputStreamReader;
+import java.io.PrintWriter;
+import java.io.Reader;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.asterix.common.config.GlobalConfig;
+import org.apache.asterix.common.exceptions.AsterixException;
+import org.apache.asterix.lang.common.base.Statement;
+import org.apache.asterix.lang.common.base.Statement.Kind;
+import org.apache.asterix.lang.common.statement.DataverseDecl;
+import org.apache.asterix.lang.common.statement.FunctionDecl;
+import org.apache.asterix.lang.common.statement.Query;
+import org.apache.asterix.lang.sqlpp.parser.SQLPPParser;
+import org.apache.asterix.lang.sqlpp.rewrites.SqlppRewriter;
+import org.apache.asterix.lang.sqlpp.util.FunctionUtils;
+import org.apache.asterix.lang.sqlpp.util.SqlppAstPrintUtil;
+import org.apache.asterix.metadata.declared.AqlMetadataProvider;
+import org.apache.asterix.test.aql.TestExecutor;
+import org.apache.asterix.testframework.context.TestCaseContext;
+import org.apache.asterix.testframework.context.TestFileContext;
+import org.apache.asterix.testframework.xml.TestCase.CompilationUnit;
+import org.apache.asterix.testframework.xml.TestGroup;
+
+import junit.extensions.PA;
+
+public class ParserTestExecutor extends TestExecutor {
+
+    @Override
+    public void executeTest(String actualPath, TestCaseContext testCaseCtx, ProcessBuilder pb,
+            boolean isDmlRecoveryTest, TestGroup failedGroup) throws Exception {
+        int queryCount = 0;
+        List<CompilationUnit> cUnits = testCaseCtx.getTestCase().getCompilationUnit();
+        for (CompilationUnit cUnit : cUnits) {
+            LOGGER.info(
+                    "Starting [TEST]: " + testCaseCtx.getTestCase().getFilePath() + "/" + cUnit.getName() + " ... ");
+            List<TestFileContext> testFileCtxs = testCaseCtx.getTestFiles(cUnit);
+            List<TestFileContext> expectedResultFileCtxs = testCaseCtx.getExpectedResultFiles(cUnit);
+            for (TestFileContext ctx : testFileCtxs) {
+                File testFile = ctx.getFile();
+                try {
+                    if (queryCount >= expectedResultFileCtxs.size()) {
+                        throw new IllegalStateException("no result file for " + testFile.toString() + "; queryCount: "
+                                + queryCount + ", filectxs.size: " + expectedResultFileCtxs.size());
+                    }
+
+                    // Runs the test query.
+                    File actualResultFile = testCaseCtx.getActualResultFile(cUnit, new File(actualPath));
+                    File expectedResultFile = expectedResultFileCtxs.get(queryCount).getFile();
+                    testSQLPPParser(testFile, actualResultFile, expectedResultFile);
+
+                    LOGGER.info(
+                            "[TEST]: " + testCaseCtx.getTestCase().getFilePath() + "/" + cUnit.getName() + " PASSED ");
+                    queryCount++;
+                } catch (Exception e) {
+                    System.err.println("testFile " + testFile.toString() + " raised an exception:");
+                    e.printStackTrace();
+                    if (cUnit.getExpectedError().isEmpty()) {
+                        System.err.println("...Unexpected!");
+                        if (failedGroup != null) {
+                            failedGroup.getTestCase().add(testCaseCtx.getTestCase());
+                        }
+                        throw new Exception("Test \"" + testFile + "\" FAILED!", e);
+                    } else {
+                        LOGGER.info("[TEST]: " + testCaseCtx.getTestCase().getFilePath() + "/" + cUnit.getName()
+                                + " failed as expected: " + e.getMessage());
+                        System.err.println("...but that was expected.");
+                    }
+                }
+            }
+        }
+
+    }
+
+    // Tests the SQL++ parser.
+    public void testSQLPPParser(File queryFile, File actualResultFile, File expectedFile) throws Exception {
+        Reader reader = new BufferedReader(new InputStreamReader(new FileInputStream(queryFile), "UTF-8"));
+        actualResultFile.getParentFile().mkdirs();
+        PrintWriter writer = new PrintWriter(new FileOutputStream(actualResultFile));
+        SQLPPParser parser = new SQLPPParser(reader);
+        GlobalConfig.ASTERIX_LOGGER.info(queryFile.toString());
+        try {
+            List<Statement> statements = parser.parse();
+            List<FunctionDecl> functions = getDeclaredFunctions(statements);
+            String dvName = getDefaultDataverse(statements);
+            AqlMetadataProvider aqlMetadataProvider = mock(AqlMetadataProvider.class);
+
+            @SuppressWarnings("unchecked")
+            Map<String, String> config = mock(Map.class);
+            when(aqlMetadataProvider.getDefaultDataverseName()).thenReturn(dvName);
+            when(aqlMetadataProvider.getConfig()).thenReturn(config);
+            when(config.get(FunctionUtils.IMPORT_PRIVATE_FUNCTIONS)).thenReturn("true");
+
+            for (Statement st : statements) {
+                if (st.getKind() == Kind.QUERY) {
+                    Query query = (Query) st;
+                    SqlppRewriter rewriter = new SqlppRewriter(functions, query, aqlMetadataProvider);
+                    rewrite(rewriter);
+                }
+                SqlppAstPrintUtil.print(st, writer);
+            }
+            writer.close();
+            // Compares the actual result and the expected result.
+            runScriptAndCompareWithResult(queryFile, new PrintWriter(System.err), expectedFile, actualResultFile);
+        } catch (Exception e) {
+            GlobalConfig.ASTERIX_LOGGER.warning("Failed while testing file " + reader);
+            throw e;
+        } finally {
+            reader.close();
+            writer.close();
+        }
+    }
+
+    // Extracts declared functions.
+    private List<FunctionDecl> getDeclaredFunctions(List<Statement> statements) {
+        List<FunctionDecl> functionDecls = new ArrayList<FunctionDecl>();
+        for (Statement st : statements) {
+            if (st.getKind().equals(Statement.Kind.FUNCTION_DECL)) {
+                functionDecls.add((FunctionDecl) st);
+            }
+        }
+        return functionDecls;
+    }
+
+    // Gets the default dataverse for the input statements.
+    private String getDefaultDataverse(List<Statement> statements) {
+        for (Statement st : statements) {
+            if (st.getKind().equals(Statement.Kind.DATAVERSE_DECL)) {
+                DataverseDecl dv = (DataverseDecl) st;
+                return dv.getDataverseName().getValue();
+            }
+        }
+        return null;
+    }
+
+    // Rewrite queries.
+    // Note: we do not do inline function rewriting here because this needs real
+    // metadata access.
+    private void rewrite(SqlppRewriter rewriter) throws AsterixException {
+        PA.invokeMethod(rewriter, "inlineColumnAlias()");
+        PA.invokeMethod(rewriter, "variableCheckAndRewrite()");
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/test/java/org/apache/asterix/test/sqlpp/RuntimeParserTest.java
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/java/org/apache/asterix/test/sqlpp/RuntimeParserTest.java b/asterix-app/src/test/java/org/apache/asterix/test/sqlpp/RuntimeParserTest.java
new file mode 100644
index 0000000..aca1e13
--- /dev/null
+++ b/asterix-app/src/test/java/org/apache/asterix/test/sqlpp/RuntimeParserTest.java
@@ -0,0 +1,94 @@
+/*
+ * 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.test.sqlpp;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.logging.Logger;
+
+import org.apache.asterix.test.aql.TestExecutor;
+import org.apache.asterix.testframework.context.TestCaseContext;
+import org.apache.commons.lang3.StringUtils;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+import org.junit.runners.Parameterized.Parameters;
+
+/**
+ * Runs the runtime test cases under
+ * 'asterix-app/src/test/resources/runtimets/queries_sqlpp'.
+ */
+@RunWith(Parameterized.class)
+public class RuntimeParserTest {
+
+    protected static final Logger LOGGER = Logger.getLogger(RuntimeParserTest.class.getName());
+
+    protected static final String PATH_ACTUAL = "runtime_parserts" + File.separator;
+    protected static final String PATH_BASE = StringUtils.join(new String[] { "src", "test", "resources", "runtimets" },
+            File.separator);
+
+    private final TestExecutor testExecutor = new ParserTestExecutor();
+
+    @BeforeClass
+    public static void setUp() throws Exception {
+        System.err.println("Starting SQL++ parser tests for runtime test queries");
+    }
+
+    @AfterClass
+    public static void tearDown() throws Exception {
+        File outdir = new File(PATH_ACTUAL);
+        File[] files = outdir.listFiles();
+        if (files == null || files.length == 0) {
+            outdir.delete();
+        }
+    }
+
+    @Parameters
+    public static Collection<Object[]> tests() throws Exception {
+        Collection<Object[]> testArgs = buildTestsInXml(TestCaseContext.ONLY_TESTSUITE_XML_NAME);
+        if (testArgs.size() == 0) {
+            testArgs = buildTestsInXml("testsuite_sqlpp_parser.xml");
+        }
+        return testArgs;
+    }
+
+    protected static Collection<Object[]> buildTestsInXml(String xmlfile) throws Exception {
+        Collection<Object[]> testArgs = new ArrayList<Object[]>();
+        TestCaseContext.Builder b = new TestCaseContext.Builder();
+        for (TestCaseContext ctx : b.build(new File(PATH_BASE), xmlfile)) {
+            testArgs.add(new Object[] { ctx });
+        }
+        return testArgs;
+    }
+
+    protected TestCaseContext tcCtx;
+
+    public RuntimeParserTest(TestCaseContext tcCtx) {
+        this.tcCtx = tcCtx;
+    }
+
+    @Test
+    public void test() throws Exception {
+        testExecutor.executeTest(PATH_ACTUAL, tcCtx, null, false);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/test/java/org/apache/asterix/test/sqlpp/SmokeParserTest.java
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/java/org/apache/asterix/test/sqlpp/SmokeParserTest.java b/asterix-app/src/test/java/org/apache/asterix/test/sqlpp/SmokeParserTest.java
new file mode 100644
index 0000000..a924d7c
--- /dev/null
+++ b/asterix-app/src/test/java/org/apache/asterix/test/sqlpp/SmokeParserTest.java
@@ -0,0 +1,133 @@
+/*
+ * 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.test.sqlpp;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.logging.Logger;
+
+import org.apache.asterix.test.base.AsterixTestHelper;
+import org.apache.asterix.test.common.TestHelper;
+import org.junit.AfterClass;
+import org.junit.Assume;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.junit.internal.AssumptionViolatedException;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+import org.junit.runners.Parameterized.Parameters;
+
+@RunWith(Parameterized.class)
+public class SmokeParserTest {
+
+    private static final Logger LOGGER = Logger.getLogger(SmokeParserTest.class.getName());
+
+    private static final String SEPARATOR = File.separator;
+    private static final String EXTENSION_QUERY = "sqlpp";
+    private static final String EXTENSION_RESULT = "ast";
+    private static final String FILENAME_IGNORE = "ignore.txt";
+    private static final String FILENAME_ONLY = "only.txt";
+    private static final String PATH_BASE = "src" + SEPARATOR + "test" + SEPARATOR + "resources" + SEPARATOR
+            + "parserts" + SEPARATOR;
+    private static final String PATH_QUERIES = PATH_BASE + "queries_sqlpp" + SEPARATOR;
+    private static final String PATH_EXPECTED = PATH_BASE + "results_parser_sqlpp" + SEPARATOR;
+    private static final String PATH_ACTUAL = "parserts" + SEPARATOR;
+
+    private static final ArrayList<String> ignore = AsterixTestHelper.readFile(FILENAME_IGNORE, PATH_BASE);
+    private static final ArrayList<String> only = AsterixTestHelper.readFile(FILENAME_ONLY, PATH_BASE);
+
+    @BeforeClass
+    public static void setUp() throws Exception {
+        System.err.println("Starting SQL++ parser smoke tests");
+    }
+
+    @AfterClass
+    public static void tearDown() throws Exception {
+        File outdir = new File(PATH_ACTUAL);
+        File[] files = outdir.listFiles();
+        if (files == null || files.length == 0) {
+            outdir.delete();
+        }
+    }
+
+    private static void suiteBuild(File dir, Collection<Object[]> testArgs, String path) {
+        for (File file : dir.listFiles()) {
+            if (file.isDirectory() && !file.getName().startsWith(".")) {
+                suiteBuild(file, testArgs, path + file.getName() + SEPARATOR);
+            }
+            if (file.isFile() && file.getName().endsWith(EXTENSION_QUERY)) {
+                String resultFileName = AsterixTestHelper.extToResExt(file.getName(), EXTENSION_RESULT);
+                File expectedFile = new File(PATH_EXPECTED + path + resultFileName);
+                File actualFile = new File(PATH_ACTUAL + SEPARATOR + path.replace(SEPARATOR, "_") + resultFileName);
+                testArgs.add(new Object[] { file, expectedFile, actualFile });
+            }
+        }
+    }
+
+    @Parameters
+    public static Collection<Object[]> tests() {
+        Collection<Object[]> testArgs = new ArrayList<Object[]>();
+        suiteBuild(new File(PATH_QUERIES), testArgs, "");
+        return testArgs;
+    }
+
+    private File actualFile;
+    private File expectedFile;
+    private File queryFile;
+
+    private ParserTestExecutor parserTestExecutor = new ParserTestExecutor();
+
+    public SmokeParserTest(File queryFile, File expectedFile, File actualFile) {
+        this.queryFile = queryFile;
+        this.expectedFile = expectedFile;
+        this.actualFile = actualFile;
+    }
+
+    @Test
+    public void test() throws Exception {
+        try {
+            String queryFileShort = queryFile.getPath().substring(PATH_QUERIES.length()).replace(SEPARATOR.charAt(0),
+                    '/');
+            if (!only.isEmpty()) {
+                boolean toRun = TestHelper.isInPrefixList(only, queryFileShort);
+                if (!toRun) {
+                    LOGGER.info("SKIP TEST: \"" + queryFile.getPath()
+                            + "\" \"only.txt\" not empty and not in \"only.txt\".");
+                }
+                Assume.assumeTrue(toRun);
+            }
+            boolean skipped = TestHelper.isInPrefixList(ignore, queryFileShort);
+            if (skipped) {
+                LOGGER.info("SKIP TEST: \"" + queryFile.getPath() + "\" in \"ignore.txt\".");
+            }
+            Assume.assumeTrue(!skipped);
+
+            LOGGER.info("RUN TEST: \"" + queryFile.getPath() + "\"");
+            parserTestExecutor.testSQLPPParser(queryFile, actualFile, expectedFile);
+        } catch (Exception e) {
+            if (!(e instanceof AssumptionViolatedException)) {
+                LOGGER.severe("Test \"" + queryFile.getPath() + "\" FAILED!");
+                throw new Exception("Test \"" + queryFile.getPath() + "\" FAILED!", e);
+            } else {
+                throw e;
+            }
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/test/resources/AQLTS/queries-sql-like/1.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/AQLTS/queries-sql-like/1.aql b/asterix-app/src/test/resources/AQLTS/queries-sql-like/1.aql
deleted file mode 100644
index e13643a..0000000
--- a/asterix-app/src/test/resources/AQLTS/queries-sql-like/1.aql
+++ /dev/null
@@ -1,21 +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.
- */
-from $user in dataset('User')
-where some $i in $user.interests satisfies $i = "movies"
-select { "name": $user.name }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/test/resources/AQLTS/queries-sql-like/2.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/AQLTS/queries-sql-like/2.aql b/asterix-app/src/test/resources/AQLTS/queries-sql-like/2.aql
deleted file mode 100644
index 4571288..0000000
--- a/asterix-app/src/test/resources/AQLTS/queries-sql-like/2.aql
+++ /dev/null
@@ -1,30 +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.
- */
-from $event in dataset('Event')
-from $sponsor in $event.sponsoring_sigs
-with $es := { "event": $event, "sponsor": $sponsor }
-group by $sig_name := $sponsor.sig_name keeping $es
-with $sig_sponsorship_count := count($es)
-with $by_chapter :=
-   from $e in $es
-   group by $chapter_name := $e.sponsor.chapter_name keeping $es
-   select { "chapter_name": $chapter_name, "escount" : count($es) }
-order by $sig_sponsorship_count desc
-limit 5
-select { "sig_name": $sig_name, "total_count": $sig_sponsorship_count, "chapter_breakdown": $by_chapter }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/test/resources/AQLTS/queries-sql-like/4.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/AQLTS/queries-sql-like/4.aql b/asterix-app/src/test/resources/AQLTS/queries-sql-like/4.aql
deleted file mode 100644
index f60795b..0000000
--- a/asterix-app/src/test/resources/AQLTS/queries-sql-like/4.aql
+++ /dev/null
@@ -1,26 +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.
- */
-from $sig in dataset('SIGroup')
-where $sig.name = "Movie-Watchers"
-with $similar_sigs :=
-   from $similar_sig in dataset('SIGroup')
-   where $similar_sig != $sig
-   and $similar_sig.interests ~= $sig.interests
-   select { "sig_name" : $similar_sig.name }
-select { "similar_sigs" : $similar_sigs }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/test/resources/AQLTS/queries-sql-like/5.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/AQLTS/queries-sql-like/5.aql b/asterix-app/src/test/resources/AQLTS/queries-sql-like/5.aql
deleted file mode 100644
index 2687bf1..0000000
--- a/asterix-app/src/test/resources/AQLTS/queries-sql-like/5.aql
+++ /dev/null
@@ -1,28 +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.
- */
-from $event in dataset('Event')
-where $event.name = "The Night of the Ad Eaters, 29th edition"
-with $collocated_events :=
-   from $collocated_event in dataset('Events')
-   where $collocated_event.location.street ~= $event.location.street
-   and $collocated_event.location.city = $event.location.city
-   and $collocated_event.location.state = $event.location.state
-   and $collocated_event.location.zip = $event.location.zip
-   select { "event_name" : $collocated_event.name }
-select { "collocated_evnets" : $collocated_events }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/test/resources/AQLTS/queries-sql-like/6.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/AQLTS/queries-sql-like/6.aql b/asterix-app/src/test/resources/AQLTS/queries-sql-like/6.aql
deleted file mode 100644
index 1dd358f..0000000
--- a/asterix-app/src/test/resources/AQLTS/queries-sql-like/6.aql
+++ /dev/null
@@ -1,28 +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.
- */
-from $user in dataset('Users')
-with $similar_users :=
-   from $similar_user in dataset('Users')
-   with $similarity := jaccard_similarity($user.interests, $similar_user.interests)
-   where $user != $similar_user
-   and $similarity >= .75
-   order by $similarity desc
-   limit 10
-   select { "user_name" : $similar_user.name, "similarity" : $similarity }
-select { "user_name" : $user.name, "similar_users" : $similar_users }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/test/resources/AQLTS/queries-sql-like/ANYInFieldAccessor.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/AQLTS/queries-sql-like/ANYInFieldAccessor.aql b/asterix-app/src/test/resources/AQLTS/queries-sql-like/ANYInFieldAccessor.aql
deleted file mode 100644
index 12e3f96..0000000
--- a/asterix-app/src/test/resources/AQLTS/queries-sql-like/ANYInFieldAccessor.aql
+++ /dev/null
@@ -1,22 +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.
- */
-from $user in dataset('User')
-from $mv in dataset('Movie')
-where some $i in $user.interests satisfies $i.movie = $mv.movie[?]
-select { "name": $user.name, "movie": $mv.movie }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/test/resources/AQLTS/queries-sql-like/IfInFLOWGR.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/AQLTS/queries-sql-like/IfInFLOWGR.aql b/asterix-app/src/test/resources/AQLTS/queries-sql-like/IfInFLOWGR.aql
deleted file mode 100644
index cf65175..0000000
--- a/asterix-app/src/test/resources/AQLTS/queries-sql-like/IfInFLOWGR.aql
+++ /dev/null
@@ -1,21 +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.
- */
-from $i in [1,2,30,40]
-from $j in {{4,5,6}}
-select if ($i>$j) then $i else $j

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/test/resources/AQLTS/queries-sql-like/ListConstructor.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/AQLTS/queries-sql-like/ListConstructor.aql b/asterix-app/src/test/resources/AQLTS/queries-sql-like/ListConstructor.aql
deleted file mode 100644
index b4ced83..0000000
--- a/asterix-app/src/test/resources/AQLTS/queries-sql-like/ListConstructor.aql
+++ /dev/null
@@ -1,21 +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.
- */
-from $i in [1,2,3]
-from $j in {{4,5,6}}
-select $i+$j

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/test/resources/AQLTS/queries-sql-like/WithFrom.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/AQLTS/queries-sql-like/WithFrom.aql b/asterix-app/src/test/resources/AQLTS/queries-sql-like/WithFrom.aql
deleted file mode 100644
index a384e16..0000000
--- a/asterix-app/src/test/resources/AQLTS/queries-sql-like/WithFrom.aql
+++ /dev/null
@@ -1,22 +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.
- */
-with $users := dataset('User')
-from $user in $users
-where some $i in $user.interests satisfies $i = "movies"
-select { "name": $user.name }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/test/resources/AQLTS/queries-sql-like/fieldAccessor.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/AQLTS/queries-sql-like/fieldAccessor.aql b/asterix-app/src/test/resources/AQLTS/queries-sql-like/fieldAccessor.aql
deleted file mode 100644
index 667821d..0000000
--- a/asterix-app/src/test/resources/AQLTS/queries-sql-like/fieldAccessor.aql
+++ /dev/null
@@ -1,21 +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.
- */
-with $bla := { "name" : "value" }
-return
-  $bla."name" = $bla.name

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/test/resources/AQLTS/queries-sql-like/functionDecl1.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/AQLTS/queries-sql-like/functionDecl1.aql b/asterix-app/src/test/resources/AQLTS/queries-sql-like/functionDecl1.aql
deleted file mode 100644
index 6b0364c..0000000
--- a/asterix-app/src/test/resources/AQLTS/queries-sql-like/functionDecl1.aql
+++ /dev/null
@@ -1,35 +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.
- */
-declare function calculate($events){
-from $event in $events
-from $sponsor in $event.sponsoring_sigs
-with $es := { "event": $event, "sponsor": $sponsor }
-group by $sig_name := $sponsor.sig_name keeping $es
-with $sig_sponsorship_count := count($es)
-with $by_chapter :=
-   from $e in $es
-   group by $chapter_name := $e.sponsor.chapter_name keeping $es
-   select { "chapter_name": $chapter_name, "escount" : count($es) }
-order by $sig_sponsorship_count desc
-limit 5
-select { "sig_name": $sig_name, "total_count": $sig_sponsorship_count, "chapter_breakdown": $by_chapter }
-}
-
-with $result := calculate(dataset('Events'))
-select $result

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/test/resources/AQLTS/queries-sql-like/nestedFLWOGR.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/AQLTS/queries-sql-like/nestedFLWOGR.aql b/asterix-app/src/test/resources/AQLTS/queries-sql-like/nestedFLWOGR.aql
deleted file mode 100644
index 95a0e22..0000000
--- a/asterix-app/src/test/resources/AQLTS/queries-sql-like/nestedFLWOGR.aql
+++ /dev/null
@@ -1,23 +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.
- */
-from $user in
-    with $data := dataset('User')
-    select $data
-where some $i in $user.interests satisfies $i = "movies"
-select { "name": $user.name }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/test/resources/AQLTS/queries-sql-like/nestedFLWOGR1.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/AQLTS/queries-sql-like/nestedFLWOGR1.aql b/asterix-app/src/test/resources/AQLTS/queries-sql-like/nestedFLWOGR1.aql
deleted file mode 100644
index db114e4..0000000
--- a/asterix-app/src/test/resources/AQLTS/queries-sql-like/nestedFLWOGR1.aql
+++ /dev/null
@@ -1,24 +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.
- */
-from $i in [1,2,30,40]
-from $j in {{4,5,6}}
-select
-    from $k in if ($i>$j) then $i else $j
-    where $k <10
-    select $k

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/test/resources/AQLTS/queries-sql-like/nestedFLWOGR2.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/AQLTS/queries-sql-like/nestedFLWOGR2.aql b/asterix-app/src/test/resources/AQLTS/queries-sql-like/nestedFLWOGR2.aql
deleted file mode 100644
index c9d772e..0000000
--- a/asterix-app/src/test/resources/AQLTS/queries-sql-like/nestedFLWOGR2.aql
+++ /dev/null
@@ -1,24 +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.
- */
-from $i in [1,2,30,from $tmp in dataset('number') select $tmp]
-from $j in {{4,5,6}}
-select
-    from $k in if ($i>$j) then $i else $j
-    where $k <10
-    select $k