You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@asterixdb.apache.org by dl...@apache.org on 2018/10/25 21:32:08 UTC

[04/11] asterixdb git commit: [ASTERIXDB-2459][FUN] Add var() and var_pop() aggregate function

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/2a42da45/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/var_double/var_double.1.ast
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/var_double/var_double.1.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/var_double/var_double.1.ast
new file mode 100644
index 0000000..086bc5f
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/var_double/var_double.1.ast
@@ -0,0 +1,2 @@
+DataverseUse test
+

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/2a42da45/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/var_double/var_double.3.ast
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/var_double/var_double.3.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/var_double/var_double.3.ast
new file mode 100644
index 0000000..3c8e43d
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/var_double/var_double.3.ast
@@ -0,0 +1,51 @@
+Query:
+RecordConstructor [
+  (
+    LiteralExpr [STRING] [var]
+    :
+    (
+      SELECT ELEMENT [
+      FunctionCall asterix.var@1[
+        (
+          SELECT ELEMENT [
+          Variable [ Name=$x ]
+          ]
+          FROM [            OrderedListConstructor [
+              LiteralExpr [DOUBLE] [1.0]
+              LiteralExpr [DOUBLE] [2.0]
+              FunctionCall null.double@1[
+                LiteralExpr [STRING] [3.0]
+              ]
+            ]
+            AS Variable [ Name=$x ]
+          ]
+        )
+      ]
+      ]
+    )
+  )
+  (
+    LiteralExpr [STRING] [var_pop]
+    :
+    (
+      SELECT ELEMENT [
+      FunctionCall asterix.var_pop@1[
+        (
+          SELECT ELEMENT [
+          Variable [ Name=$x ]
+          ]
+          FROM [            OrderedListConstructor [
+              LiteralExpr [DOUBLE] [1.0]
+              LiteralExpr [DOUBLE] [2.0]
+              FunctionCall null.double@1[
+                LiteralExpr [STRING] [3.0]
+              ]
+            ]
+            AS Variable [ Name=$x ]
+          ]
+        )
+      ]
+      ]
+    )
+  )
+]

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/2a42da45/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/var_double_null/var_double_null.1.ast
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/var_double_null/var_double_null.1.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/var_double_null/var_double_null.1.ast
new file mode 100644
index 0000000..2b387f8
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/var_double_null/var_double_null.1.ast
@@ -0,0 +1,13 @@
+DataverseUse test
+TypeDecl NumericType [
+  open RecordType {
+    id : integer,
+    int8Field : tinyint?,
+    int16Field : smallint?,
+    int32Field : integer?,
+    int64Field : bigint?,
+    floatField : float?,
+    doubleField : double?
+  }
+]
+DatasetDecl Numeric(NumericType)is an external dataset

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/2a42da45/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/var_double_null/var_double_null.3.ast
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/var_double_null/var_double_null.3.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/var_double_null/var_double_null.3.ast
new file mode 100644
index 0000000..6ae7dac
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/var_double_null/var_double_null.3.ast
@@ -0,0 +1,42 @@
+DataverseUse test
+Query:
+RecordConstructor [
+  (
+    LiteralExpr [STRING] [var]
+    :
+    FunctionCall asterix.var@1[
+      (
+        SELECT ELEMENT [
+        FieldAccessor [
+          Variable [ Name=$x ]
+          Field=doubleField
+        ]
+        ]
+        FROM [          FunctionCall asterix.dataset@1[
+            LiteralExpr [STRING] [test.Numeric]
+          ]
+          AS Variable [ Name=$x ]
+        ]
+      )
+    ]
+  )
+  (
+    LiteralExpr [STRING] [var_pop]
+    :
+    FunctionCall asterix.var_pop@1[
+      (
+        SELECT ELEMENT [
+        FieldAccessor [
+          Variable [ Name=$x ]
+          Field=doubleField
+        ]
+        ]
+        FROM [          FunctionCall asterix.dataset@1[
+            LiteralExpr [STRING] [test.Numeric]
+          ]
+          AS Variable [ Name=$x ]
+        ]
+      )
+    ]
+  )
+]

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/2a42da45/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/var_empty_01/var_empty_01.1.ast
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/var_empty_01/var_empty_01.1.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/var_empty_01/var_empty_01.1.ast
new file mode 100644
index 0000000..e69de29

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/2a42da45/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/var_empty_01/var_empty_01.3.ast
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/var_empty_01/var_empty_01.3.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/var_empty_01/var_empty_01.3.ast
new file mode 100644
index 0000000..1deb3da
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/var_empty_01/var_empty_01.3.ast
@@ -0,0 +1,60 @@
+DataverseUse test
+Query:
+RecordConstructor [
+  (
+    LiteralExpr [STRING] [var]
+    :
+    (
+      SELECT ELEMENT [
+      FunctionCall asterix.var@1[
+        (
+          SELECT ELEMENT [
+          Variable [ Name=$x ]
+          ]
+          FROM [            OrderedListConstructor [
+              LiteralExpr [LONG] [1]
+              LiteralExpr [LONG] [2]
+              LiteralExpr [LONG] [3]
+            ]
+            AS Variable [ Name=$x ]
+          ]
+          Where
+            OperatorExpr [
+              Variable [ Name=$x ]
+              >
+              LiteralExpr [LONG] [10]
+            ]
+        )
+      ]
+      ]
+    )
+  )
+  (
+    LiteralExpr [STRING] [var_pop]
+    :
+    (
+      SELECT ELEMENT [
+      FunctionCall asterix.var_pop@1[
+        (
+          SELECT ELEMENT [
+          Variable [ Name=$x ]
+          ]
+          FROM [            OrderedListConstructor [
+              LiteralExpr [LONG] [1]
+              LiteralExpr [LONG] [2]
+              LiteralExpr [LONG] [3]
+            ]
+            AS Variable [ Name=$x ]
+          ]
+          Where
+            OperatorExpr [
+              Variable [ Name=$x ]
+              >
+              LiteralExpr [LONG] [10]
+            ]
+        )
+      ]
+      ]
+    )
+  )
+]

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/2a42da45/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/var_empty_02/var_empty_02.1.ast
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/var_empty_02/var_empty_02.1.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/var_empty_02/var_empty_02.1.ast
new file mode 100644
index 0000000..babcce4
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/var_empty_02/var_empty_02.1.ast
@@ -0,0 +1,8 @@
+DataverseUse test
+TypeDecl TestType [
+  closed RecordType {
+    id : integer,
+    val : double
+  }
+]
+DatasetDecl Test(TestType) partitioned by [[id]]

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/2a42da45/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/var_empty_02/var_empty_02.3.ast
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/var_empty_02/var_empty_02.3.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/var_empty_02/var_empty_02.3.ast
new file mode 100644
index 0000000..2bafb81
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/var_empty_02/var_empty_02.3.ast
@@ -0,0 +1,50 @@
+DataverseUse test
+Query:
+RecordConstructor [
+  (
+    LiteralExpr [STRING] [var]
+    :
+    (
+      SELECT ELEMENT [
+      FunctionCall asterix.var@1[
+        (
+          SELECT ELEMENT [
+          FieldAccessor [
+            Variable [ Name=$x ]
+            Field=val
+          ]
+          ]
+          FROM [            FunctionCall asterix.dataset@1[
+              LiteralExpr [STRING] [test.Test]
+            ]
+            AS Variable [ Name=$x ]
+          ]
+        )
+      ]
+      ]
+    )
+  )
+  (
+    LiteralExpr [STRING] [var_pop]
+    :
+    (
+      SELECT ELEMENT [
+      FunctionCall asterix.var_pop@1[
+        (
+          SELECT ELEMENT [
+          FieldAccessor [
+            Variable [ Name=$x ]
+            Field=val
+          ]
+          ]
+          FROM [            FunctionCall asterix.dataset@1[
+              LiteralExpr [STRING] [test.Test]
+            ]
+            AS Variable [ Name=$x ]
+          ]
+        )
+      ]
+      ]
+    )
+  )
+]

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/2a42da45/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/var_float/var_float.1.ast
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/var_float/var_float.1.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/var_float/var_float.1.ast
new file mode 100644
index 0000000..e69de29

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/2a42da45/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/var_float/var_float.3.ast
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/var_float/var_float.3.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/var_float/var_float.3.ast
new file mode 100644
index 0000000..b83c96c
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/var_float/var_float.3.ast
@@ -0,0 +1,60 @@
+DataverseUse test
+Query:
+RecordConstructor [
+  (
+    LiteralExpr [STRING] [var]
+    :
+    (
+      SELECT ELEMENT [
+      FunctionCall asterix.var@1[
+        (
+          SELECT ELEMENT [
+          Variable [ Name=$x ]
+          ]
+          FROM [            OrderedListConstructor [
+              FunctionCall test.float@1[
+                LiteralExpr [STRING] [1]
+              ]
+              FunctionCall test.float@1[
+                LiteralExpr [STRING] [2]
+              ]
+              FunctionCall test.float@1[
+                LiteralExpr [STRING] [3]
+              ]
+            ]
+            AS Variable [ Name=$x ]
+          ]
+        )
+      ]
+      ]
+    )
+  )
+  (
+    LiteralExpr [STRING] [var_pop]
+    :
+    (
+      SELECT ELEMENT [
+      FunctionCall asterix.var_pop@1[
+        (
+          SELECT ELEMENT [
+          Variable [ Name=$x ]
+          ]
+          FROM [            OrderedListConstructor [
+              FunctionCall test.float@1[
+                LiteralExpr [STRING] [1]
+              ]
+              FunctionCall test.float@1[
+                LiteralExpr [STRING] [2]
+              ]
+              FunctionCall test.float@1[
+                LiteralExpr [STRING] [3]
+              ]
+            ]
+            AS Variable [ Name=$x ]
+          ]
+        )
+      ]
+      ]
+    )
+  )
+]

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/2a42da45/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/var_float_null/var_float_nu.1.ast
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/var_float_null/var_float_nu.1.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/var_float_null/var_float_nu.1.ast
new file mode 100644
index 0000000..2b387f8
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/var_float_null/var_float_nu.1.ast
@@ -0,0 +1,13 @@
+DataverseUse test
+TypeDecl NumericType [
+  open RecordType {
+    id : integer,
+    int8Field : tinyint?,
+    int16Field : smallint?,
+    int32Field : integer?,
+    int64Field : bigint?,
+    floatField : float?,
+    doubleField : double?
+  }
+]
+DatasetDecl Numeric(NumericType)is an external dataset

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/2a42da45/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/var_float_null/var_float_nu.3.ast
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/var_float_null/var_float_nu.3.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/var_float_null/var_float_nu.3.ast
new file mode 100644
index 0000000..e057b6f
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/var_float_null/var_float_nu.3.ast
@@ -0,0 +1,42 @@
+DataverseUse test
+Query:
+RecordConstructor [
+  (
+    LiteralExpr [STRING] [var]
+    :
+    FunctionCall asterix.var@1[
+      (
+        SELECT ELEMENT [
+        FieldAccessor [
+          Variable [ Name=$x ]
+          Field=floatField
+        ]
+        ]
+        FROM [          FunctionCall asterix.dataset@1[
+            LiteralExpr [STRING] [test.Numeric]
+          ]
+          AS Variable [ Name=$x ]
+        ]
+      )
+    ]
+  )
+  (
+    LiteralExpr [STRING] [var_pop]
+    :
+    FunctionCall asterix.var_pop@1[
+      (
+        SELECT ELEMENT [
+        FieldAccessor [
+          Variable [ Name=$x ]
+          Field=floatField
+        ]
+        ]
+        FROM [          FunctionCall asterix.dataset@1[
+            LiteralExpr [STRING] [test.Numeric]
+          ]
+          AS Variable [ Name=$x ]
+        ]
+      )
+    ]
+  )
+]

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/2a42da45/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/var_int16/var_int16.1.ast
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/var_int16/var_int16.1.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/var_int16/var_int16.1.ast
new file mode 100644
index 0000000..e69de29

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/2a42da45/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/var_int16/var_int16.3.ast
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/var_int16/var_int16.3.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/var_int16/var_int16.3.ast
new file mode 100644
index 0000000..79bcb4a
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/var_int16/var_int16.3.ast
@@ -0,0 +1,60 @@
+DataverseUse test
+Query:
+RecordConstructor [
+  (
+    LiteralExpr [STRING] [var]
+    :
+    (
+      SELECT ELEMENT [
+      FunctionCall asterix.var@1[
+        (
+          SELECT ELEMENT [
+          Variable [ Name=$x ]
+          ]
+          FROM [            OrderedListConstructor [
+              FunctionCall test.int16@1[
+                LiteralExpr [STRING] [1]
+              ]
+              FunctionCall test.int16@1[
+                LiteralExpr [STRING] [2]
+              ]
+              FunctionCall test.int16@1[
+                LiteralExpr [STRING] [3]
+              ]
+            ]
+            AS Variable [ Name=$x ]
+          ]
+        )
+      ]
+      ]
+    )
+  )
+  (
+    LiteralExpr [STRING] [var_pop]
+    :
+    (
+      SELECT ELEMENT [
+      FunctionCall asterix.var_pop@1[
+        (
+          SELECT ELEMENT [
+          Variable [ Name=$x ]
+          ]
+          FROM [            OrderedListConstructor [
+              FunctionCall test.int16@1[
+                LiteralExpr [STRING] [1]
+              ]
+              FunctionCall test.int16@1[
+                LiteralExpr [STRING] [2]
+              ]
+              FunctionCall test.int16@1[
+                LiteralExpr [STRING] [3]
+              ]
+            ]
+            AS Variable [ Name=$x ]
+          ]
+        )
+      ]
+      ]
+    )
+  )
+]

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/2a42da45/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/var_int16_null/var_int16_null.1.ast
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/var_int16_null/var_int16_null.1.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/var_int16_null/var_int16_null.1.ast
new file mode 100644
index 0000000..2b387f8
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/var_int16_null/var_int16_null.1.ast
@@ -0,0 +1,13 @@
+DataverseUse test
+TypeDecl NumericType [
+  open RecordType {
+    id : integer,
+    int8Field : tinyint?,
+    int16Field : smallint?,
+    int32Field : integer?,
+    int64Field : bigint?,
+    floatField : float?,
+    doubleField : double?
+  }
+]
+DatasetDecl Numeric(NumericType)is an external dataset

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/2a42da45/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/var_int16_null/var_int16_null.3.ast
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/var_int16_null/var_int16_null.3.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/var_int16_null/var_int16_null.3.ast
new file mode 100644
index 0000000..9b566f4
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/var_int16_null/var_int16_null.3.ast
@@ -0,0 +1,42 @@
+DataverseUse test
+Query:
+RecordConstructor [
+  (
+    LiteralExpr [STRING] [var]
+    :
+    FunctionCall asterix.var@1[
+      (
+        SELECT ELEMENT [
+        FieldAccessor [
+          Variable [ Name=$x ]
+          Field=int16Field
+        ]
+        ]
+        FROM [          FunctionCall asterix.dataset@1[
+            LiteralExpr [STRING] [test.Numeric]
+          ]
+          AS Variable [ Name=$x ]
+        ]
+      )
+    ]
+  )
+  (
+    LiteralExpr [STRING] [var_pop]
+    :
+    FunctionCall asterix.var_pop@1[
+      (
+        SELECT ELEMENT [
+        FieldAccessor [
+          Variable [ Name=$x ]
+          Field=int16Field
+        ]
+        ]
+        FROM [          FunctionCall asterix.dataset@1[
+            LiteralExpr [STRING] [test.Numeric]
+          ]
+          AS Variable [ Name=$x ]
+        ]
+      )
+    ]
+  )
+]

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/2a42da45/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/var_int32/var_int32.1.ast
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/var_int32/var_int32.1.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/var_int32/var_int32.1.ast
new file mode 100644
index 0000000..e69de29

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/2a42da45/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/var_int32/var_int32.3.ast
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/var_int32/var_int32.3.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/var_int32/var_int32.3.ast
new file mode 100644
index 0000000..154538e
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/var_int32/var_int32.3.ast
@@ -0,0 +1,48 @@
+DataverseUse test
+Query:
+RecordConstructor [
+  (
+    LiteralExpr [STRING] [var]
+    :
+    (
+      SELECT ELEMENT [
+      FunctionCall asterix.var@1[
+        (
+          SELECT ELEMENT [
+          Variable [ Name=$x ]
+          ]
+          FROM [            OrderedListConstructor [
+              LiteralExpr [LONG] [1]
+              LiteralExpr [LONG] [2]
+              LiteralExpr [LONG] [3]
+            ]
+            AS Variable [ Name=$x ]
+          ]
+        )
+      ]
+      ]
+    )
+  )
+  (
+    LiteralExpr [STRING] [var_pop]
+    :
+    (
+      SELECT ELEMENT [
+      FunctionCall asterix.var_pop@1[
+        (
+          SELECT ELEMENT [
+          Variable [ Name=$x ]
+          ]
+          FROM [            OrderedListConstructor [
+              LiteralExpr [LONG] [1]
+              LiteralExpr [LONG] [2]
+              LiteralExpr [LONG] [3]
+            ]
+            AS Variable [ Name=$x ]
+          ]
+        )
+      ]
+      ]
+    )
+  )
+]

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/2a42da45/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/var_int32_null/var_int32_null.1.ast
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/var_int32_null/var_int32_null.1.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/var_int32_null/var_int32_null.1.ast
new file mode 100644
index 0000000..2b387f8
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/var_int32_null/var_int32_null.1.ast
@@ -0,0 +1,13 @@
+DataverseUse test
+TypeDecl NumericType [
+  open RecordType {
+    id : integer,
+    int8Field : tinyint?,
+    int16Field : smallint?,
+    int32Field : integer?,
+    int64Field : bigint?,
+    floatField : float?,
+    doubleField : double?
+  }
+]
+DatasetDecl Numeric(NumericType)is an external dataset

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/2a42da45/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/var_int32_null/var_int32_null.3.ast
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/var_int32_null/var_int32_null.3.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/var_int32_null/var_int32_null.3.ast
new file mode 100644
index 0000000..054780c
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/var_int32_null/var_int32_null.3.ast
@@ -0,0 +1,42 @@
+DataverseUse test
+Query:
+RecordConstructor [
+  (
+    LiteralExpr [STRING] [var]
+    :
+    FunctionCall asterix.var@1[
+      (
+        SELECT ELEMENT [
+        FieldAccessor [
+          Variable [ Name=$x ]
+          Field=int32Field
+        ]
+        ]
+        FROM [          FunctionCall asterix.dataset@1[
+            LiteralExpr [STRING] [test.Numeric]
+          ]
+          AS Variable [ Name=$x ]
+        ]
+      )
+    ]
+  )
+  (
+    LiteralExpr [STRING] [var_pop]
+    :
+    FunctionCall asterix.var_pop@1[
+      (
+        SELECT ELEMENT [
+        FieldAccessor [
+          Variable [ Name=$x ]
+          Field=int32Field
+        ]
+        ]
+        FROM [          FunctionCall asterix.dataset@1[
+            LiteralExpr [STRING] [test.Numeric]
+          ]
+          AS Variable [ Name=$x ]
+        ]
+      )
+    ]
+  )
+]

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/2a42da45/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/var_int64/var_int64.1.ast
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/var_int64/var_int64.1.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/var_int64/var_int64.1.ast
new file mode 100644
index 0000000..e69de29

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/2a42da45/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/var_int64/var_int64.3.ast
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/var_int64/var_int64.3.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/var_int64/var_int64.3.ast
new file mode 100644
index 0000000..afbe240
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/var_int64/var_int64.3.ast
@@ -0,0 +1,60 @@
+DataverseUse test
+Query:
+RecordConstructor [
+  (
+    LiteralExpr [STRING] [var]
+    :
+    (
+      SELECT ELEMENT [
+      FunctionCall asterix.var@1[
+        (
+          SELECT ELEMENT [
+          Variable [ Name=$x ]
+          ]
+          FROM [            OrderedListConstructor [
+              FunctionCall test.int64@1[
+                LiteralExpr [STRING] [1]
+              ]
+              FunctionCall test.int64@1[
+                LiteralExpr [STRING] [2]
+              ]
+              FunctionCall test.int64@1[
+                LiteralExpr [STRING] [3]
+              ]
+            ]
+            AS Variable [ Name=$x ]
+          ]
+        )
+      ]
+      ]
+    )
+  )
+  (
+    LiteralExpr [STRING] [var_pop]
+    :
+    (
+      SELECT ELEMENT [
+      FunctionCall asterix.var_pop@1[
+        (
+          SELECT ELEMENT [
+          Variable [ Name=$x ]
+          ]
+          FROM [            OrderedListConstructor [
+              FunctionCall test.int64@1[
+                LiteralExpr [STRING] [1]
+              ]
+              FunctionCall test.int64@1[
+                LiteralExpr [STRING] [2]
+              ]
+              FunctionCall test.int64@1[
+                LiteralExpr [STRING] [3]
+              ]
+            ]
+            AS Variable [ Name=$x ]
+          ]
+        )
+      ]
+      ]
+    )
+  )
+]

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/2a42da45/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/var_int64_null/var_int64_null.1.ast
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/var_int64_null/var_int64_null.1.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/var_int64_null/var_int64_null.1.ast
new file mode 100644
index 0000000..2b387f8
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/var_int64_null/var_int64_null.1.ast
@@ -0,0 +1,13 @@
+DataverseUse test
+TypeDecl NumericType [
+  open RecordType {
+    id : integer,
+    int8Field : tinyint?,
+    int16Field : smallint?,
+    int32Field : integer?,
+    int64Field : bigint?,
+    floatField : float?,
+    doubleField : double?
+  }
+]
+DatasetDecl Numeric(NumericType)is an external dataset

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/2a42da45/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/var_int64_null/var_int64_null.3.ast
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/var_int64_null/var_int64_null.3.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/var_int64_null/var_int64_null.3.ast
new file mode 100644
index 0000000..98b7ca7
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/var_int64_null/var_int64_null.3.ast
@@ -0,0 +1,42 @@
+DataverseUse test
+Query:
+RecordConstructor [
+  (
+    LiteralExpr [STRING] [var]
+    :
+    FunctionCall asterix.var@1[
+      (
+        SELECT ELEMENT [
+        FieldAccessor [
+          Variable [ Name=$x ]
+          Field=int64Field
+        ]
+        ]
+        FROM [          FunctionCall asterix.dataset@1[
+            LiteralExpr [STRING] [test.Numeric]
+          ]
+          AS Variable [ Name=$x ]
+        ]
+      )
+    ]
+  )
+  (
+    LiteralExpr [STRING] [var_pop]
+    :
+    FunctionCall asterix.var_pop@1[
+      (
+        SELECT ELEMENT [
+        FieldAccessor [
+          Variable [ Name=$x ]
+          Field=int64Field
+        ]
+        ]
+        FROM [          FunctionCall asterix.dataset@1[
+            LiteralExpr [STRING] [test.Numeric]
+          ]
+          AS Variable [ Name=$x ]
+        ]
+      )
+    ]
+  )
+]

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/2a42da45/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/var_int8/var_int8.1.ast
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/var_int8/var_int8.1.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/var_int8/var_int8.1.ast
new file mode 100644
index 0000000..e69de29

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/2a42da45/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/var_int8/var_int8.3.ast
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/var_int8/var_int8.3.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/var_int8/var_int8.3.ast
new file mode 100644
index 0000000..f51aeee
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/var_int8/var_int8.3.ast
@@ -0,0 +1,60 @@
+DataverseUse test
+Query:
+RecordConstructor [
+  (
+    LiteralExpr [STRING] [var]
+    :
+    (
+      SELECT ELEMENT [
+      FunctionCall asterix.var@1[
+        (
+          SELECT ELEMENT [
+          Variable [ Name=$x ]
+          ]
+          FROM [            OrderedListConstructor [
+              FunctionCall test.int8@1[
+                LiteralExpr [STRING] [1]
+              ]
+              FunctionCall test.int8@1[
+                LiteralExpr [STRING] [2]
+              ]
+              FunctionCall test.int8@1[
+                LiteralExpr [STRING] [3]
+              ]
+            ]
+            AS Variable [ Name=$x ]
+          ]
+        )
+      ]
+      ]
+    )
+  )
+  (
+    LiteralExpr [STRING] [var_pop]
+    :
+    (
+      SELECT ELEMENT [
+      FunctionCall asterix.var_pop@1[
+        (
+          SELECT ELEMENT [
+          Variable [ Name=$x ]
+          ]
+          FROM [            OrderedListConstructor [
+              FunctionCall test.int8@1[
+                LiteralExpr [STRING] [1]
+              ]
+              FunctionCall test.int8@1[
+                LiteralExpr [STRING] [2]
+              ]
+              FunctionCall test.int8@1[
+                LiteralExpr [STRING] [3]
+              ]
+            ]
+            AS Variable [ Name=$x ]
+          ]
+        )
+      ]
+      ]
+    )
+  )
+]

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/2a42da45/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/var_int8_null/var_int8_null.1.ast
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/var_int8_null/var_int8_null.1.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/var_int8_null/var_int8_null.1.ast
new file mode 100644
index 0000000..2b387f8
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/var_int8_null/var_int8_null.1.ast
@@ -0,0 +1,13 @@
+DataverseUse test
+TypeDecl NumericType [
+  open RecordType {
+    id : integer,
+    int8Field : tinyint?,
+    int16Field : smallint?,
+    int32Field : integer?,
+    int64Field : bigint?,
+    floatField : float?,
+    doubleField : double?
+  }
+]
+DatasetDecl Numeric(NumericType)is an external dataset

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/2a42da45/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/var_int8_null/var_int8_null.3.ast
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/var_int8_null/var_int8_null.3.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/var_int8_null/var_int8_null.3.ast
new file mode 100644
index 0000000..40ae288
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/var_int8_null/var_int8_null.3.ast
@@ -0,0 +1,42 @@
+DataverseUse test
+Query:
+RecordConstructor [
+  (
+    LiteralExpr [STRING] [var]
+    :
+    FunctionCall asterix.var@1[
+      (
+        SELECT ELEMENT [
+        FieldAccessor [
+          Variable [ Name=$x ]
+          Field=int8Field
+        ]
+        ]
+        FROM [          FunctionCall asterix.dataset@1[
+            LiteralExpr [STRING] [test.Numeric]
+          ]
+          AS Variable [ Name=$x ]
+        ]
+      )
+    ]
+  )
+  (
+    LiteralExpr [STRING] [var_pop]
+    :
+    FunctionCall asterix.var_pop@1[
+      (
+        SELECT ELEMENT [
+        FieldAccessor [
+          Variable [ Name=$x ]
+          Field=int8Field
+        ]
+        ]
+        FROM [          FunctionCall asterix.dataset@1[
+            LiteralExpr [STRING] [test.Numeric]
+          ]
+          AS Variable [ Name=$x ]
+        ]
+      )
+    ]
+  )
+]

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/2a42da45/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/var_mixed/var_mixed.3.ast
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/var_mixed/var_mixed.3.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/var_mixed/var_mixed.3.ast
new file mode 100644
index 0000000..ae1dddb
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/var_mixed/var_mixed.3.ast
@@ -0,0 +1,22 @@
+Query:
+SELECT ELEMENT [
+FunctionCall asterix.var@1[
+  (
+    SELECT ELEMENT [
+    Variable [ Name=$x ]
+    ]
+    FROM [      OrderedListConstructor [
+        FunctionCall null.float@1[
+          LiteralExpr [STRING] [2.0]
+        ]
+        LiteralExpr [STRING] [hello world]
+        LiteralExpr [LONG] [93847382783847382]
+        FunctionCall null.date@1[
+          LiteralExpr [STRING] [2013-01-01]
+        ]
+      ]
+      AS Variable [ Name=$x ]
+    ]
+  )
+]
+]

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/2a42da45/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/var_pop_mixed/var_pop_mixed.3.ast
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/var_pop_mixed/var_pop_mixed.3.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/var_pop_mixed/var_pop_mixed.3.ast
new file mode 100644
index 0000000..0756ce7
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/var_pop_mixed/var_pop_mixed.3.ast
@@ -0,0 +1,22 @@
+Query:
+SELECT ELEMENT [
+FunctionCall asterix.var_pop@1[
+  (
+    SELECT ELEMENT [
+    Variable [ Name=$x ]
+    ]
+    FROM [      OrderedListConstructor [
+        FunctionCall null.float@1[
+          LiteralExpr [STRING] [2.0]
+        ]
+        LiteralExpr [STRING] [hello world]
+        LiteralExpr [LONG] [93847382783847382]
+        FunctionCall null.date@1[
+          LiteralExpr [STRING] [2013-01-01]
+        ]
+      ]
+      AS Variable [ Name=$x ]
+    ]
+  )
+]
+]

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/2a42da45/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 2016ea4..1a9c7dd 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_sqlpp.xml
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_sqlpp.xml
@@ -230,6 +230,30 @@
       </compilation-unit>
     </test-case>
     <test-case FilePath="aggregate">
+      <compilation-unit name="var_mixed">
+        <output-dir compare="Text">var_mixed</output-dir>
+        <expected-error>Type incompatibility: function agg-var gets incompatible input values: string and float</expected-error>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="aggregate">
+      <compilation-unit name="serial_var_mixed">
+        <output-dir compare="Text">serial_var_mixed</output-dir>
+        <expected-error>Type incompatibility: function agg-var gets incompatible input values: string and float</expected-error>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="aggregate">
+      <compilation-unit name="var_pop_mixed">
+        <output-dir compare="Text">var_pop_mixed</output-dir>
+        <expected-error>Type incompatibility: function agg-var_pop gets incompatible input values: string and float</expected-error>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="aggregate">
+      <compilation-unit name="serial_var_pop_mixed">
+        <output-dir compare="Text">serial_var_pop_mixed</output-dir>
+        <expected-error>Type incompatibility: function agg-var_pop gets incompatible input values: string and float</expected-error>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="aggregate">
       <compilation-unit name="agg_number">
         <output-dir compare="Text">agg_number</output-dir>
       </compilation-unit>
@@ -566,6 +590,21 @@
       </compilation-unit>
     </test-case>
     <test-case FilePath="aggregate">
+      <compilation-unit name="scalar_var">
+        <output-dir compare="Text">scalar_var</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="aggregate">
+      <compilation-unit name="scalar_var_empty">
+        <output-dir compare="Text">scalar_var_empty</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="aggregate">
+      <compilation-unit name="scalar_var_null">
+        <output-dir compare="Text">scalar_var_null</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="aggregate">
       <compilation-unit name="scalar_sum_empty">
         <output-dir compare="Text">scalar_sum_empty</output-dir>
       </compilation-unit>
@@ -641,6 +680,71 @@
       </compilation-unit>
     </test-case>
     <test-case FilePath="aggregate">
+      <compilation-unit name="serial_var_double">
+        <output-dir compare="Text">serial_var_double</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="aggregate">
+      <compilation-unit name="serial_var_double_null">
+        <output-dir compare="Text">serial_var_double_null</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="aggregate">
+      <compilation-unit name="serial_var_empty">
+        <output-dir compare="Text">serial_var_empty</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="aggregate">
+      <compilation-unit name="serial_var_float">
+        <output-dir compare="Text">serial_var_float</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="aggregate">
+      <compilation-unit name="serial_var_float_null">
+        <output-dir compare="Text">serial_var_float_null</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="aggregate">
+      <compilation-unit name="serial_var_int16">
+        <output-dir compare="Text">serial_var_int16</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="aggregate">
+      <compilation-unit name="serial_var_int16_null">
+        <output-dir compare="Text">serial_var_int16_null</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="aggregate">
+      <compilation-unit name="serial_var_int32">
+        <output-dir compare="Text">serial_var_int32</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="aggregate">
+      <compilation-unit name="serial_var_int32_null">
+        <output-dir compare="Text">serial_var_int32_null</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="aggregate">
+      <compilation-unit name="serial_var_int64">
+        <output-dir compare="Text">serial_var_int64</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="aggregate">
+      <compilation-unit name="serial_var_int64_null">
+        <output-dir compare="Text">serial_var_int64_null</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="aggregate">
+      <compilation-unit name="serial_var_int8">
+        <output-dir compare="Text">serial_var_int8</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="aggregate">
+      <compilation-unit name="serial_var_int8_null">
+        <output-dir compare="Text">serial_var_int8_null</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="aggregate">
       <compilation-unit name="stddev_double">
         <output-dir compare="Text">stddev_double</output-dir>
       </compilation-unit>
@@ -800,6 +904,81 @@
         <output-dir compare="Text">sum_distinct</output-dir>
       </compilation-unit>
     </test-case>
+    <test-case FilePath="aggregate">
+      <compilation-unit name="var_double">
+        <output-dir compare="Text">var_double</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="aggregate">
+      <compilation-unit name="var_double_null">
+        <output-dir compare="Text">var_double_null</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="aggregate">
+      <compilation-unit name="var_empty_01">
+        <output-dir compare="Text">var_empty_01</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="aggregate">
+      <compilation-unit name="var_empty_02">
+        <output-dir compare="Text">var_empty_02</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="aggregate">
+      <compilation-unit name="var_float">
+        <output-dir compare="Text">var_float</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="aggregate">
+      <compilation-unit name="var_float_null">
+        <output-dir compare="Text">var_float_null</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="aggregate">
+      <compilation-unit name="var_int16">
+        <output-dir compare="Text">var_int16</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="aggregate">
+      <compilation-unit name="var_int16_null">
+        <output-dir compare="Text">var_int16_null</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="aggregate">
+      <compilation-unit name="var_int32">
+        <output-dir compare="Text">var_int32</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="aggregate">
+      <compilation-unit name="var_int32_null">
+        <output-dir compare="Text">var_int32_null</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="aggregate">
+      <compilation-unit name="var_int64">
+        <output-dir compare="Text">var_int64</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="aggregate">
+      <compilation-unit name="var_int64_null">
+        <output-dir compare="Text">var_int64_null</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="aggregate">
+      <compilation-unit name="var_int8">
+        <output-dir compare="Text">var_int8</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="aggregate">
+      <compilation-unit name="var_int8_null">
+        <output-dir compare="Text">var_int8_null</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="aggregate">
+      <compilation-unit name="var_distinct">
+        <output-dir compare="Text">var_distinct</output-dir>
+      </compilation-unit>
+    </test-case>
   </test-group>
   <test-group name="aggregate-sql">
     <test-case FilePath="aggregate-sql">
@@ -870,6 +1049,30 @@
       </compilation-unit>
     </test-case>
     <test-case FilePath="aggregate-sql">
+      <compilation-unit name="serial_var_mixed">
+        <output-dir compare="Text">serial_var_mixed</output-dir>
+        <expected-error>Invalid item type: function agg-var cannot process item type string in an input array (or multiset)</expected-error>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="aggregate-sql">
+      <compilation-unit name="var_mixed">
+        <output-dir compare="Text">var_mixed</output-dir>
+        <expected-error>Type incompatibility: function agg-var gets incompatible input values: string and float</expected-error>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="aggregate-sql">
+      <compilation-unit name="serial_var_pop_mixed">
+        <output-dir compare="Text">serial_var_pop_mixed</output-dir>
+        <expected-error>Invalid item type: function agg-var_pop cannot process item type string in an input array (or multiset)</expected-error>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="aggregate-sql">
+      <compilation-unit name="var_pop_mixed">
+        <output-dir compare="Text">var_pop_mixed</output-dir>
+        <expected-error>Type incompatibility: function agg-var_pop gets incompatible input values: string and float</expected-error>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="aggregate-sql">
       <compilation-unit name="agg_number">
         <output-dir compare="Text">agg_number</output-dir>
       </compilation-unit>
@@ -1145,6 +1348,21 @@
       </compilation-unit>
     </test-case>
     <test-case FilePath="aggregate-sql">
+      <compilation-unit name="scalar_var">
+        <output-dir compare="Text">scalar_var</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="aggregate-sql">
+      <compilation-unit name="scalar_var_empty">
+        <output-dir compare="Text">scalar_var_empty</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="aggregate-sql">
+      <compilation-unit name="scalar_var_null">
+        <output-dir compare="Text">scalar_var_null</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="aggregate-sql">
       <compilation-unit name="serial_stddev_double">
         <output-dir compare="Text">serial_stddev_double</output-dir>
       </compilation-unit>
@@ -1210,6 +1428,71 @@
       </compilation-unit>
     </test-case>
     <test-case FilePath="aggregate-sql">
+      <compilation-unit name="serial_var_double">
+        <output-dir compare="Text">serial_var_double</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="aggregate-sql">
+      <compilation-unit name="serial_var_double_null">
+        <output-dir compare="Text">serial_var_double_null</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="aggregate-sql">
+      <compilation-unit name="serial_var_empty">
+        <output-dir compare="Text">serial_var_empty</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="aggregate-sql">
+      <compilation-unit name="serial_var_float">
+        <output-dir compare="Text">serial_var_float</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="aggregate-sql">
+      <compilation-unit name="serial_var_float_null">
+        <output-dir compare="Text">serial_var_float_null</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="aggregate-sql">
+      <compilation-unit name="serial_var_int16">
+        <output-dir compare="Text">serial_var_int16</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="aggregate-sql">
+      <compilation-unit name="serial_var_int16_null">
+        <output-dir compare="Text">serial_var_int16_null</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="aggregate-sql">
+      <compilation-unit name="serial_var_int32">
+        <output-dir compare="Text">serial_var_int32</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="aggregate-sql">
+      <compilation-unit name="serial_var_int32_null">
+        <output-dir compare="Text">serial_var_int32_null</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="aggregate-sql">
+      <compilation-unit name="serial_var_int64">
+        <output-dir compare="Text">serial_var_int64</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="aggregate-sql">
+      <compilation-unit name="serial_var_int64_null">
+        <output-dir compare="Text">serial_var_int64_null</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="aggregate-sql">
+      <compilation-unit name="serial_var_int8">
+        <output-dir compare="Text">serial_var_int8</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="aggregate-sql">
+      <compilation-unit name="serial_var_int8_null">
+        <output-dir compare="Text">serial_var_int8_null</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="aggregate-sql">
       <compilation-unit name="stddev_double">
         <output-dir compare="Text">stddev_double</output-dir>
       </compilation-unit>
@@ -1369,6 +1652,81 @@
         <output-dir compare="Text">sum_distinct</output-dir>
       </compilation-unit>
     </test-case>
+    <test-case FilePath="aggregate-sql">
+      <compilation-unit name="var_double">
+        <output-dir compare="Text">var_double</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="aggregate-sql">
+      <compilation-unit name="var_double_null">
+        <output-dir compare="Text">var_double_null</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="aggregate-sql">
+      <compilation-unit name="var_empty_01">
+        <output-dir compare="Text">var_empty_01</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="aggregate-sql">
+      <compilation-unit name="var_empty_02">
+        <output-dir compare="Text">var_empty_02</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="aggregate-sql">
+      <compilation-unit name="var_float">
+        <output-dir compare="Text">var_float</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="aggregate-sql">
+      <compilation-unit name="var_float_null">
+        <output-dir compare="Text">var_float_null</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="aggregate-sql">
+      <compilation-unit name="var_int16">
+        <output-dir compare="Text">var_int16</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="aggregate-sql">
+      <compilation-unit name="var_int16_null">
+        <output-dir compare="Text">var_int16_null</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="aggregate-sql">
+      <compilation-unit name="var_int32">
+        <output-dir compare="Text">var_int32</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="aggregate-sql">
+      <compilation-unit name="var_int32_null">
+        <output-dir compare="Text">var_int32_null</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="aggregate-sql">
+      <compilation-unit name="var_int64">
+        <output-dir compare="Text">var_int64</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="aggregate-sql">
+      <compilation-unit name="var_int64_null">
+        <output-dir compare="Text">var_int64_null</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="aggregate-sql">
+      <compilation-unit name="var_int8">
+        <output-dir compare="Text">var_int8</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="aggregate-sql">
+      <compilation-unit name="var_int8_null">
+        <output-dir compare="Text">var_int8_null</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="aggregate-sql">
+      <compilation-unit name="var_distinct">
+        <output-dir compare="Text">var_distinct</output-dir>
+      </compilation-unit>
+    </test-case>
   </test-group>
   <test-group name="array_fun">
     <test-case FilePath="array_fun">

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/2a42da45/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_sqlpp_parser.xml
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_sqlpp_parser.xml b/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_sqlpp_parser.xml
index cd77828..48a9553 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_sqlpp_parser.xml
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_sqlpp_parser.xml
@@ -146,6 +146,30 @@
       </compilation-unit>
     </test-case>
     <test-case FilePath="aggregate">
+      <compilation-unit name="var_mixed">
+        <output-dir compare="AST">var_mixed</output-dir>
+        <expected-error>org.apache.asterix.common.exceptions.AsterixException</expected-error>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="aggregate">
+      <compilation-unit name="serial_var_mixed">
+        <output-dir compare="AST">serial_var_mixed</output-dir>
+        <expected-error>org.apache.asterix.common.exceptions.AsterixException</expected-error>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="aggregate">
+      <compilation-unit name="var_pop_mixed">
+        <output-dir compare="AST">var_pop_mixed</output-dir>
+        <expected-error>org.apache.asterix.common.exceptions.AsterixException</expected-error>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="aggregate">
+      <compilation-unit name="serial_var_pop_mixed">
+        <output-dir compare="AST">serial_var_pop_mixed</output-dir>
+        <expected-error>org.apache.asterix.common.exceptions.AsterixException</expected-error>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="aggregate">
       <compilation-unit name="agg_number">
         <output-dir compare="AST">agg_number</output-dir>
       </compilation-unit>
@@ -472,6 +496,21 @@
       </compilation-unit>
     </test-case>
     <test-case FilePath="aggregate">
+      <compilation-unit name="scalar_var">
+        <output-dir compare="AST">scalar_var</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="aggregate">
+      <compilation-unit name="scalar_var_empty">
+        <output-dir compare="AST">scalar_var_empty</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="aggregate">
+      <compilation-unit name="scalar_var_null">
+        <output-dir compare="AST">scalar_var_null</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="aggregate">
       <compilation-unit name="serial_stddev_int8_null">
         <output-dir compare="AST">serial_stddev_int8_null</output-dir>
       </compilation-unit>
@@ -542,6 +581,76 @@
       </compilation-unit>
     </test-case>
     <test-case FilePath="aggregate">
+      <compilation-unit name="serial_var_int8_null">
+        <output-dir compare="AST">serial_var_int8_null</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="aggregate">
+      <compilation-unit name="serial_var_double">
+        <output-dir compare="AST">serial_var_double</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="aggregate">
+      <compilation-unit name="serial_var_double_null">
+        <output-dir compare="AST">serial_var_double_null</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="aggregate">
+      <compilation-unit name="serial_var_empty">
+        <output-dir compare="AST">serial_var_empty</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="aggregate">
+      <compilation-unit name="serial_var_float">
+        <output-dir compare="AST">serial_var_float</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="aggregate">
+      <compilation-unit name="serial_var_float_null">
+        <output-dir compare="AST">serial_var_float_null</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="aggregate">
+      <compilation-unit name="serial_var_int16">
+        <output-dir compare="AST">serial_var_int16</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="aggregate">
+      <compilation-unit name="serial_var_int16_null">
+        <output-dir compare="AST">serial_var_int16_null</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="aggregate">
+      <compilation-unit name="serial_var_int32">
+        <output-dir compare="AST">serial_var_int32</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="aggregate">
+      <compilation-unit name="serial_var_int32_null">
+        <output-dir compare="AST">serial_var_int32_null</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="aggregate">
+      <compilation-unit name="serial_var_int64">
+        <output-dir compare="AST">serial_var_int64</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="aggregate">
+      <compilation-unit name="serial_var_int64_null">
+        <output-dir compare="AST">serial_var_int64_null</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="aggregate">
+      <compilation-unit name="serial_var_int8">
+        <output-dir compare="AST">serial_var_int8</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="aggregate">
+      <compilation-unit name="serial_var_int8_null">
+        <output-dir compare="AST">serial_var_int8_null</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="aggregate">
       <compilation-unit name="stddev_double">
         <output-dir compare="AST">stddev_double</output-dir>
       </compilation-unit>
@@ -691,6 +800,76 @@
         <output-dir compare="AST">sum_numeric_null</output-dir>
       </compilation-unit>
     </test-case>
+    <test-case FilePath="aggregate">
+      <compilation-unit name="var_double">
+        <output-dir compare="AST">var_double</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="aggregate">
+      <compilation-unit name="var_double_null">
+        <output-dir compare="AST">var_double_null</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="aggregate">
+      <compilation-unit name="var_empty_01">
+        <output-dir compare="AST">var_empty_01</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="aggregate">
+      <compilation-unit name="var_empty_02">
+        <output-dir compare="AST">var_empty_02</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="aggregate">
+      <compilation-unit name="var_float">
+        <output-dir compare="AST">var_float</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="aggregate">
+      <compilation-unit name="var_float_null">
+        <output-dir compare="AST">var_float_null</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="aggregate">
+      <compilation-unit name="var_int16">
+        <output-dir compare="AST">var_int16</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="aggregate">
+      <compilation-unit name="var_int16_null">
+        <output-dir compare="AST">var_int16_null</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="aggregate">
+      <compilation-unit name="var_int32">
+        <output-dir compare="AST">var_int32</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="aggregate">
+      <compilation-unit name="var_int32_null">
+        <output-dir compare="AST">var_int32_null</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="aggregate">
+      <compilation-unit name="var_int64">
+        <output-dir compare="AST">var_int64</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="aggregate">
+      <compilation-unit name="var_int64_null">
+        <output-dir compare="AST">var_int64_null</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="aggregate">
+      <compilation-unit name="var_int8">
+        <output-dir compare="AST">var_int8</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="aggregate">
+      <compilation-unit name="var_int8_null">
+        <output-dir compare="AST">var_int8_null</output-dir>
+      </compilation-unit>
+    </test-case>
   </test-group>
   <test-group name="aggregate-sql">
     <test-case FilePath="aggregate-sql">
@@ -761,6 +940,30 @@
       </compilation-unit>
     </test-case>
     <test-case FilePath="aggregate-sql">
+      <compilation-unit name="serial_var_mixed">
+        <output-dir compare="AST">serial_var_mixed</output-dir>
+        <expected-error>org.apache.asterix.common.exceptions.AsterixException</expected-error>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="aggregate-sql">
+      <compilation-unit name="var_mixed">
+        <output-dir compare="AST">var_mixed</output-dir>
+        <expected-error>org.apache.asterix.common.exceptions.AsterixException</expected-error>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="aggregate-sql">
+      <compilation-unit name="serial_var_pop_mixed">
+        <output-dir compare="AST">serial_var_pop_mixed</output-dir>
+        <expected-error>org.apache.asterix.common.exceptions.AsterixException</expected-error>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="aggregate-sql">
+      <compilation-unit name="var_pop_mixed">
+        <output-dir compare="AST">var_pop_mixed</output-dir>
+        <expected-error>org.apache.asterix.common.exceptions.AsterixException</expected-error>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="aggregate-sql">
       <compilation-unit name="agg_number">
         <output-dir compare="AST">agg_number</output-dir>
       </compilation-unit>
@@ -991,33 +1194,33 @@
       </compilation-unit>
     </test-case>
     <test-case FilePath="aggregate-sql">
-      <compilation-unit name="scalar_stddev_pop">
-        <output-dir compare="AST">scalar_stddev_pop</output-dir>
+      <compilation-unit name="scalar_sum">
+        <output-dir compare="AST">scalar_sum</output-dir>
       </compilation-unit>
     </test-case>
     <test-case FilePath="aggregate-sql">
-      <compilation-unit name="scalar_stddev_pop_empty">
-        <output-dir compare="AST">scalar_stddev_pop_empty</output-dir>
+      <compilation-unit name="scalar_sum_empty">
+        <output-dir compare="AST">scalar_sum_empty</output-dir>
       </compilation-unit>
     </test-case>
     <test-case FilePath="aggregate-sql">
-      <compilation-unit name="scalar_stddev_pop_null">
-        <output-dir compare="AST">scalar_stddev_pop_null</output-dir>
+      <compilation-unit name="scalar_sum_null">
+        <output-dir compare="AST">scalar_sum_null</output-dir>
       </compilation-unit>
     </test-case>
     <test-case FilePath="aggregate-sql">
-      <compilation-unit name="scalar_sum">
-        <output-dir compare="AST">scalar_sum</output-dir>
+      <compilation-unit name="scalar_var">
+        <output-dir compare="AST">scalar_var</output-dir>
       </compilation-unit>
     </test-case>
     <test-case FilePath="aggregate-sql">
-      <compilation-unit name="scalar_sum_empty">
-        <output-dir compare="AST">scalar_sum_empty</output-dir>
+      <compilation-unit name="scalar_var_empty">
+        <output-dir compare="AST">scalar_var_empty</output-dir>
       </compilation-unit>
     </test-case>
     <test-case FilePath="aggregate-sql">
-      <compilation-unit name="scalar_sum_null">
-        <output-dir compare="AST">scalar_sum_null</output-dir>
+      <compilation-unit name="scalar_var_null">
+        <output-dir compare="AST">scalar_var_null</output-dir>
       </compilation-unit>
     </test-case>
     <test-case FilePath="aggregate-sql">
@@ -1086,71 +1289,6 @@
       </compilation-unit>
     </test-case>
     <test-case FilePath="aggregate-sql">
-      <compilation-unit name="serial_stddev_pop_double">
-        <output-dir compare="AST">serial_stddev_pop_double</output-dir>
-      </compilation-unit>
-    </test-case>
-    <test-case FilePath="aggregate-sql">
-      <compilation-unit name="serial_stddev_pop_double_null">
-        <output-dir compare="AST">serial_stddev_pop_double_null</output-dir>
-      </compilation-unit>
-    </test-case>
-    <test-case FilePath="aggregate-sql">
-      <compilation-unit name="serial_stddev_pop_empty">
-        <output-dir compare="AST">serial_stddev_pop_empty</output-dir>
-      </compilation-unit>
-    </test-case>
-    <test-case FilePath="aggregate-sql">
-      <compilation-unit name="serial_stddev_pop_float">
-        <output-dir compare="AST">serial_stddev_pop_float</output-dir>
-      </compilation-unit>
-    </test-case>
-    <test-case FilePath="aggregate-sql">
-      <compilation-unit name="serial_stddev_pop_float_null">
-        <output-dir compare="AST">serial_stddev_pop_float_null</output-dir>
-      </compilation-unit>
-    </test-case>
-    <test-case FilePath="aggregate-sql">
-      <compilation-unit name="serial_stddev_pop_int16">
-        <output-dir compare="AST">serial_stddev_pop_int16</output-dir>
-      </compilation-unit>
-    </test-case>
-    <test-case FilePath="aggregate-sql">
-      <compilation-unit name="serial_stddev_pop_int16_null">
-        <output-dir compare="AST">serial_stddev_pop_int16_null</output-dir>
-      </compilation-unit>
-    </test-case>
-    <test-case FilePath="aggregate-sql">
-      <compilation-unit name="serial_stddev_pop_int32">
-        <output-dir compare="AST">serial_stddev_pop_int32</output-dir>
-      </compilation-unit>
-    </test-case>
-    <test-case FilePath="aggregate-sql">
-      <compilation-unit name="serial_stddev_pop_int32_null">
-        <output-dir compare="AST">serial_stddev_pop_int32_null</output-dir>
-      </compilation-unit>
-    </test-case>
-    <test-case FilePath="aggregate-sql">
-      <compilation-unit name="serial_stddev_pop_int64">
-        <output-dir compare="AST">serial_stddev_pop_int64</output-dir>
-      </compilation-unit>
-    </test-case>
-    <test-case FilePath="aggregate-sql">
-      <compilation-unit name="serial_stddev_pop_int64_null">
-        <output-dir compare="AST">serial_stddev_pop_int64_null</output-dir>
-      </compilation-unit>
-    </test-case>
-    <test-case FilePath="aggregate-sql">
-      <compilation-unit name="serial_stddev_pop_int8">
-        <output-dir compare="AST">serial_stddev_pop_int8</output-dir>
-      </compilation-unit>
-    </test-case>
-    <test-case FilePath="aggregate-sql">
-      <compilation-unit name="serial_stddev_pop_int8_null">
-        <output-dir compare="AST">serial_stddev_pop_int8_null</output-dir>
-      </compilation-unit>
-    </test-case>
-    <test-case FilePath="aggregate-sql">
       <compilation-unit name="stddev_double">
         <output-dir compare="AST">stddev_double</output-dir>
       </compilation-unit>
@@ -1221,153 +1359,153 @@
       </compilation-unit>
     </test-case>
     <test-case FilePath="aggregate-sql">
-      <compilation-unit name="stddev_pop_double">
-        <output-dir compare="AST">stddev_pop_double</output-dir>
+      <compilation-unit name="sum_double">
+        <output-dir compare="AST">sum_double</output-dir>
       </compilation-unit>
     </test-case>
     <test-case FilePath="aggregate-sql">
-      <compilation-unit name="stddev_pop_double_null">
-        <output-dir compare="AST">stddev_pop_double_null</output-dir>
+      <compilation-unit name="sum_double_null">
+        <output-dir compare="AST">sum_double_null</output-dir>
       </compilation-unit>
     </test-case>
     <test-case FilePath="aggregate-sql">
-      <compilation-unit name="stddev_pop_empty_01">
-        <output-dir compare="AST">stddev_pop_empty_01</output-dir>
+      <compilation-unit name="sum_empty_01">
+        <output-dir compare="AST">sum_empty_01</output-dir>
       </compilation-unit>
     </test-case>
     <test-case FilePath="aggregate-sql">
-      <compilation-unit name="stddev_pop_empty_02">
-        <output-dir compare="AST">stddev_pop_empty_02</output-dir>
+      <compilation-unit name="sum_empty_02">
+        <output-dir compare="AST">sum_empty_02</output-dir>
       </compilation-unit>
     </test-case>
     <test-case FilePath="aggregate-sql">
-      <compilation-unit name="stddev_pop_float">
-        <output-dir compare="AST">stddev_pop_float</output-dir>
+      <compilation-unit name="sum_float">
+        <output-dir compare="AST">sum_float</output-dir>
       </compilation-unit>
     </test-case>
     <test-case FilePath="aggregate-sql">
-      <compilation-unit name="stddev_pop_float_null">
-        <output-dir compare="AST">stddev_pop_float_null</output-dir>
+      <compilation-unit name="sum_float_null">
+        <output-dir compare="AST">sum_float_null</output-dir>
       </compilation-unit>
     </test-case>
     <test-case FilePath="aggregate-sql">
-      <compilation-unit name="stddev_pop_int16">
-        <output-dir compare="AST">stddev_pop_int16</output-dir>
+      <compilation-unit name="sum_int16">
+        <output-dir compare="AST">sum_int16</output-dir>
       </compilation-unit>
     </test-case>
     <test-case FilePath="aggregate-sql">
-      <compilation-unit name="stddev_pop_int16_null">
-        <output-dir compare="AST">stddev_pop_int16_null</output-dir>
+      <compilation-unit name="sum_int16_null">
+        <output-dir compare="AST">sum_int16_null</output-dir>
       </compilation-unit>
     </test-case>
     <test-case FilePath="aggregate-sql">
-      <compilation-unit name="stddev_pop_int32">
-        <output-dir compare="AST">stddev_pop_int32</output-dir>
+      <compilation-unit name="sum_int32">
+        <output-dir compare="AST">sum_int32</output-dir>
       </compilation-unit>
     </test-case>
     <test-case FilePath="aggregate-sql">
-      <compilation-unit name="stddev_pop_int32_null">
-        <output-dir compare="AST">stddev_pop_int32_null</output-dir>
+      <compilation-unit name="sum_int32_null">
+        <output-dir compare="AST">sum_int32_null</output-dir>
       </compilation-unit>
     </test-case>
     <test-case FilePath="aggregate-sql">
-      <compilation-unit name="stddev_pop_int64">
-        <output-dir compare="AST">stddev_pop_int64</output-dir>
+      <compilation-unit name="sum_int64">
+        <output-dir compare="AST">sum_int64</output-dir>
       </compilation-unit>
     </test-case>
     <test-case FilePath="aggregate-sql">
-      <compilation-unit name="stddev_pop_int64_null">
-        <output-dir compare="AST">stddev_pop_int64_null</output-dir>
+      <compilation-unit name="sum_int64_null">
+        <output-dir compare="AST">sum_int64_null</output-dir>
       </compilation-unit>
     </test-case>
     <test-case FilePath="aggregate-sql">
-      <compilation-unit name="stddev_pop_int8">
-        <output-dir compare="AST">stddev_pop_int8</output-dir>
+      <compilation-unit name="sum_int8">
+        <output-dir compare="AST">sum_int8</output-dir>
       </compilation-unit>
     </test-case>
     <test-case FilePath="aggregate-sql">
-      <compilation-unit name="stddev_pop_int8_null">
-        <output-dir compare="AST">stddev_pop_int8_null</output-dir>
+      <compilation-unit name="sum_int8_null">
+        <output-dir compare="AST">sum_int8_null</output-dir>
       </compilation-unit>
     </test-case>
     <test-case FilePath="aggregate-sql">
-      <compilation-unit name="sum_double">
-        <output-dir compare="AST">sum_double</output-dir>
+      <compilation-unit name="sum_null-with-pred">
+        <output-dir compare="AST">sum_null-with-pred</output-dir>
       </compilation-unit>
     </test-case>
     <test-case FilePath="aggregate-sql">
-      <compilation-unit name="sum_double_null">
-        <output-dir compare="AST">sum_double_null</output-dir>
+      <compilation-unit name="sum_numeric_null">
+        <output-dir compare="AST">sum_numeric_null</output-dir>
       </compilation-unit>
     </test-case>
     <test-case FilePath="aggregate-sql">
-      <compilation-unit name="sum_empty_01">
-        <output-dir compare="AST">sum_empty_01</output-dir>
+      <compilation-unit name="var_double">
+        <output-dir compare="AST">var_double</output-dir>
       </compilation-unit>
     </test-case>
     <test-case FilePath="aggregate-sql">
-      <compilation-unit name="sum_empty_02">
-        <output-dir compare="AST">sum_empty_02</output-dir>
+      <compilation-unit name="var_double_null">
+        <output-dir compare="AST">var_double_null</output-dir>
       </compilation-unit>
     </test-case>
     <test-case FilePath="aggregate-sql">
-      <compilation-unit name="sum_float">
-        <output-dir compare="AST">sum_float</output-dir>
+      <compilation-unit name="var_empty_01">
+        <output-dir compare="AST">var_empty_01</output-dir>
       </compilation-unit>
     </test-case>
     <test-case FilePath="aggregate-sql">
-      <compilation-unit name="sum_float_null">
-        <output-dir compare="AST">sum_float_null</output-dir>
+      <compilation-unit name="var_empty_02">
+        <output-dir compare="AST">var_empty_02</output-dir>
       </compilation-unit>
     </test-case>
     <test-case FilePath="aggregate-sql">
-      <compilation-unit name="sum_int16">
-        <output-dir compare="AST">sum_int16</output-dir>
+      <compilation-unit name="var_float">
+        <output-dir compare="AST">var_float</output-dir>
       </compilation-unit>
     </test-case>
     <test-case FilePath="aggregate-sql">
-      <compilation-unit name="sum_int16_null">
-        <output-dir compare="AST">sum_int16_null</output-dir>
+      <compilation-unit name="var_float_null">
+        <output-dir compare="AST">var_float_null</output-dir>
       </compilation-unit>
     </test-case>
     <test-case FilePath="aggregate-sql">
-      <compilation-unit name="sum_int32">
-        <output-dir compare="AST">sum_int32</output-dir>
+      <compilation-unit name="var_int16">
+        <output-dir compare="AST">var_int16</output-dir>
       </compilation-unit>
     </test-case>
     <test-case FilePath="aggregate-sql">
-      <compilation-unit name="sum_int32_null">
-        <output-dir compare="AST">sum_int32_null</output-dir>
+      <compilation-unit name="var_int16_null">
+        <output-dir compare="AST">var_int16_null</output-dir>
       </compilation-unit>
     </test-case>
     <test-case FilePath="aggregate-sql">
-      <compilation-unit name="sum_int64">
-        <output-dir compare="AST">sum_int64</output-dir>
+      <compilation-unit name="var_int32">
+        <output-dir compare="AST">var_int32</output-dir>
       </compilation-unit>
     </test-case>
     <test-case FilePath="aggregate-sql">
-      <compilation-unit name="sum_int64_null">
-        <output-dir compare="AST">sum_int64_null</output-dir>
+      <compilation-unit name="var_int32_null">
+        <output-dir compare="AST">var_int32_null</output-dir>
       </compilation-unit>
     </test-case>
     <test-case FilePath="aggregate-sql">
-      <compilation-unit name="sum_int8">
-        <output-dir compare="AST">sum_int8</output-dir>
+      <compilation-unit name="var_int64">
+        <output-dir compare="AST">var_int64</output-dir>
       </compilation-unit>
     </test-case>
     <test-case FilePath="aggregate-sql">
-      <compilation-unit name="sum_int8_null">
-        <output-dir compare="AST">sum_int8_null</output-dir>
+      <compilation-unit name="var_int64_null">
+        <output-dir compare="AST">var_int64_null</output-dir>
       </compilation-unit>
     </test-case>
     <test-case FilePath="aggregate-sql">
-      <compilation-unit name="sum_null-with-pred">
-        <output-dir compare="AST">sum_null-with-pred</output-dir>
+      <compilation-unit name="var_int8">
+        <output-dir compare="AST">var_int8</output-dir>
       </compilation-unit>
     </test-case>
     <test-case FilePath="aggregate-sql">
-      <compilation-unit name="sum_numeric_null">
-        <output-dir compare="AST">sum_numeric_null</output-dir>
+      <compilation-unit name="var_int8_null">
+        <output-dir compare="AST">var_int8_null</output-dir>
       </compilation-unit>
     </test-case>
   </test-group>

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/2a42da45/asterixdb/asterix-doc/src/main/markdown/builtins/9_aggregate_sql.md
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-doc/src/main/markdown/builtins/9_aggregate_sql.md b/asterixdb/asterix-doc/src/main/markdown/builtins/9_aggregate_sql.md
index e9a5739..423edf1 100644
--- a/asterixdb/asterix-doc/src/main/markdown/builtins/9_aggregate_sql.md
+++ b/asterixdb/asterix-doc/src/main/markdown/builtins/9_aggregate_sql.md
@@ -174,14 +174,14 @@ SQL++ builtin aggregate functions (e.g., `ARRAY_MIN`, `ARRAY_MAX`,
 
         array_stddev(num_collection)
 
- * Gets the standard deviation value of the non-null and non-missing numeric items in the given collection.
+ * Gets the sample standard deviation value of the non-null and non-missing numeric items in the given collection.
  * Arguments:
     * `num_collection` could be:
         * an `array` or `multiset` containing numeric values, `null`s or `missing`s,
         * or, a `null` value,
         * or, a `missing` value.
  * Return Value:
-    * a `double` value representing the average of the non-null and non-missing numbers in the given collection,
+    * a `double` value representing the sample standard deviation of the non-null and non-missing numbers in the given collection,
     * `null` is returned if the input is `null` or `missing`,
     * `null` is returned if the given collection does not contain any non-null and non-missing items,
     * any other non-array and non-multiset input value will cause a type error,
@@ -201,14 +201,14 @@ SQL++ builtin aggregate functions (e.g., `ARRAY_MIN`, `ARRAY_MAX`,
 
         array_stddev_pop(num_collection)
 
- * Gets the standard deviation value of the non-null and non-missing numeric items in the given collection.
+ * Gets the population standard deviation value of the non-null and non-missing numeric items in the given collection.
  * Arguments:
     * `num_collection` could be:
         * an `array` or `multiset` containing numeric values, `null`s or `missing`s,
         * or, a `null` value,
         * or, a `missing` value.
  * Return Value:
-    * a `double` value representing the average of the non-null and non-missing numbers in the given collection,
+    * a `double` value representing the population standard deviation of the non-null and non-missing numbers in the given collection,
     * `null` is returned if the input is `null` or `missing`,
     * `null` is returned if the given collection does not contain any non-null and non-missing items,
     * any other non-array and non-multiset input value will cause a type error,
@@ -222,6 +222,61 @@ SQL++ builtin aggregate functions (e.g., `ARRAY_MIN`, `ARRAY_MAX`,
 
         1.2636751956100112
 
+### array_var ###
+
+ * Syntax:
+
+        array_var(num_collection)
+
+ * Gets the sample variance value of the non-null and non-missing numeric items in the given collection.
+ * Arguments:
+    * `num_collection` could be:
+        * an `array` or `multiset` containing numeric values, `null`s or `missing`s,
+        * or, a `null` value,
+        * or, a `missing` value.
+ * Return Value:
+    * a `double` value representing the sample variance of the non-null and non-missing numbers in the given collection,
+    * `null` is returned if the input is `null` or `missing`,
+    * `null` is returned if the given collection does not contain any non-null and non-missing items,
+    * any other non-array and non-multiset input value will cause a type error,
+    * any other non-numeric value in the input collection will cause a type error.
+
+ * Example:
+
+        array_var( [1.2, 2.3, 3.4, 0, null] );
+
+ * The expected result is:
+
+        2.1291666666666664
+
+### array_var_pop ###
+
+ * Syntax:
+
+        array_var_pop(num_collection)
+
+ * Gets the population variance value of the non-null and non-missing numeric items in the given collection.
+ * Arguments:
+    * `num_collection` could be:
+        * an `array` or `multiset` containing numeric values, `null`s or `missing`s,
+        * or, a `null` value,
+        * or, a `missing` value.
+ * Return Value:
+    * a `double` value representing the population variance of the non-null and non-missing numbers in the given collection,
+    * `null` is returned if the input is `null` or `missing`,
+    * `null` is returned if the given collection does not contain any non-null and non-missing items,
+    * any other non-array and non-multiset input value will cause a type error,
+    * any other non-numeric value in the input collection will cause a type error.
+
+ * Example:
+
+        array_var_pop( [1.2, 2.3, 3.4, 0, null] );
+
+ * The expected result is:
+
+        1.5968749999999998
+
+
 ### strict_count ###
  * Syntax:
 
@@ -359,14 +414,14 @@ SQL++ builtin aggregate functions (e.g., `ARRAY_MIN`, `ARRAY_MAX`,
 
         strict_stddev(num_collection)
 
- * Gets the standard deviation value of the numeric items in the given collection.
+ * Gets the sample standard deviation value of the numeric items in the given collection.
  * Arguments:
     * `num_collection` could be:
         * an `array` or `multiset` containing numeric values, `null`s or `missing`s,
         * or, a `null` value,
         * or, a `missing` value.
  * Return Value:
-    * a `double` value representing the average of the numbers in the given collection,
+    * a `double` value representing the sample standard deviation of the numbers in the given collection,
     * `null` is returned if the input is `null` or `missing`,
     * `null` is returned if there is a `null` or `missing` in the input collection,
     * any other non-numeric value in the input collection will cause a type error.
@@ -384,14 +439,14 @@ SQL++ builtin aggregate functions (e.g., `ARRAY_MIN`, `ARRAY_MAX`,
 
         strict_stddev_pop(num_collection)
 
- * Gets the standard deviation value of the numeric items in the given collection.
+ * Gets the population standard deviation value of the numeric items in the given collection.
  * Arguments:
     * `num_collection` could be:
         * an `array` or `multiset` containing numeric values, `null`s or `missing`s,
         * or, a `null` value,
         * or, a `missing` value.
  * Return Value:
-    * a `double` value representing the average of the numbers in the given collection,
+    * a `double` value representing the population standard deviation of the numbers in the given collection,
     * `null` is returned if the input is `null` or `missing`,
     * `null` is returned if there is a `null` or `missing` in the input collection,
     * any other non-numeric value in the input collection will cause a type error.
@@ -403,3 +458,53 @@ SQL++ builtin aggregate functions (e.g., `ARRAY_MIN`, `ARRAY_MAX`,
  * The expected result is:
 
         81.64965809277261
+
+### strict_var ###
+ * Syntax:
+
+        strict_var(num_collection)
+
+ * Gets the sample variance value of the numeric items in the given collection.
+ * Arguments:
+    * `num_collection` could be:
+        * an `array` or `multiset` containing numeric values, `null`s or `missing`s,
+        * or, a `null` value,
+        * or, a `missing` value.
+ * Return Value:
+    * a `double` value representing the sample variance of the numbers in the given collection,
+    * `null` is returned if the input is `null` or `missing`,
+    * `null` is returned if there is a `null` or `missing` in the input collection,
+    * any other non-numeric value in the input collection will cause a type error.
+
+ * Example:
+
+        strict_var( [100, 200, 300] );
+
+ * The expected result is:
+
+        10000.0
+
+### strict_var_pop ###
+ * Syntax:
+
+        strict_var_pop(num_collection)
+
+ * Gets the population variance value of the numeric items in the given collection.
+ * Arguments:
+    * `num_collection` could be:
+        * an `array` or `multiset` containing numeric values, `null`s or `missing`s,
+        * or, a `null` value,
+        * or, a `missing` value.
+ * Return Value:
+    * a `double` value representing the population variance of the numbers in the given collection,
+    * `null` is returned if the input is `null` or `missing`,
+    * `null` is returned if there is a `null` or `missing` in the input collection,
+    * any other non-numeric value in the input collection will cause a type error.
+
+ * Example:
+
+        strict_var_pop( [100, 200, 300] );
+
+ * The expected result is:
+
+        6666.666666666667