Repository: asterixdb
Updated Branches:
  refs/heads/master 4b30d7901 -> e4b318f65


http://git-wip-us.apache.org/repos/asf/asterixdb/blob/e4b318f6/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite-open/query-ASTERIXDB-1263.23.ast
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite-open/query-ASTERIXDB-1263.23.ast
 
b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite-open/query-ASTERIXDB-1263.23.ast
deleted file mode 100644
index 73652a0..0000000
--- 
a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite-open/query-ASTERIXDB-1263.23.ast
+++ /dev/null
@@ -1,81 +0,0 @@
-DataverseUse TinySocial
-Query:
-SELECT [
-Variable [ Name=$h ]
-hour
-FunctionCall TinySocial.sql-count@1[
-  (
-    SELECT ELEMENT [
-    FieldAccessor [
-      Variable [ Name=#4 ]
-      Field=t
-    ]
-    ]
-    FROM [      Variable [ Name=#1 ]
-      AS Variable [ Name=#4 ]
-    ]
-  )
-]
-count
-(
-  SELECT [
-  Variable [ Name=$min ]
-  minute
-  FunctionCall TinySocial.sql-count@1[
-    (
-      SELECT ELEMENT [
-      FieldAccessor [
-        Variable [ Name=#3 ]
-        Field=k
-      ]
-      ]
-      FROM [        Variable [ Name=#2 ]
-        AS Variable [ Name=#3 ]
-      ]
-    )
-  ]
-  sum
-  ]
-  FROM [    Variable [ Name=$t ]
-    AS Variable [ Name=$k ]
-  ]
-  Groupby
-    Variable [ Name=$min ]
-    :=
-    FunctionCall TinySocial.get-minute@1[
-      FieldAccessor [
-        Variable [ Name=$k ]
-        Field=send-time
-      ]
-    ]
-    GROUP AS Variable [ Name=#2 ]
-    (
-      k:=Variable [ Name=$k ]
-    )
-
-  Orderby
-    Variable [ Name=$min ]
-    ASC
-
-)
-finer
-]
-FROM [  FunctionCall Metadata.dataset@1[
-    LiteralExpr [STRING] [TweetMessages]
-  ]
-  AS Variable [ Name=$t ]
-]
-Groupby
-  Variable [ Name=$h ]
-  :=
-  FunctionCall TinySocial.get-hour@1[
-    FieldAccessor [
-      Variable [ Name=$t ]
-      Field=send-time
-    ]
-  ]
-  GROUP AS Variable [ Name=#1 ]
-  (
-    t:=Variable [ Name=$t ]
-  )
-

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/e4b318f6/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite-open/query-ASTERIXDB-1329.24.ast
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite-open/query-ASTERIXDB-1329.24.ast
 
b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite-open/query-ASTERIXDB-1329.24.ast
deleted file mode 100644
index 06fdeb4..0000000
--- 
a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite-open/query-ASTERIXDB-1329.24.ast
+++ /dev/null
@@ -1,84 +0,0 @@
-DataverseUse TinySocial
-Query:
-SELECT [
-FieldAccessor [
-  Variable [ Name=$user ]
-  Field=name
-]
-uname
-FieldAccessor [
-  Variable [ Name=$user ]
-  Field=alias
-]
-alias
-FunctionCall TinySocial.substring@2[
-  FieldAccessor [
-    Variable [ Name=$message ]
-    Field=message
-  ]
-  LiteralExpr [LONG] [30]
-]
-msg
-]
-FROM [  FunctionCall Metadata.dataset@1[
-    LiteralExpr [STRING] [FacebookMessages]
-  ]
-  AS Variable [ Name=$message ]
-,
-  FunctionCall Metadata.dataset@1[
-    LiteralExpr [STRING] [FacebookUsers]
-  ]
-  AS Variable [ Name=$user ]
-]
-Where
-  OperatorExpr [
-    OperatorExpr [
-      FieldAccessor [
-        Variable [ Name=$message ]
-        Field=author-id
-      ]
-      =
-      FieldAccessor [
-        Variable [ Name=$user ]
-        Field=id
-      ]
-    ]
-    and
-    OperatorExpr [
-      FieldAccessor [
-        Variable [ Name=$message ]
-        Field=in-response-to
-      ]
-      >=
-      LiteralExpr [LONG] [1]
-    ]
-    and
-    OperatorExpr [
-      FieldAccessor [
-        Variable [ Name=$message ]
-        Field=in-response-to
-      ]
-      <
-      LiteralExpr [LONG] [11]
-    ]
-  ]
-Orderby
-  FieldAccessor [
-    Variable [ Name=$user ]
-    Field=name
-  ]
-  ASC
-  FieldAccessor [
-    Variable [ Name=$user ]
-    Field=alias
-  ]
-  ASC
-  FunctionCall TinySocial.substring@2[
-    FieldAccessor [
-      Variable [ Name=$message ]
-      Field=message
-    ]
-    LiteralExpr [LONG] [30]
-  ]
-  ASC
-

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/e4b318f6/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite-open/query-ASTERIXDB-1331.25.ast
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite-open/query-ASTERIXDB-1331.25.ast
 
b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite-open/query-ASTERIXDB-1331.25.ast
deleted file mode 100644
index 50e0060..0000000
--- 
a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite-open/query-ASTERIXDB-1331.25.ast
+++ /dev/null
@@ -1,41 +0,0 @@
-DataverseUse TinySocial
-Query:
-SELECT ELEMENT [
-FunctionCall TinySocial.avg@1[
-  (
-    SELECT ELEMENT [
-    FunctionCall TinySocial.string-length@1[
-      FieldAccessor [
-        Variable [ Name=$message ]
-        Field=message
-      ]
-    ]
-    ]
-    FROM [      FunctionCall Metadata.dataset@1[
-        LiteralExpr [STRING] [FacebookMessages]
-      ]
-      AS Variable [ Name=$message ]
-    ]
-    Where
-      OperatorExpr [
-        OperatorExpr [
-          FieldAccessor [
-            Variable [ Name=$message ]
-            Field=in-response-to
-          ]
-          >=
-          LiteralExpr [LONG] [1]
-        ]
-        and
-        OperatorExpr [
-          FieldAccessor [
-            Variable [ Name=$message ]
-            Field=in-response-to
-          ]
-          <
-          LiteralExpr [LONG] [11]
-        ]
-      ]
-  )
-]
-]

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/e4b318f6/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite-open/tinysocial-suite.23.ast
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite-open/tinysocial-suite.23.ast
 
b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite-open/tinysocial-suite.23.ast
new file mode 100644
index 0000000..73652a0
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite-open/tinysocial-suite.23.ast
@@ -0,0 +1,81 @@
+DataverseUse TinySocial
+Query:
+SELECT [
+Variable [ Name=$h ]
+hour
+FunctionCall TinySocial.sql-count@1[
+  (
+    SELECT ELEMENT [
+    FieldAccessor [
+      Variable [ Name=#4 ]
+      Field=t
+    ]
+    ]
+    FROM [      Variable [ Name=#1 ]
+      AS Variable [ Name=#4 ]
+    ]
+  )
+]
+count
+(
+  SELECT [
+  Variable [ Name=$min ]
+  minute
+  FunctionCall TinySocial.sql-count@1[
+    (
+      SELECT ELEMENT [
+      FieldAccessor [
+        Variable [ Name=#3 ]
+        Field=k
+      ]
+      ]
+      FROM [        Variable [ Name=#2 ]
+        AS Variable [ Name=#3 ]
+      ]
+    )
+  ]
+  sum
+  ]
+  FROM [    Variable [ Name=$t ]
+    AS Variable [ Name=$k ]
+  ]
+  Groupby
+    Variable [ Name=$min ]
+    :=
+    FunctionCall TinySocial.get-minute@1[
+      FieldAccessor [
+        Variable [ Name=$k ]
+        Field=send-time
+      ]
+    ]
+    GROUP AS Variable [ Name=#2 ]
+    (
+      k:=Variable [ Name=$k ]
+    )
+
+  Orderby
+    Variable [ Name=$min ]
+    ASC
+
+)
+finer
+]
+FROM [  FunctionCall Metadata.dataset@1[
+    LiteralExpr [STRING] [TweetMessages]
+  ]
+  AS Variable [ Name=$t ]
+]
+Groupby
+  Variable [ Name=$h ]
+  :=
+  FunctionCall TinySocial.get-hour@1[
+    FieldAccessor [
+      Variable [ Name=$t ]
+      Field=send-time
+    ]
+  ]
+  GROUP AS Variable [ Name=#1 ]
+  (
+    t:=Variable [ Name=$t ]
+  )
+

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/e4b318f6/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite-open/tinysocial-suite.24.ast
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite-open/tinysocial-suite.24.ast
 
b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite-open/tinysocial-suite.24.ast
new file mode 100644
index 0000000..06fdeb4
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite-open/tinysocial-suite.24.ast
@@ -0,0 +1,84 @@
+DataverseUse TinySocial
+Query:
+SELECT [
+FieldAccessor [
+  Variable [ Name=$user ]
+  Field=name
+]
+uname
+FieldAccessor [
+  Variable [ Name=$user ]
+  Field=alias
+]
+alias
+FunctionCall TinySocial.substring@2[
+  FieldAccessor [
+    Variable [ Name=$message ]
+    Field=message
+  ]
+  LiteralExpr [LONG] [30]
+]
+msg
+]
+FROM [  FunctionCall Metadata.dataset@1[
+    LiteralExpr [STRING] [FacebookMessages]
+  ]
+  AS Variable [ Name=$message ]
+,
+  FunctionCall Metadata.dataset@1[
+    LiteralExpr [STRING] [FacebookUsers]
+  ]
+  AS Variable [ Name=$user ]
+]
+Where
+  OperatorExpr [
+    OperatorExpr [
+      FieldAccessor [
+        Variable [ Name=$message ]
+        Field=author-id
+      ]
+      =
+      FieldAccessor [
+        Variable [ Name=$user ]
+        Field=id
+      ]
+    ]
+    and
+    OperatorExpr [
+      FieldAccessor [
+        Variable [ Name=$message ]
+        Field=in-response-to
+      ]
+      >=
+      LiteralExpr [LONG] [1]
+    ]
+    and
+    OperatorExpr [
+      FieldAccessor [
+        Variable [ Name=$message ]
+        Field=in-response-to
+      ]
+      <
+      LiteralExpr [LONG] [11]
+    ]
+  ]
+Orderby
+  FieldAccessor [
+    Variable [ Name=$user ]
+    Field=name
+  ]
+  ASC
+  FieldAccessor [
+    Variable [ Name=$user ]
+    Field=alias
+  ]
+  ASC
+  FunctionCall TinySocial.substring@2[
+    FieldAccessor [
+      Variable [ Name=$message ]
+      Field=message
+    ]
+    LiteralExpr [LONG] [30]
+  ]
+  ASC
+

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/e4b318f6/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite-open/tinysocial-suite.25.ast
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite-open/tinysocial-suite.25.ast
 
b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite-open/tinysocial-suite.25.ast
new file mode 100644
index 0000000..50e0060
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite-open/tinysocial-suite.25.ast
@@ -0,0 +1,41 @@
+DataverseUse TinySocial
+Query:
+SELECT ELEMENT [
+FunctionCall TinySocial.avg@1[
+  (
+    SELECT ELEMENT [
+    FunctionCall TinySocial.string-length@1[
+      FieldAccessor [
+        Variable [ Name=$message ]
+        Field=message
+      ]
+    ]
+    ]
+    FROM [      FunctionCall Metadata.dataset@1[
+        LiteralExpr [STRING] [FacebookMessages]
+      ]
+      AS Variable [ Name=$message ]
+    ]
+    Where
+      OperatorExpr [
+        OperatorExpr [
+          FieldAccessor [
+            Variable [ Name=$message ]
+            Field=in-response-to
+          ]
+          >=
+          LiteralExpr [LONG] [1]
+        ]
+        and
+        OperatorExpr [
+          FieldAccessor [
+            Variable [ Name=$message ]
+            Field=in-response-to
+          ]
+          <
+          LiteralExpr [LONG] [11]
+        ]
+      ]
+  )
+]
+]

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/e4b318f6/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite-open/tinysocial-suite.26.ast
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite-open/tinysocial-suite.26.ast
 
b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite-open/tinysocial-suite.26.ast
new file mode 100644
index 0000000..16e5ee8
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite-open/tinysocial-suite.26.ast
@@ -0,0 +1,119 @@
+DataverseUse TinySocial
+Query:
+SELECT [
+Variable [ Name=$org ]
+organization
+FunctionCall TinySocial.sql-avg@1[
+  (
+    SELECT ELEMENT [
+    FunctionCall TinySocial.get-year@1[
+      FieldAccessor [
+        FieldAccessor [
+          Variable [ Name=#2 ]
+          Field=employment
+        ]
+        Field=end-date
+      ]
+    ]
+    ]
+    FROM [      Variable [ Name=#1 ]
+      AS Variable [ Name=#2 ]
+    ]
+  )
+]
+average
+FunctionCall TinySocial.sql-count@1[
+  (
+    SELECT ELEMENT [
+    FieldAccessor [
+      FieldAccessor [
+        Variable [ Name=#3 ]
+        Field=employment
+      ]
+      Field=end-date
+    ]
+    ]
+    FROM [      Variable [ Name=#1 ]
+      AS Variable [ Name=#3 ]
+    ]
+  )
+]
+count
+FunctionCall TinySocial.sql-sum@1[
+  (
+    SELECT ELEMENT [
+    FunctionCall TinySocial.get-year@1[
+      FieldAccessor [
+        FieldAccessor [
+          Variable [ Name=#4 ]
+          Field=employment
+        ]
+        Field=end-date
+      ]
+    ]
+    ]
+    FROM [      Variable [ Name=#1 ]
+      AS Variable [ Name=#4 ]
+    ]
+  )
+]
+sum
+FunctionCall TinySocial.sql-min@1[
+  (
+    SELECT ELEMENT [
+    FieldAccessor [
+      FieldAccessor [
+        Variable [ Name=#5 ]
+        Field=employment
+      ]
+      Field=end-date
+    ]
+    ]
+    FROM [      Variable [ Name=#1 ]
+      AS Variable [ Name=#5 ]
+    ]
+  )
+]
+min
+FunctionCall TinySocial.sql-max@1[
+  (
+    SELECT ELEMENT [
+    FieldAccessor [
+      FieldAccessor [
+        Variable [ Name=#6 ]
+        Field=employment
+      ]
+      Field=end-date
+    ]
+    ]
+    FROM [      Variable [ Name=#1 ]
+      AS Variable [ Name=#6 ]
+    ]
+  )
+]
+max
+]
+FROM [  FunctionCall Metadata.dataset@1[
+    LiteralExpr [STRING] [FacebookUsers]
+  ]
+  AS Variable [ Name=$fbu ]
+,
+  FieldAccessor [
+    Variable [ Name=$fbu ]
+    Field=employment
+  ]
+  AS Variable [ Name=$employment ]
+]
+Groupby
+  Variable [ Name=$org ]
+  :=
+  FieldAccessor [
+    Variable [ Name=$employment ]
+    Field=organization-name
+  ]
+  GROUP AS Variable [ Name=#1 ]
+  (
+    fbu:=Variable [ Name=$fbu ]
+    employment:=Variable [ Name=$employment ]
+  )
+

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/e4b318f6/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite-open/tinysocial-suite.27.ast
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite-open/tinysocial-suite.27.ast
 
b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite-open/tinysocial-suite.27.ast
new file mode 100644
index 0000000..d177b74
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite-open/tinysocial-suite.27.ast
@@ -0,0 +1,105 @@
+DataverseUse TinySocial
+Query:
+SELECT [
+FunctionCall TinySocial.sql-avg@1[
+  (
+    SELECT ELEMENT [
+    FunctionCall TinySocial.get-year@1[
+      FieldAccessor [
+        FieldAccessor [
+          Variable [ Name=#2 ]
+          Field=employment
+        ]
+        Field=end-date
+      ]
+    ]
+    ]
+    FROM [      Variable [ Name=#1 ]
+      AS Variable [ Name=#2 ]
+    ]
+  )
+]
+average
+FunctionCall TinySocial.sql-count@1[
+  (
+    SELECT ELEMENT [
+    FieldAccessor [
+      FieldAccessor [
+        Variable [ Name=#3 ]
+        Field=employment
+      ]
+      Field=end-date
+    ]
+    ]
+    FROM [      Variable [ Name=#1 ]
+      AS Variable [ Name=#3 ]
+    ]
+  )
+]
+count
+FunctionCall TinySocial.sql-sum@1[
+  (
+    SELECT ELEMENT [
+    FunctionCall TinySocial.get-year@1[
+      FieldAccessor [
+        FieldAccessor [
+          Variable [ Name=#4 ]
+          Field=employment
+        ]
+        Field=end-date
+      ]
+    ]
+    ]
+    FROM [      Variable [ Name=#1 ]
+      AS Variable [ Name=#4 ]
+    ]
+  )
+]
+sum
+FunctionCall TinySocial.sql-min@1[
+  (
+    SELECT ELEMENT [
+    FieldAccessor [
+      FieldAccessor [
+        Variable [ Name=#5 ]
+        Field=employment
+      ]
+      Field=end-date
+    ]
+    ]
+    FROM [      Variable [ Name=#1 ]
+      AS Variable [ Name=#5 ]
+    ]
+  )
+]
+min
+FunctionCall TinySocial.sql-max@1[
+  (
+    SELECT ELEMENT [
+    FieldAccessor [
+      FieldAccessor [
+        Variable [ Name=#6 ]
+        Field=employment
+      ]
+      Field=end-date
+    ]
+    ]
+    FROM [      Variable [ Name=#1 ]
+      AS Variable [ Name=#6 ]
+    ]
+  )
+]
+max
+]
+FROM [  FunctionCall Metadata.dataset@1[
+    LiteralExpr [STRING] [FacebookUsers]
+  ]
+  AS Variable [ Name=$fbu ]
+,
+  FieldAccessor [
+    Variable [ Name=$fbu ]
+    Field=employment
+  ]
+  AS Variable [ Name=$employment ]
+]
+Group All

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/e4b318f6/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite/query-ASTERIXDB-1263.23.ast
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite/query-ASTERIXDB-1263.23.ast
 
b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite/query-ASTERIXDB-1263.23.ast
deleted file mode 100644
index 73652a0..0000000
--- 
a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite/query-ASTERIXDB-1263.23.ast
+++ /dev/null
@@ -1,81 +0,0 @@
-DataverseUse TinySocial
-Query:
-SELECT [
-Variable [ Name=$h ]
-hour
-FunctionCall TinySocial.sql-count@1[
-  (
-    SELECT ELEMENT [
-    FieldAccessor [
-      Variable [ Name=#4 ]
-      Field=t
-    ]
-    ]
-    FROM [      Variable [ Name=#1 ]
-      AS Variable [ Name=#4 ]
-    ]
-  )
-]
-count
-(
-  SELECT [
-  Variable [ Name=$min ]
-  minute
-  FunctionCall TinySocial.sql-count@1[
-    (
-      SELECT ELEMENT [
-      FieldAccessor [
-        Variable [ Name=#3 ]
-        Field=k
-      ]
-      ]
-      FROM [        Variable [ Name=#2 ]
-        AS Variable [ Name=#3 ]
-      ]
-    )
-  ]
-  sum
-  ]
-  FROM [    Variable [ Name=$t ]
-    AS Variable [ Name=$k ]
-  ]
-  Groupby
-    Variable [ Name=$min ]
-    :=
-    FunctionCall TinySocial.get-minute@1[
-      FieldAccessor [
-        Variable [ Name=$k ]
-        Field=send-time
-      ]
-    ]
-    GROUP AS Variable [ Name=#2 ]
-    (
-      k:=Variable [ Name=$k ]
-    )
-
-  Orderby
-    Variable [ Name=$min ]
-    ASC
-
-)
-finer
-]
-FROM [  FunctionCall Metadata.dataset@1[
-    LiteralExpr [STRING] [TweetMessages]
-  ]
-  AS Variable [ Name=$t ]
-]
-Groupby
-  Variable [ Name=$h ]
-  :=
-  FunctionCall TinySocial.get-hour@1[
-    FieldAccessor [
-      Variable [ Name=$t ]
-      Field=send-time
-    ]
-  ]
-  GROUP AS Variable [ Name=#1 ]
-  (
-    t:=Variable [ Name=$t ]
-  )
-

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/e4b318f6/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite/tinysocial-suite.23.ast
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite/tinysocial-suite.23.ast
 
b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite/tinysocial-suite.23.ast
new file mode 100644
index 0000000..73652a0
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/tinysocial/tinysocial-suite/tinysocial-suite.23.ast
@@ -0,0 +1,81 @@
+DataverseUse TinySocial
+Query:
+SELECT [
+Variable [ Name=$h ]
+hour
+FunctionCall TinySocial.sql-count@1[
+  (
+    SELECT ELEMENT [
+    FieldAccessor [
+      Variable [ Name=#4 ]
+      Field=t
+    ]
+    ]
+    FROM [      Variable [ Name=#1 ]
+      AS Variable [ Name=#4 ]
+    ]
+  )
+]
+count
+(
+  SELECT [
+  Variable [ Name=$min ]
+  minute
+  FunctionCall TinySocial.sql-count@1[
+    (
+      SELECT ELEMENT [
+      FieldAccessor [
+        Variable [ Name=#3 ]
+        Field=k
+      ]
+      ]
+      FROM [        Variable [ Name=#2 ]
+        AS Variable [ Name=#3 ]
+      ]
+    )
+  ]
+  sum
+  ]
+  FROM [    Variable [ Name=$t ]
+    AS Variable [ Name=$k ]
+  ]
+  Groupby
+    Variable [ Name=$min ]
+    :=
+    FunctionCall TinySocial.get-minute@1[
+      FieldAccessor [
+        Variable [ Name=$k ]
+        Field=send-time
+      ]
+    ]
+    GROUP AS Variable [ Name=#2 ]
+    (
+      k:=Variable [ Name=$k ]
+    )
+
+  Orderby
+    Variable [ Name=$min ]
+    ASC
+
+)
+finer
+]
+FROM [  FunctionCall Metadata.dataset@1[
+    LiteralExpr [STRING] [TweetMessages]
+  ]
+  AS Variable [ Name=$t ]
+]
+Groupby
+  Variable [ Name=$h ]
+  :=
+  FunctionCall TinySocial.get-hour@1[
+    FieldAccessor [
+      Variable [ Name=$t ]
+      Field=send-time
+    ]
+  ]
+  GROUP AS Variable [ Name=#1 ]
+  (
+    t:=Variable [ Name=$t ]
+  )
+

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/e4b318f6/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/union/union/union.1.ast
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/union/union/union.1.ast
 
b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/union/union/union.1.ast
deleted file mode 100644
index e339672..0000000
--- 
a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/union/union/union.1.ast
+++ /dev/null
@@ -1,13 +0,0 @@
-DataverseUse TinySocial
-TypeDecl FacebookUserType [
-  open RecordType {
-    id : int64
-  }
-]
-TypeDecl FacebookMessageType [
-  open RecordType {
-    message_id : int64
-  }
-]
-DatasetDecl FacebookUsers(FacebookUserType) partitioned by [[id]]
-DatasetDecl FacebookMessages(FacebookMessageType) partitioned by [[message_id]]

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/e4b318f6/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/union/union/union.2.ast
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/union/union/union.2.ast
 
b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/union/union/union.2.ast
deleted file mode 100644
index f36d0ea..0000000
--- 
a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/union/union/union.2.ast
+++ /dev/null
@@ -1 +0,0 @@
-DataverseUse TinySocial

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/e4b318f6/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/union/union/union.3.ast
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/union/union/union.3.ast
 
b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/union/union/union.3.ast
deleted file mode 100644
index e69de29..0000000

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/e4b318f6/asterixdb/asterix-app/src/test/resources/runtimets/testsuite.xml
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/testsuite.xml 
b/asterixdb/asterix-app/src/test/resources/runtimets/testsuite.xml
index 86475a2..5750b28 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/testsuite.xml
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/testsuite.xml
@@ -6924,6 +6924,11 @@
   </test-group>
   <test-group name="types">
     <test-case FilePath="types">
+      <compilation-unit name="any-object">
+        <output-dir compare="Text">any-object</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="types">
       <compilation-unit name="record01">
         <output-dir compare="Text">record01</output-dir>
       </compilation-unit>

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/e4b318f6/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_sqlpp.xml
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_sqlpp.xml 
b/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_sqlpp.xml
index b6fe6f8..a2bc4ce 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_sqlpp.xml
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_sqlpp.xml
@@ -7190,7 +7190,7 @@
     <test-case FilePath="user-defined-functions">
       <compilation-unit name="udf30">
         <output-dir compare="Text">udf30</output-dir>
-        <expected-error>Cannot find dataset y because there is no dataverse 
declared, nor an alias with name y</expected-error>
+        <expected-error>Cannot find dataset y in dataverse Default nor an 
alias with name y</expected-error>
       </compilation-unit>
     </test-case>
     <test-case FilePath="user-defined-functions">
@@ -7705,6 +7705,11 @@
   </test-group>
   <test-group name="types">
     <test-case FilePath="types">
+      <compilation-unit name="any-object">
+        <output-dir compare="Text">any-object</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="types">
       <compilation-unit name="record01">
         <output-dir compare="Text">record01</output-dir>
       </compilation-unit>

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/e4b318f6/asterixdb/asterix-common/src/test/java/org/apache/asterix/test/aql/TestExecutor.java
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-common/src/test/java/org/apache/asterix/test/aql/TestExecutor.java
 
b/asterixdb/asterix-common/src/test/java/org/apache/asterix/test/aql/TestExecutor.java
index d0594d2..1c48dbb 100644
--- 
a/asterixdb/asterix-common/src/test/java/org/apache/asterix/test/aql/TestExecutor.java
+++ 
b/asterixdb/asterix-common/src/test/java/org/apache/asterix/test/aql/TestExecutor.java
@@ -44,6 +44,7 @@ import java.util.regex.Pattern;
 
 import org.apache.asterix.common.config.GlobalConfig;
 import org.apache.asterix.common.utils.ServletUtil.Servlets;
+import org.apache.asterix.test.base.ComparisonException;
 import org.apache.asterix.test.server.ITestServer;
 import org.apache.asterix.test.server.TestServerProvider;
 import org.apache.asterix.testframework.context.TestCaseContext;
@@ -52,6 +53,7 @@ import 
org.apache.asterix.testframework.context.TestFileContext;
 import org.apache.asterix.testframework.xml.TestCase.CompilationUnit;
 import org.apache.asterix.testframework.xml.TestGroup;
 import org.apache.commons.io.IOUtils;
+import org.apache.commons.lang3.StringUtils;
 import org.apache.commons.lang3.mutable.MutableInt;
 import org.apache.http.HttpResponse;
 import org.apache.http.HttpStatus;
@@ -121,16 +123,15 @@ public class TestExecutor {
         BufferedReader readerActual = new BufferedReader(
                 new InputStreamReader(new FileInputStream(actualFile), 
"UTF-8"));
         boolean regex = false;
-        if (actualFile.toString().endsWith(".regex")) {
-            runScriptAndCompareWithResultRegex(scriptFile, expectedFile, 
actualFile);
-            return;
-        } else if (actualFile.toString().endsWith(".regexadm")) {
-            regex = true;
-        }
-
-        String lineExpected, lineActual;
-        int num = 1;
         try {
+            if (actualFile.toString().endsWith(".regex")) {
+                runScriptAndCompareWithResultRegex(scriptFile, expectedFile, 
actualFile);
+                return;
+            } else if (actualFile.toString().endsWith(".regexadm")) {
+                regex = true;
+            }
+            String lineExpected, lineActual;
+            int num = 1;
             while ((lineExpected = readerExpected.readLine()) != null) {
                 lineActual = readerActual.readLine();
                 // Assert.assertEquals(lineExpected, lineActual);
@@ -138,7 +139,7 @@ public class TestExecutor {
                     if (lineExpected.isEmpty()) {
                         continue;
                     }
-                    throw new Exception(
+                    throw new ComparisonException(
                             "Result for " + scriptFile + " changed at line " + 
num + ":\n< " + lineExpected + "\n> ");
                 }
 
@@ -146,19 +147,21 @@ public class TestExecutor {
                 String[] lineSplitsExpected = lineExpected.split("Time");
                 String[] lineSplitsActual = lineActual.split("Time");
                 if (lineSplitsExpected.length != lineSplitsActual.length) {
-                    throw new Exception("Result for " + scriptFile + " changed 
at line " + num + ":\n< " + lineExpected
-                            + "\n> " + lineActual);
+                    throw new ComparisonException(
+                            "Result for " + scriptFile + " changed at line " + 
num + ":\n< " + lineExpected
+                                    + "\n> " + lineActual);
                 }
                 if (!equalStrings(lineSplitsExpected[0], lineSplitsActual[0], 
regex)) {
-                    throw new Exception("Result for " + scriptFile + " changed 
at line " + num + ":\n< " + lineExpected
-                            + "\n> " + lineActual);
+                    throw new ComparisonException(
+                            "Result for " + scriptFile + " changed at line " + 
num + ":\n< " + lineExpected
+                                    + "\n> " + lineActual);
                 }
 
                 for (int i = 1; i < lineSplitsExpected.length; i++) {
                     String[] splitsByCommaExpected = 
lineSplitsExpected[i].split(",");
                     String[] splitsByCommaActual = 
lineSplitsActual[i].split(",");
                     if (splitsByCommaExpected.length != 
splitsByCommaActual.length) {
-                        throw new Exception("Result for " + scriptFile + " 
changed at line " + num + ":\n< "
+                        throw new ComparisonException("Result for " + 
scriptFile + " changed at line " + num + ":\n< "
                                 + lineExpected + "\n> " + lineActual);
                     }
                     for (int j = 1; j < splitsByCommaExpected.length; j++) {
@@ -168,8 +171,9 @@ public class TestExecutor {
                             continue;
                         }
                         if (!equalStrings(splitsByCommaExpected[j], 
splitsByCommaActual[j], regex)) {
-                            throw new Exception("Result for " + scriptFile + " 
changed at line " + num + ":\n< "
-                                    + lineExpected + "\n> " + lineActual);
+                            throw new ComparisonException(
+                                    "Result for " + scriptFile + " changed at 
line " + num + ":\n< "
+                                            + lineExpected + "\n> " + 
lineActual);
                         }
                     }
                 }
@@ -178,7 +182,8 @@ public class TestExecutor {
             }
             lineActual = readerActual.readLine();
             if (lineActual != null) {
-                throw new Exception("Result for " + scriptFile + " changed at 
line " + num + ":\n< \n> " + lineActual);
+                throw new ComparisonException(
+                        "Result for " + scriptFile + " changed at line " + num 
+ ":\n< \n> " + lineActual);
             }
         } catch (Exception e) {
             System.err.println("Actual results file: " + 
actualFile.toString());
@@ -223,8 +228,8 @@ public class TestExecutor {
                             if (expectedBagElements.size() != 
actualBagElements.size()) {
                                 return false;
                             }
-                            int [] expectedHits = new int 
[expectedBagElements.size()];
-                            int [] actualHits = new int 
[actualBagElements.size()];
+                            int[] expectedHits = new 
int[expectedBagElements.size()];
+                            int[] actualHits = new 
int[actualBagElements.size()];
                             int k = 0;
                             for (String expectedElement : expectedBagElements) 
{
                                 int l = 0;
@@ -289,9 +294,8 @@ public class TestExecutor {
         int num = 1;
         try (BufferedReader readerExpected = new BufferedReader(
                 new InputStreamReader(new FileInputStream(expectedFile), 
"UTF-8"));
-             BufferedReader readerActual = new BufferedReader(
-                new InputStreamReader(new FileInputStream(actualFile), 
"UTF-8")))
-        {
+                BufferedReader readerActual = new BufferedReader(
+                        new InputStreamReader(new FileInputStream(actualFile), 
"UTF-8"))) {
             StringBuilder actual = new StringBuilder();
             while ((lineActual = readerActual.readLine()) != null) {
                 actual.append(lineActual).append('\n');
@@ -331,7 +335,6 @@ public class TestExecutor {
 
     }
 
-
     // For tests where you simply want the byte-for-byte output.
     private static void writeOutputToFile(File actualFile, InputStream 
resultStream) throws Exception {
         try (FileOutputStream out = new FileOutputStream(actualFile)) {
@@ -919,7 +922,8 @@ public class TestExecutor {
                         e.printStackTrace();
                         System.err.println("...Unexpected!");
                         if (expectedError != null) {
-                            System.err.println("Expected to find the following 
in error text:\n+++++\n" + expectedError + "\n+++++");
+                            System.err.println("Expected to find the following 
in error text:\n+++++\n" + expectedError
+                                    + "\n+++++");
                         }
                         if (failedGroup != null) {
                             
failedGroup.getTestCase().add(testCaseCtx.getTestCase());
@@ -960,4 +964,40 @@ public class TestExecutor {
     public static String stripJavaComments(String text) {
         return JAVA_BLOCK_COMMENT_PATTERN.matcher(text).replaceAll("");
     }
+
+    public void cleanup(String testCase, List<String> badtestcases) throws 
Exception {
+        try {
+            ArrayList<String> toBeDropped = new ArrayList<>();
+            InputStream resultStream = null;
+            OutputFormat fmt = OutputFormat.ADM;
+            resultStream = executeQueryService("select dv.DataverseName from 
Metadata.`Dataverse` as dv;", fmt,
+                    getEndpoint(Servlets.QUERY_SERVICE), new ArrayList<>());
+            resultStream = ResultExtractor.extract(resultStream);
+            BufferedReader reader = new BufferedReader(new 
InputStreamReader(resultStream));
+            String dataverse = reader.readLine();
+            while (dataverse != null) {
+                JSONObject json = new JSONObject(dataverse);
+                String dvName = json.getString("DataverseName");
+                if (!dvName.equals("Metadata") && !dvName.equals("Default")) {
+                    toBeDropped.add(dvName);
+                }
+                dataverse = reader.readLine();
+            }
+            if (!toBeDropped.isEmpty()) {
+                badtestcases.add(testCase);
+                LOGGER.warning(
+                        "Last test left some garbage. Dropping dataverses: " + 
StringUtils.join(toBeDropped, ','));
+                StringBuilder dropStatement = new StringBuilder();
+                for (String dv : toBeDropped) {
+                    dropStatement.append("drop dataverse ");
+                    dropStatement.append(dv);
+                    dropStatement.append(";\n");
+                }
+                resultStream = executeQueryService(dropStatement.toString(), 
getEndpoint(Servlets.QUERY_SERVICE));
+                ResultExtractor.extract(resultStream);
+            }
+        } catch (Throwable th) {
+            th.printStackTrace();
+        }
+    }
 }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/e4b318f6/asterixdb/asterix-common/src/test/java/org/apache/asterix/test/base/ComparisonException.java
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-common/src/test/java/org/apache/asterix/test/base/ComparisonException.java
 
b/asterixdb/asterix-common/src/test/java/org/apache/asterix/test/base/ComparisonException.java
new file mode 100644
index 0000000..42e4362
--- /dev/null
+++ 
b/asterixdb/asterix-common/src/test/java/org/apache/asterix/test/base/ComparisonException.java
@@ -0,0 +1,27 @@
+/*
+ * 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.base;
+
+public class ComparisonException extends Exception {
+    private static final long serialVersionUID = 1L;
+
+    public ComparisonException(String message) {
+        super(message);
+    }
+}

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/e4b318f6/asterixdb/asterix-installer/src/test/java/org/apache/asterix/installer/test/AbstractExecutionIT.java
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-installer/src/test/java/org/apache/asterix/installer/test/AbstractExecutionIT.java
 
b/asterixdb/asterix-installer/src/test/java/org/apache/asterix/installer/test/AbstractExecutionIT.java
index a20ca50..676137c 100644
--- 
a/asterixdb/asterix-installer/src/test/java/org/apache/asterix/installer/test/AbstractExecutionIT.java
+++ 
b/asterixdb/asterix-installer/src/test/java/org/apache/asterix/installer/test/AbstractExecutionIT.java
@@ -49,7 +49,7 @@ public abstract class AbstractExecutionIT {
 
     protected static final Logger LOGGER = 
Logger.getLogger(AbstractExecutionIT.class.getName());
 
-    protected static final String PATH_ACTUAL = "ittest" + File.separator;
+    protected static final String PATH_ACTUAL = "target" + File.separator + 
"ittest" + File.separator;
     protected static final String PATH_BASE = StringUtils
             .join(new String[] { "..", "asterix-app", "src", "test", 
"resources", "runtimets" }, File.separator);
 
@@ -59,6 +59,8 @@ public abstract class AbstractExecutionIT {
 
     private static final String EXTERNAL_LIBRARY_TEST_GROUP = "lib";
 
+    private static final List<String> badTestCases = new ArrayList<>();
+
     private static String reportPath =
             new File(StringUtils.join(new String[] { "target", 
"failsafe-reports" }, File.separator)).getAbsolutePath();
 
@@ -88,8 +90,8 @@ public abstract class AbstractExecutionIT {
         AsterixLifecycleIT.setUp();
 
         File externalTestsJar = new File(StringUtils.join(
-                new String[] { "..", "asterix-external-data", "target" } , 
File.separator)).listFiles(
-                (dir, name) -> 
name.matches("asterix-external-data-.*-tests.jar"))[0];
+                new String[] { "..", "asterix-external-data", "target" }, 
File.separator)).listFiles(
+                        (dir, name) -> 
name.matches("asterix-external-data-.*-tests.jar"))[0];
 
         FileUtils.copyFile(externalTestsJar, new File(
                 AsterixInstallerIntegrationUtil.getManagixHome() + 
"/clusters/local/working_dir/asterix/repo/",
@@ -97,7 +99,6 @@ public abstract class AbstractExecutionIT {
 
         AsterixLifecycleIT.restartInstance();
 
-
         FileUtils.copyDirectoryStructure(
                 new File(StringUtils.join(new String[] { "..", "asterix-app", 
"data" }, File.separator)),
                 new File(AsterixInstallerIntegrationUtil.getManagixHome() + 
"/clusters/local/working_dir/data"));
@@ -115,7 +116,7 @@ public abstract class AbstractExecutionIT {
         
System.setProperty(ExternalDataConstants.NODE_RESOLVER_FACTORY_PROPERTY,
                 IdentitiyResolverFactory.class.getName());
 
-        reportPath = new File(StringUtils.join(new String[]{"target", 
"failsafe-reports"}, File.separator))
+        reportPath = new File(StringUtils.join(new String[] { "target", 
"failsafe-reports" }, File.separator))
                 .getAbsolutePath();
     }
 
@@ -127,8 +128,13 @@ public abstract class AbstractExecutionIT {
             outdir.delete();
         }
         AsterixLifecycleIT.tearDown();
-
         HDFSCluster.getInstance().cleanup();
+        if (!badTestCases.isEmpty()) {
+            System.out.println("The following test cases left some data");
+            for (String testCase : badTestCases) {
+                System.out.println(testCase);
+            }
+        }
     }
 
     @Parameters
@@ -153,6 +159,7 @@ public abstract class AbstractExecutionIT {
             return;
         }
         testExecutor.executeTest(PATH_ACTUAL, tcCtx, null, false);
+        testExecutor.cleanup(tcCtx.toString(), badTestCases);
     }
 
     protected boolean skip() {

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/e4b318f6/asterixdb/asterix-installer/src/test/java/org/apache/asterix/installer/test/AsterixClusterLifeCycleIT.java
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-installer/src/test/java/org/apache/asterix/installer/test/AsterixClusterLifeCycleIT.java
 
b/asterixdb/asterix-installer/src/test/java/org/apache/asterix/installer/test/AsterixClusterLifeCycleIT.java
index df31788..89fb70e 100644
--- 
a/asterixdb/asterix-installer/src/test/java/org/apache/asterix/installer/test/AsterixClusterLifeCycleIT.java
+++ 
b/asterixdb/asterix-installer/src/test/java/org/apache/asterix/installer/test/AsterixClusterLifeCycleIT.java
@@ -44,7 +44,7 @@ public class AsterixClusterLifeCycleIT {
             .join(new String[] { "src", "test", "resources", "integrationts", 
"lifecycle" }, File.separator);
     private static final String CLUSTER_BASE = StringUtils
             .join(new String[] { "src", "test", "resources", "clusterts" }, 
File.separator);
-    private static final String PATH_ACTUAL = "ittest" + File.separator;
+    private static final String PATH_ACTUAL = "target" + File.separator + 
"ittest" + File.separator;
     private static String managixFolderName;
     private static final Logger LOGGER = 
Logger.getLogger(AsterixClusterLifeCycleIT.class.getName());
     private static List<TestCaseContext> testCaseCollection;

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/e4b318f6/asterixdb/asterix-installer/src/test/java/org/apache/asterix/installer/test/AsterixExternalLibraryIT.java
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-installer/src/test/java/org/apache/asterix/installer/test/AsterixExternalLibraryIT.java
 
b/asterixdb/asterix-installer/src/test/java/org/apache/asterix/installer/test/AsterixExternalLibraryIT.java
index 3d3d564..57aaeee 100644
--- 
a/asterixdb/asterix-installer/src/test/java/org/apache/asterix/installer/test/AsterixExternalLibraryIT.java
+++ 
b/asterixdb/asterix-installer/src/test/java/org/apache/asterix/installer/test/AsterixExternalLibraryIT.java
@@ -38,7 +38,7 @@ public class AsterixExternalLibraryIT {
     private static final String LIBRARY_NAME = "testlib";
     private static final String LIBRARY_DATAVERSE = "externallibtest";
     private static final String PATH_BASE = 
"src/test/resources/integrationts/library";
-    private static final String PATH_ACTUAL = "ittest/";
+    private static final String PATH_ACTUAL = "target" + File.separator + 
"ittest" + File.separator;
     private static final String LIBRARY_PATH = "target" + File.separator + 
"resources" + File.separator + "externallib"
             + File.separator + "testlib-zip-binary-assembly.zip";
     private static final Logger LOGGER = 
Logger.getLogger(AsterixExternalLibraryIT.class.getName());

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/e4b318f6/asterixdb/asterix-installer/src/test/java/org/apache/asterix/installer/test/AsterixLifecycleIT.java
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-installer/src/test/java/org/apache/asterix/installer/test/AsterixLifecycleIT.java
 
b/asterixdb/asterix-installer/src/test/java/org/apache/asterix/installer/test/AsterixLifecycleIT.java
index 117751f..52e75cc 100644
--- 
a/asterixdb/asterix-installer/src/test/java/org/apache/asterix/installer/test/AsterixLifecycleIT.java
+++ 
b/asterixdb/asterix-installer/src/test/java/org/apache/asterix/installer/test/AsterixLifecycleIT.java
@@ -46,7 +46,7 @@ public class AsterixLifecycleIT {
     private static final int NUM_NC = 2;
     private static final CommandHandler cmdHandler = new CommandHandler();
     private static final String PATH_BASE = 
"src/test/resources/integrationts/lifecycle";
-    private static final String PATH_ACTUAL = "ittest/";
+    private static final String PATH_ACTUAL = "target" + File.separator + 
"ittest" + File.separator;
     private static final Logger LOGGER = 
Logger.getLogger(AsterixLifecycleIT.class.getName());
     private static List<TestCaseContext> testCaseCollection;
     private final TestExecutor testExecutor = new TestExecutor();

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/e4b318f6/asterixdb/asterix-installer/src/test/java/org/apache/asterix/installer/test/ReplicationIT.java
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-installer/src/test/java/org/apache/asterix/installer/test/ReplicationIT.java
 
b/asterixdb/asterix-installer/src/test/java/org/apache/asterix/installer/test/ReplicationIT.java
index 908c384..37aa59d 100644
--- 
a/asterixdb/asterix-installer/src/test/java/org/apache/asterix/installer/test/ReplicationIT.java
+++ 
b/asterixdb/asterix-installer/src/test/java/org/apache/asterix/installer/test/ReplicationIT.java
@@ -49,7 +49,7 @@ public class ReplicationIT {
             .join(new String[] { "src", "test", "resources", "integrationts", 
"replication" }, File.separator);
     private static final String CLUSTER_BASE = StringUtils
             .join(new String[] { "src", "test", "resources", "clusterts" }, 
File.separator);
-    private static final String PATH_ACTUAL = "repliationtest" + 
File.separator;
+    private static final String PATH_ACTUAL = "target" + File.separator + 
"repliationtest" + File.separator;
     private static String managixFolderName;
     private static final Logger LOGGER = 
Logger.getLogger(ReplicationIT.class.getName());
     private static File asterixProjectDir = new 
File(System.getProperty("user.dir"));

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/e4b318f6/asterixdb/asterix-installer/src/test/java/org/apache/asterix/installer/transaction/DmlRecoveryIT.java
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-installer/src/test/java/org/apache/asterix/installer/transaction/DmlRecoveryIT.java
 
b/asterixdb/asterix-installer/src/test/java/org/apache/asterix/installer/transaction/DmlRecoveryIT.java
index ecac44e..68c009a 100644
--- 
a/asterixdb/asterix-installer/src/test/java/org/apache/asterix/installer/transaction/DmlRecoveryIT.java
+++ 
b/asterixdb/asterix-installer/src/test/java/org/apache/asterix/installer/transaction/DmlRecoveryIT.java
@@ -44,7 +44,7 @@ public class DmlRecoveryIT {
     // variable to indicate whether this test will be executed
 
     private static final Logger LOGGER = 
Logger.getLogger(RecoveryIT.class.getName());
-    private static final String PATH_ACTUAL = "rttest/";
+    private static final String PATH_ACTUAL = "target" + File.separator + 
"rttest" + File.separator;
 
     private static final String TESTSUITE_PATH_BASE = 
"../asterix-app/src/test/resources/runtimets/";
 
@@ -114,8 +114,9 @@ public class DmlRecoveryIT {
         Collection<Object[]> testArgs = new ArrayList<Object[]>();
         TestCaseContext.Builder b = new TestCaseContext.Builder();
         for (TestCaseContext ctx : b.build(new File(TESTSUITE_PATH_BASE))) {
-            if (ctx.getTestCase().getFilePath().equals("dml"))
+            if (ctx.getTestCase().getFilePath().equals("dml")) {
                 testArgs.add(new Object[] { ctx });
+            }
         }
         return testArgs;
     }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/e4b318f6/asterixdb/asterix-installer/src/test/java/org/apache/asterix/installer/transaction/RecoveryIT.java
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-installer/src/test/java/org/apache/asterix/installer/transaction/RecoveryIT.java
 
b/asterixdb/asterix-installer/src/test/java/org/apache/asterix/installer/transaction/RecoveryIT.java
index 25c93af..9795702 100644
--- 
a/asterixdb/asterix-installer/src/test/java/org/apache/asterix/installer/transaction/RecoveryIT.java
+++ 
b/asterixdb/asterix-installer/src/test/java/org/apache/asterix/installer/transaction/RecoveryIT.java
@@ -38,11 +38,12 @@ import org.junit.rules.TestRule;
 import org.junit.runner.RunWith;
 import org.junit.runners.Parameterized;
 import org.junit.runners.Parameterized.Parameters;
+
 @RunWith(Parameterized.class)
 public class RecoveryIT {
 
     private static final Logger LOGGER = 
Logger.getLogger(RecoveryIT.class.getName());
-    private static final String PATH_ACTUAL = "rttest/";
+    private static final String PATH_ACTUAL = "target" + File.separator + 
"rttest" + File.separator;
     private static final String PATH_BASE = 
"src/test/resources/transactionts/";
     private static final String HDFS_BASE = "../asterix-app/";
     private TestCaseContext tcCtx;

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/e4b318f6/asterixdb/asterix-installer/src/test/resources/integrationts/library/results/library-metadata/dataverseDataset/dataverseDataset.1.adm
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-installer/src/test/resources/integrationts/library/results/library-metadata/dataverseDataset/dataverseDataset.1.adm
 
b/asterixdb/asterix-installer/src/test/resources/integrationts/library/results/library-metadata/dataverseDataset/dataverseDataset.1.adm
index 68aa542..122cf71 100644
--- 
a/asterixdb/asterix-installer/src/test/resources/integrationts/library/results/library-metadata/dataverseDataset/dataverseDataset.1.adm
+++ 
b/asterixdb/asterix-installer/src/test/resources/integrationts/library/results/library-metadata/dataverseDataset/dataverseDataset.1.adm
@@ -1,2 +1,3 @@
+{ "DataverseName": "Default", "DataFormat": 
"org.apache.asterix.runtime.formats.NonTaggedDataFormat", "Timestamp": "Thu Sep 
15 03:11:25 UTC 2016", "PendingOp": 0 }
 { "DataverseName": "Metadata", "DataFormat": 
"org.apache.asterix.runtime.formats.NonTaggedDataFormat", "Timestamp": "Mon Jun 
27 17:22:24 PDT 2016", "PendingOp": 0 }
 { "DataverseName": "externallibtest", "DataFormat": 
"org.apache.asterix.runtime.formats.NonTaggedDataFormat", "Timestamp": "Mon Jun 
27 17:22:44 PDT 2016", "PendingOp": 0 }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/e4b318f6/asterixdb/asterix-lang-aql/src/main/javacc/AQL.jj
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-lang-aql/src/main/javacc/AQL.jj 
b/asterixdb/asterix-lang-aql/src/main/javacc/AQL.jj
index 17d0909..0a9079d 100644
--- a/asterixdb/asterix-lang-aql/src/main/javacc/AQL.jj
+++ b/asterixdb/asterix-lang-aql/src/main/javacc/AQL.jj
@@ -1291,16 +1291,16 @@ void RecordField(RecordTypeDefinition recType) throws 
ParseException:
 
 TypeReferenceExpression TypeReference() throws ParseException:
 {
-  String id = null;
+  Pair<Identifier,Identifier> id = null;
 }
 {
- id = Identifier()
+ id = QualifiedName()
    {
-     if (id.equalsIgnoreCase("int")) {
-        id = "int64";
+     if (id.first == null && id.second.getValue().equalsIgnoreCase("int")) {
+        id.second.setValue("int64");
      }
 
-     return new TypeReferenceExpression(new Identifier(id));
+     return new TypeReferenceExpression(id);
    }
 }
 

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/e4b318f6/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/expression/TypeReferenceExpression.java
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/expression/TypeReferenceExpression.java
 
b/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/expression/TypeReferenceExpression.java
index 49f0667..b360797 100644
--- 
a/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/expression/TypeReferenceExpression.java
+++ 
b/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/expression/TypeReferenceExpression.java
@@ -22,16 +22,17 @@ import 
org.apache.asterix.common.exceptions.AsterixException;
 import org.apache.asterix.lang.common.struct.Identifier;
 import org.apache.asterix.lang.common.visitor.base.ILangVisitor;
 import org.apache.commons.lang.ObjectUtils;
+import org.apache.hyracks.algebricks.common.utils.Pair;
 
 public class TypeReferenceExpression implements TypeExpression {
 
-    private final Identifier ident;
+    private final Pair<Identifier, Identifier> ident;
 
-    public TypeReferenceExpression(Identifier ident) {
+    public TypeReferenceExpression(Pair<Identifier, Identifier> ident) {
         this.ident = ident;
     }
 
-    public Identifier getIdent() {
+    public Pair<Identifier, Identifier> getIdent() {
         return ident;
     }
 

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/e4b318f6/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 5ff4a03..fb2d3bd 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
@@ -414,7 +414,11 @@ public class FormatPrintVisitor implements 
ILangVisitor<Void, Integer> {
 
     @Override
     public Void visit(TypeReferenceExpression t, Integer arg) throws 
AsterixException {
-        out.print(normalize(t.getIdent().getValue()));
+        if (t.getIdent().first != null && t.getIdent().first.getValue() != 
null) {
+            out.print(normalize(t.getIdent().first.getValue()));
+            out.print('.');
+        }
+        out.print(normalize(t.getIdent().second.getValue()));
         return null;
     }
 

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/e4b318f6/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 a5c9efc..e7cf43b 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
@@ -333,7 +333,11 @@ public class QueryPrintVisitor extends 
AbstractQueryExpressionVisitor<Void, Inte
 
     @Override
     public Void visit(TypeReferenceExpression t, Integer arg) throws 
AsterixException {
-        out.print(t.getIdent());
+        if (t.getIdent().first != null && t.getIdent().first.getValue() != 
null) {
+            out.print(t.getIdent().first.getValue());
+            out.print('.');
+        }
+        out.print(t.getIdent().second.getValue());
         return null;
     }
 

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/e4b318f6/asterixdb/asterix-lang-sqlpp/src/main/javacc/SQLPP.jj
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-lang-sqlpp/src/main/javacc/SQLPP.jj 
b/asterixdb/asterix-lang-sqlpp/src/main/javacc/SQLPP.jj
index dab178b..697439d 100644
--- a/asterixdb/asterix-lang-sqlpp/src/main/javacc/SQLPP.jj
+++ b/asterixdb/asterix-lang-sqlpp/src/main/javacc/SQLPP.jj
@@ -1363,16 +1363,16 @@ void RecordField(RecordTypeDefinition recType) throws 
ParseException:
 
 TypeReferenceExpression TypeReference() throws ParseException:
 {
-  String id = null;
+  Pair<Identifier,Identifier> id = null;
 }
 {
- id = Identifier()
+ id = QualifiedName()
    {
-     if (id.equalsIgnoreCase("int")) {
-        id = "int64";
+     if (id.first == null && id.second.getValue().equalsIgnoreCase("int")) {
+        id.second.setValue("int64");
      }
 
-     return new TypeReferenceExpression(new Identifier(id));
+     return new TypeReferenceExpression(id);
    }
 }
 

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/e4b318f6/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/bootstrap/MetadataBootstrap.java
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/bootstrap/MetadataBootstrap.java
 
b/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/bootstrap/MetadataBootstrap.java
index c1dfd02..934fe4c 100644
--- 
a/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/bootstrap/MetadataBootstrap.java
+++ 
b/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/bootstrap/MetadataBootstrap.java
@@ -19,6 +19,7 @@
 package org.apache.asterix.metadata.bootstrap;
 
 import java.io.File;
+import java.rmi.RemoteException;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.HashMap;
@@ -38,6 +39,7 @@ import org.apache.asterix.common.config.GlobalConfig;
 import org.apache.asterix.common.config.IAsterixPropertiesProvider;
 import org.apache.asterix.common.context.BaseOperationTracker;
 import org.apache.asterix.common.context.CorrelatedPrefixMergePolicyFactory;
+import org.apache.asterix.common.exceptions.ACIDException;
 import 
org.apache.asterix.common.ioopcallbacks.LSMBTreeIOOperationCallbackFactory;
 import org.apache.asterix.common.utils.StoragePathUtil;
 import org.apache.asterix.external.adapter.factory.GenericAdapterFactory;
@@ -104,7 +106,7 @@ import org.apache.hyracks.storage.common.file.LocalResource;
  * stopUniverse() should be called upon application undeployment.
  */
 public class MetadataBootstrap {
-    public static final boolean IS_DEBUG_MODE = false;// true
+    public static final boolean IS_DEBUG_MODE = false;
     private static final Logger LOGGER = 
Logger.getLogger(MetadataBootstrap.class.getName());
     private static IAsterixAppRuntimeContext runtimeContext;
     private static IBufferCache bufferCache;
@@ -116,7 +118,6 @@ public class MetadataBootstrap {
     private static List<String> nodeNames;
     private static String outputDir;
     private static boolean isNewUniverse;
-
     private static final IMetadataIndex[] PRIMARY_INDEXES =
             new IMetadataIndex[] { MetadataPrimaryIndexes.DATAVERSE_DATASET, 
MetadataPrimaryIndexes.DATASET_DATASET,
                     MetadataPrimaryIndexes.DATATYPE_DATASET, 
MetadataPrimaryIndexes.INDEX_DATASET,
@@ -128,8 +129,23 @@ public class MetadataBootstrap {
 
     private static IAsterixPropertiesProvider propertiesProvider;
 
+    private MetadataBootstrap() {
+    }
+
+    /**
+     * bootstrap metadata
+     *
+     * @param asterixPropertiesProvider
+     * @param ncApplicationContext
+     * @param isNewUniverse
+     * @throws ACIDException
+     * @throws RemoteException
+     * @throws MetadataException
+     * @throws Exception
+     */
     public static void startUniverse(IAsterixPropertiesProvider 
asterixPropertiesProvider,
-            INCApplicationContext ncApplicationContext, boolean isNewUniverse) 
throws Exception {
+            INCApplicationContext ncApplicationContext, boolean isNewUniverse)
+            throws RemoteException, ACIDException, MetadataException {
         MetadataBootstrap.setNewUniverse(isNewUniverse);
         runtimeContext = (IAsterixAppRuntimeContext) 
ncApplicationContext.getApplicationObject();
         propertiesProvider = asterixPropertiesProvider;
@@ -175,33 +191,35 @@ public class MetadataBootstrap {
         } catch (Exception e) {
             try {
                 if (IS_DEBUG_MODE) {
-                    e.printStackTrace();
+                    LOGGER.log(Level.SEVERE, "Failure during metadata 
bootstrap", e);
                 }
                 MetadataManager.INSTANCE.abortTransaction(mdTxnCtx);
             } catch (Exception e2) {
                 e.addSuppressed(e2);
-                // TODO
-                // change the exception type to AbortFailureException
+                // TODO change the exception type to AbortFailureException
                 throw new MetadataException(e);
             }
-            throw e;
+            throw new MetadataException(e);
         }
     }
 
-    public static void stopUniverse() {
-        // Close all BTree files in BufferCache.
-        // metadata datasets will be closed when the dataset life cycle manger 
is closed
-    }
-
-    private static void insertInitialDataverses(MetadataTransactionContext 
mdTxnCtx) throws Exception {
-        String dataverseName = 
MetadataPrimaryIndexes.DATAVERSE_DATASET.getDataverseName();
+    private static void insertInitialDataverses(MetadataTransactionContext 
mdTxnCtx) throws MetadataException {
         String dataFormat = NonTaggedDataFormat.NON_TAGGED_DATA_FORMAT;
         MetadataManager.INSTANCE.addDataverse(mdTxnCtx,
-                new Dataverse(dataverseName, dataFormat, 
IMetadataEntity.PENDING_NO_OP));
+                new Dataverse(MetadataConstants.METADATA_DATAVERSE_NAME, 
dataFormat, IMetadataEntity.PENDING_NO_OP));
+        MetadataManager.INSTANCE.addDataverse(mdTxnCtx, 
MetadataBuiltinEntities.DEFAULT_DATAVERSE);
     }
 
+    /**
+     * Inserts a metadata dataset to the physical dataset index
+     * Should be performed on a bootstrap of a new universe
+     *
+     * @param mdTxnCtx
+     * @param indexes
+     * @throws MetadataException
+     */
     public static void insertMetadataDatasets(MetadataTransactionContext 
mdTxnCtx, IMetadataIndex[] indexes)
-            throws Exception {
+            throws MetadataException {
         for (int i = 0; i < indexes.length; i++) {
             IDatasetDetails id = new 
InternalDatasetDetails(FileStructure.BTREE, PartitioningStrategy.HASH,
                     indexes[i].getPartitioningExpr(), 
indexes[i].getPartitioningExpr(), null,
@@ -219,7 +237,7 @@ public class MetadataBootstrap {
         }
     }
 
-    public static void getBuiltinTypes(ArrayList<IAType> types) throws 
Exception {
+    private static void getBuiltinTypes(List<IAType> types) {
         Collection<BuiltinType> builtinTypes = 
AsterixBuiltinTypeMap.getBuiltinTypes().values();
         Iterator<BuiltinType> iter = builtinTypes.iterator();
         while (iter.hasNext()) {
@@ -227,47 +245,47 @@ public class MetadataBootstrap {
         }
     }
 
-    public static void getMetadataTypes(ArrayList<IAType> types) throws 
Exception {
+    private static void getMetadataTypes(ArrayList<IAType> types) {
         for (int i = 0; i < PRIMARY_INDEXES.length; i++) {
             types.add(PRIMARY_INDEXES[i].getPayloadRecordType());
         }
     }
 
-    public static void insertMetadataDatatypes(MetadataTransactionContext 
mdTxnCtx) throws Exception {
-        String dataverseName = 
MetadataPrimaryIndexes.DATAVERSE_DATASET.getDataverseName();
-        ArrayList<IAType> types = new ArrayList<IAType>();
+    private static void insertMetadataDatatypes(MetadataTransactionContext 
mdTxnCtx) throws MetadataException {
+        ArrayList<IAType> types = new ArrayList<>();
         getBuiltinTypes(types);
         getMetadataTypes(types);
         for (int i = 0; i < types.size(); i++) {
             MetadataManager.INSTANCE.addDatatype(mdTxnCtx,
-                    new Datatype(dataverseName, types.get(i).getTypeName(), 
types.get(i), false));
+                    new Datatype(MetadataConstants.METADATA_DATAVERSE_NAME, 
types.get(i).getTypeName(), types.get(i),
+                            false));
         }
+        MetadataManager.INSTANCE.addDatatype(mdTxnCtx,
+                MetadataBuiltinEntities.ANY_OBJECT_DATATYPE);
         if (LOGGER.isLoggable(Level.INFO)) {
             LOGGER.info("Finished inserting initial datatypes.");
         }
     }
 
-    public static void insertNodes(MetadataTransactionContext mdTxnCtx) throws 
Exception {
+    private static void insertNodes(MetadataTransactionContext mdTxnCtx) 
throws MetadataException {
         for (String nodesName : nodeNames) {
             MetadataManager.INSTANCE.addNode(mdTxnCtx, new Node(nodesName, 0, 
0));
         }
     }
 
-    public static void insertInitialGroups(MetadataTransactionContext 
mdTxnCtx) throws Exception {
-        String groupName = 
MetadataPrimaryIndexes.DATAVERSE_DATASET.getNodeGroupName();
-        List<String> metadataGroupNodeNames = new ArrayList<String>();
+    private static void insertInitialGroups(MetadataTransactionContext 
mdTxnCtx) throws MetadataException {
+        List<String> metadataGroupNodeNames = new ArrayList<>();
         metadataGroupNodeNames.add(metadataNodeName);
-        NodeGroup groupRecord = new NodeGroup(groupName, 
metadataGroupNodeNames);
+        NodeGroup groupRecord = new 
NodeGroup(MetadataConstants.METADATA_NODEGROUP_NAME, metadataGroupNodeNames);
         MetadataManager.INSTANCE.addNodegroup(mdTxnCtx, groupRecord);
-
-        List<String> nodes = new ArrayList<String>();
+        List<String> nodes = new ArrayList<>();
         nodes.addAll(nodeNames);
         NodeGroup defaultGroup = new 
NodeGroup(MetadataConstants.METADATA_DEFAULT_NODEGROUP_NAME, nodes);
         MetadataManager.INSTANCE.addNodegroup(mdTxnCtx, defaultGroup);
-
     }
 
-    private static void insertInitialAdapters(MetadataTransactionContext 
mdTxnCtx) throws Exception {
+    private static void insertInitialAdapters(MetadataTransactionContext 
mdTxnCtx)
+            throws MetadataException {
         String[] builtInAdapterClassNames = new String[] { 
GenericAdapterFactory.class.getName() };
         DatasourceAdapter adapter;
         for (String adapterClassName : builtInAdapterClassNames) {
@@ -279,7 +297,7 @@ public class MetadataBootstrap {
         }
     }
 
-    private static void insertInitialFeedPolicies(MetadataTransactionContext 
mdTxnCtx) throws Exception {
+    private static void insertInitialFeedPolicies(MetadataTransactionContext 
mdTxnCtx) throws MetadataException {
         for (FeedPolicyEntity feedPolicy : BuiltinFeedPolicies.policies) {
             MetadataManager.INSTANCE.addFeedPolicy(mdTxnCtx, feedPolicy);
         }
@@ -288,29 +306,46 @@ public class MetadataBootstrap {
         }
     }
 
-    private static void 
insertInitialCompactionPolicies(MetadataTransactionContext mdTxnCtx) throws 
Exception {
+    private static void 
insertInitialCompactionPolicies(MetadataTransactionContext mdTxnCtx) throws 
MetadataException {
         String[] builtInCompactionPolicyClassNames =
                 new String[] { ConstantMergePolicyFactory.class.getName(), 
PrefixMergePolicyFactory.class.getName(),
                         NoMergePolicyFactory.class.getName(), 
CorrelatedPrefixMergePolicyFactory.class.getName() };
-        CompactionPolicy compactionPolicy;
         for (String policyClassName : builtInCompactionPolicyClassNames) {
-            compactionPolicy = getCompactionPolicyEntity(policyClassName);
+            CompactionPolicy compactionPolicy = 
getCompactionPolicyEntity(policyClassName);
             MetadataManager.INSTANCE.addCompactionPolicy(mdTxnCtx, 
compactionPolicy);
         }
     }
 
-    private static DatasourceAdapter getAdapter(String 
adapterFactoryClassName) throws Exception {
-        String adapterName = ((IAdapterFactory) 
(Class.forName(adapterFactoryClassName).newInstance())).getAlias();
-        return new DatasourceAdapter(new 
AdapterIdentifier(MetadataConstants.METADATA_DATAVERSE_NAME, adapterName),
-                adapterFactoryClassName, 
IDataSourceAdapter.AdapterType.INTERNAL);
+    private static DatasourceAdapter getAdapter(String adapterFactoryClassName)
+            throws MetadataException {
+        try {
+            String adapterName = ((IAdapterFactory) 
(Class.forName(adapterFactoryClassName).newInstance())).getAlias();
+            return new DatasourceAdapter(new 
AdapterIdentifier(MetadataConstants.METADATA_DATAVERSE_NAME, adapterName),
+                    adapterFactoryClassName, 
IDataSourceAdapter.AdapterType.INTERNAL);
+        } catch (InstantiationException | IllegalAccessException | 
ClassNotFoundException e) {
+            throw new MetadataException("Unable to instantiate builtin 
Adapter", e);
+        }
     }
 
-    private static CompactionPolicy getCompactionPolicyEntity(String 
compactionPolicyClassName) throws Exception {
-        String policyName =
-                ((ILSMMergePolicyFactory) 
(Class.forName(compactionPolicyClassName).newInstance())).getName();
-        return new CompactionPolicy(MetadataConstants.METADATA_DATAVERSE_NAME, 
policyName, compactionPolicyClassName);
+    private static CompactionPolicy getCompactionPolicyEntity(String 
compactionPolicyClassName)
+            throws MetadataException {
+        try {
+            String policyName =
+                    ((ILSMMergePolicyFactory) 
(Class.forName(compactionPolicyClassName).newInstance())).getName();
+            return new 
CompactionPolicy(MetadataConstants.METADATA_DATAVERSE_NAME, policyName,
+                    compactionPolicyClassName);
+        } catch (InstantiationException | IllegalAccessException | 
ClassNotFoundException e) {
+            throw new MetadataException("Unable to instantiate builtin Merge 
Policy Factory", e);
+        }
     }
 
+    /**
+     * Enlist a metadata index so it is available for metadata operations
+     * should be performed upon bootstrapping
+     *
+     * @param index
+     * @throws HyracksDataException
+     */
     public static void enlistMetadataDataset(IMetadataIndex index) throws 
HyracksDataException {
         ClusterPartition metadataPartition = 
propertiesProvider.getMetadataProperties().getMetadataPartition();
         int metadataDeviceId = metadataPartition.getIODeviceNum();
@@ -387,12 +422,12 @@ public class MetadataBootstrap {
         return metadataNodeName;
     }
 
+    /**
+     * Perform recovery of DDL operations metadata records
+     */
     public static void startDDLRecovery() throws MetadataException {
         // #. clean up any record which has pendingAdd/DelOp flag
         // as traversing all records from DATAVERSE_DATASET to 
DATASET_DATASET, and then to INDEX_DATASET.
-        String dataverseName = null;
-        String datasetName = null;
-        String indexName = null;
         MetadataTransactionContext mdTxnCtx = null;
         MetadataManager.INSTANCE.acquireWriteLatch();
         if (LOGGER.isLoggable(Level.INFO)) {
@@ -401,59 +436,9 @@ public class MetadataBootstrap {
 
         try {
             mdTxnCtx = MetadataManager.INSTANCE.beginTransaction();
-
             List<Dataverse> dataverses = 
MetadataManager.INSTANCE.getDataverses(mdTxnCtx);
             for (Dataverse dataverse : dataverses) {
-                dataverseName = dataverse.getDataverseName();
-                if (dataverse.getPendingOp() != IMetadataEntity.PENDING_NO_OP) 
{
-                    // drop pending dataverse
-                    MetadataManager.INSTANCE.dropDataverse(mdTxnCtx, 
dataverseName);
-                    if (LOGGER.isLoggable(Level.INFO)) {
-                        LOGGER.info("Dropped a pending dataverse: " + 
dataverseName);
-                    }
-                } else {
-                    List<Dataset> datasets = 
MetadataManager.INSTANCE.getDataverseDatasets(mdTxnCtx, dataverseName);
-                    for (Dataset dataset : datasets) {
-                        datasetName = dataset.getDatasetName();
-                        if (dataset.getPendingOp() != 
IMetadataEntity.PENDING_NO_OP) {
-                            // drop pending dataset
-                            MetadataManager.INSTANCE.dropDataset(mdTxnCtx, 
dataverseName, datasetName);
-                            if (LOGGER.isLoggable(Level.INFO)) {
-                                LOGGER.info("Dropped a pending dataset: " + 
dataverseName + "." + datasetName);
-                            }
-                        } else {
-                            List<Index> indexes =
-                                    
MetadataManager.INSTANCE.getDatasetIndexes(mdTxnCtx, dataverseName, 
datasetName);
-                            for (Index index : indexes) {
-                                indexName = index.getIndexName();
-                                if (index.getPendingOp() != 
IMetadataEntity.PENDING_NO_OP) {
-                                    // drop pending index
-                                    
MetadataManager.INSTANCE.dropIndex(mdTxnCtx, dataverseName, datasetName, 
indexName);
-                                    if (LOGGER.isLoggable(Level.INFO)) {
-                                        LOGGER.info("Dropped a pending index: 
" + dataverseName + "." + datasetName
-                                                + "." + indexName);
-                                    }
-                                }
-                            }
-                        }
-                        if (dataset.getDatasetType() == DatasetType.EXTERNAL) {
-                            // if the dataset has no indexes, delete all its 
files
-                            List<Index> indexes =
-                                    
MetadataManager.INSTANCE.getDatasetIndexes(mdTxnCtx, dataverseName, 
datasetName);
-                            if (indexes.size() == 0) {
-                                List<ExternalFile> files =
-                                        
MetadataManager.INSTANCE.getDatasetExternalFiles(mdTxnCtx, dataset);
-                                for (ExternalFile file : files) {
-                                    
MetadataManager.INSTANCE.dropExternalFile(mdTxnCtx, file);
-                                    if (LOGGER.isLoggable(Level.INFO)) {
-                                        LOGGER.info("Dropped an external file: 
" + dataverseName + "." + datasetName
-                                                + "." + file.getFileNumber());
-                                    }
-                                }
-                            }
-                        }
-                    }
-                }
+                recoverDataverse(mdTxnCtx, dataverse);
             }
             // the commit wasn't there before. yet, everything was working 
correctly!!!!!!!!!!!
             MetadataManager.INSTANCE.commitTransaction(mdTxnCtx);
@@ -463,7 +448,7 @@ public class MetadataBootstrap {
         } catch (Exception e) {
             try {
                 if (IS_DEBUG_MODE) {
-                    e.printStackTrace();
+                    LOGGER.log(Level.SEVERE, "Failure during DDL recovery", e);
                 }
                 MetadataManager.INSTANCE.abortTransaction(mdTxnCtx);
             } catch (Exception e2) {
@@ -475,6 +460,68 @@ public class MetadataBootstrap {
         }
     }
 
+    private static void recoverDataverse(MetadataTransactionContext mdTxnCtx, 
Dataverse dataverse)
+            throws MetadataException {
+        if (dataverse.getPendingOp() != IMetadataEntity.PENDING_NO_OP) {
+            // drop pending dataverse
+            MetadataManager.INSTANCE.dropDataverse(mdTxnCtx, 
dataverse.getDataverseName());
+            if (LOGGER.isLoggable(Level.INFO)) {
+                LOGGER.info("Dropped a pending dataverse: " + 
dataverse.getDataverseName());
+            }
+        } else {
+            List<Dataset> datasets =
+                    MetadataManager.INSTANCE.getDataverseDatasets(mdTxnCtx, 
dataverse.getDataverseName());
+            for (Dataset dataset : datasets) {
+                recoverDataset(mdTxnCtx, dataset);
+            }
+        }
+    }
+
+    private static void recoverDataset(MetadataTransactionContext mdTxnCtx, 
Dataset dataset) throws MetadataException {
+        if (dataset.getPendingOp() != IMetadataEntity.PENDING_NO_OP) {
+            // drop pending dataset
+            MetadataManager.INSTANCE.dropDataset(mdTxnCtx, 
dataset.getDataverseName(), dataset.getDatasetName());
+            if (LOGGER.isLoggable(Level.INFO)) {
+                LOGGER.info(
+                        "Dropped a pending dataset: " + 
dataset.getDataverseName() + "." + dataset.getDatasetName());
+            }
+        } else {
+            List<Index> indexes =
+                    MetadataManager.INSTANCE.getDatasetIndexes(mdTxnCtx, 
dataset.getDataverseName(),
+                            dataset.getDatasetName());
+            for (Index index : indexes) {
+                if (index.getPendingOp() != IMetadataEntity.PENDING_NO_OP) {
+                    // drop pending index
+                    MetadataManager.INSTANCE.dropIndex(mdTxnCtx, 
dataset.getDataverseName(), dataset.getDatasetName(),
+                            index.getIndexName());
+                    if (LOGGER.isLoggable(Level.INFO)) {
+                        LOGGER.info("Dropped a pending index: " + 
dataset.getDataverseName() + "."
+                                + dataset.getDatasetName()
+                                + "." + index.getIndexName());
+                    }
+                }
+            }
+        }
+        if (dataset.getDatasetType() == DatasetType.EXTERNAL) {
+            // if the dataset has no indexes, delete all its files
+            List<Index> indexes =
+                    MetadataManager.INSTANCE.getDatasetIndexes(mdTxnCtx, 
dataset.getDataverseName(),
+                            dataset.getDatasetName());
+            if (indexes.isEmpty()) {
+                List<ExternalFile> files =
+                        
MetadataManager.INSTANCE.getDatasetExternalFiles(mdTxnCtx, dataset);
+                for (ExternalFile file : files) {
+                    MetadataManager.INSTANCE.dropExternalFile(mdTxnCtx, file);
+                    if (LOGGER.isLoggable(Level.INFO)) {
+                        LOGGER.info("Dropped an external file: " + 
dataset.getDataverseName() + "."
+                                + dataset.getDatasetName()
+                                + "." + file.getFileNumber());
+                    }
+                }
+            }
+        }
+    }
+
     public static boolean isNewUniverse() {
         return isNewUniverse;
     }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/e4b318f6/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/bootstrap/MetadataBuiltinEntities.java
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/bootstrap/MetadataBuiltinEntities.java
 
b/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/bootstrap/MetadataBuiltinEntities.java
new file mode 100644
index 0000000..edbbc4a
--- /dev/null
+++ 
b/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/bootstrap/MetadataBuiltinEntities.java
@@ -0,0 +1,44 @@
+/*
+ * 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.metadata.bootstrap;
+
+import org.apache.asterix.metadata.api.IMetadataEntity;
+import org.apache.asterix.metadata.entities.Datatype;
+import org.apache.asterix.metadata.entities.Dataverse;
+import org.apache.asterix.metadata.utils.MetadataConstants;
+import org.apache.asterix.om.types.ARecordType;
+import org.apache.asterix.om.types.IAType;
+import org.apache.asterix.runtime.formats.NonTaggedDataFormat;
+
+public class MetadataBuiltinEntities {
+    //--------------------------------------- Dataverses 
----------------------------------------//
+    public static final String DEFAULT_DATAVERSE_NAME = "Default";
+    public static final Dataverse DEFAULT_DATAVERSE =
+            new Dataverse(DEFAULT_DATAVERSE_NAME, 
NonTaggedDataFormat.class.getName(),
+                    IMetadataEntity.PENDING_NO_OP);
+    //--------------------------------------- Datatypes 
-----------------------------------------//
+    public static final ARecordType ANY_OBJECT_RECORD_TYPE =
+            new ARecordType("AnyObject", new String[0], new IAType[0], true);
+    public static final Datatype ANY_OBJECT_DATATYPE =
+            new Datatype(MetadataConstants.METADATA_DATAVERSE_NAME, 
ANY_OBJECT_RECORD_TYPE.getTypeName(),
+                    ARecordType.FULLY_OPEN_RECORD_TYPE, false);
+
+    private MetadataBuiltinEntities() {
+    }
+}

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/e4b318f6/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/utils/MetadataConstants.java
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/utils/MetadataConstants.java
 
b/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/utils/MetadataConstants.java
index fbd2380..1dc6657 100644
--- 
a/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/utils/MetadataConstants.java
+++ 
b/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/utils/MetadataConstants.java
@@ -19,9 +19,10 @@
 
 package org.apache.asterix.metadata.utils;
 
+/**
+ * Contains metadata constants
+ */
 public class MetadataConstants {
-    private MetadataConstants() {
-    }
 
     // Name of the dataverse the metadata lives in.
     public static final String METADATA_DATAVERSE_NAME = "Metadata";
@@ -32,4 +33,7 @@ public class MetadataConstants {
     // Name of the default nodegroup where internal/feed datasets will be 
partitioned
     // if an explicit nodegroup is not specified at the time of creation of a 
dataset
     public static final String METADATA_DEFAULT_NODEGROUP_NAME = 
"DEFAULT_NG_ALL_NODES";
+
+    private MetadataConstants() {
+    }
 }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/e4b318f6/asterixdb/asterix-server/src/test/java/org/apache/asterix/server/test/NCServiceExecutionIT.java
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-server/src/test/java/org/apache/asterix/server/test/NCServiceExecutionIT.java
 
b/asterixdb/asterix-server/src/test/java/org/apache/asterix/server/test/NCServiceExecutionIT.java
index ab50b51..e3a561d 100644
--- 
a/asterixdb/asterix-server/src/test/java/org/apache/asterix/server/test/NCServiceExecutionIT.java
+++ 
b/asterixdb/asterix-server/src/test/java/org/apache/asterix/server/test/NCServiceExecutionIT.java
@@ -21,6 +21,7 @@ package org.apache.asterix.server.test;
 import java.io.File;
 import java.util.ArrayList;
 import java.util.Collection;
+import java.util.List;
 import java.util.logging.Logger;
 
 import org.apache.asterix.test.aql.TestExecutor;
@@ -93,6 +94,8 @@ public class NCServiceExecutionIT {
 
     private final TestCaseContext tcCtx;
     private static final TestExecutor testExecutor = new TestExecutor();
+
+    private static final List<String> badTestCases = new ArrayList<>();
     private static HyracksVirtualCluster cluster;
 
     @BeforeClass
@@ -113,30 +116,25 @@ public class NCServiceExecutionIT {
         cluster = new HyracksVirtualCluster(new File(APP_HOME), new 
File(ASTERIX_APP_DIR));
         cluster.addNCService(
                 new File(CONF_DIR, "ncservice1.conf"),
-                new File(LOG_DIR, "ncservice1.log")
-        );
+                new File(LOG_DIR, "ncservice1.log"));
         cluster.addNCService(
                 new File(CONF_DIR, "ncservice2.conf"),
-                new File(LOG_DIR, "ncservice2.log")
-        );
+                new File(LOG_DIR, "ncservice2.log"));
 
         try {
             Thread.sleep(2000);
-        }
-        catch (InterruptedException ignored) {
+        } catch (InterruptedException ignored) {
         }
 
         // Start CC
         cluster.start(
                 new File(CONF_DIR, "cc.conf"),
-                new File(LOG_DIR, "cc.log")
-        );
+                new File(LOG_DIR, "cc.log"));
 
         LOGGER.info("Sleeping while cluster comes online...");
         try {
             Thread.sleep(6000);
-        }
-        catch (InterruptedException ignored) {
+        } catch (InterruptedException ignored) {
         }
     }
 
@@ -149,6 +147,12 @@ public class NCServiceExecutionIT {
         }
         cluster.stop();
         HDFSCluster.getInstance().cleanup();
+        if (!badTestCases.isEmpty()) {
+            System.out.println("The following test cases left some data");
+            for (String testCase : badTestCases) {
+                System.out.println(testCase);
+            }
+        }
     }
 
     @Parameters
@@ -157,7 +161,7 @@ public class NCServiceExecutionIT {
         TestCaseContext.Builder b = new TestCaseContext.Builder();
         for (TestCaseContext ctx : b.build(new File(TESTS_DIR))) {
             if (!skip(ctx)) {
-                testArgs.add(new Object[]{ctx});
+                testArgs.add(new Object[] { ctx });
             }
         }
         return testArgs;
@@ -176,7 +180,6 @@ public class NCServiceExecutionIT {
         return false;
     }
 
-
     public NCServiceExecutionIT(TestCaseContext ctx) {
         this.tcCtx = ctx;
     }
@@ -184,5 +187,6 @@ public class NCServiceExecutionIT {
     @Test
     public void test() throws Exception {
         testExecutor.executeTest(ACTUAL_RESULTS_DIR, tcCtx, null, false);
+        testExecutor.cleanup(tcCtx.toString(), badTestCases);
     }
 }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/e4b318f6/asterixdb/asterix-yarn/src/test/resources/library/results/library-metadata/dataverseDataset/dataverseDataset.1.adm
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-yarn/src/test/resources/library/results/library-metadata/dataverseDataset/dataverseDataset.1.adm
 
b/asterixdb/asterix-yarn/src/test/resources/library/results/library-metadata/dataverseDataset/dataverseDataset.1.adm
index d4e5619..99b23da 100644
--- 
a/asterixdb/asterix-yarn/src/test/resources/library/results/library-metadata/dataverseDataset/dataverseDataset.1.adm
+++ 
b/asterixdb/asterix-yarn/src/test/resources/library/results/library-metadata/dataverseDataset/dataverseDataset.1.adm
@@ -1,2 +1,3 @@
+{ "DataverseName": "Default", "DataFormat": 
"org.apache.asterix.runtime.formats.NonTaggedDataFormat", "Timestamp": "Thu Sep 
15 03:11:25 UTC 2016", "PendingOp": 0 }
 { "DataverseName": "Metadata", "DataFormat": 
"org.apache.asterix.runtime.formats.NonTaggedDataFormat", "Timestamp": "Thu Apr 
25 11:17:56 PDT 2013", "PendingOp": 0 }
 { "DataverseName": "externallibtest", "DataFormat": 
"org.apache.asterix.runtime.formats.NonTaggedDataFormat", "Timestamp": "Thu Apr 
25 11:18:12 PDT 2013", "PendingOp": 0 }

Reply via email to