http://git-wip-us.apache.org/repos/asf/asterixdb/blob/2a42da45/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/var_int16/var_int16.3.query.sqlpp
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/var_int16/var_int16.3.query.sqlpp
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/var_int16/var_int16.3.query.sqlpp
new file mode 100644
index 0000000..75950f0
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/var_int16/var_int16.3.query.sqlpp
@@ -0,0 +1,29 @@
+/*
+ * 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.
+ */
+
+use test;
+
+
+{'var': (select element test.array_var((
+    select element x
+    from  [test.smallint('1'),test.smallint('2'),test.smallint('3')] as x
+))), 'var_pop': (select element test.array_var_pop((
+    select element x
+    from  [test.smallint('1'),test.smallint('2'),test.smallint('3')] as x
+)))};

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/2a42da45/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/var_int16_null/var_int16_null.1.ddl.sqlpp
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/var_int16_null/var_int16_null.1.ddl.sqlpp
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/var_int16_null/var_int16_null.1.ddl.sqlpp
new file mode 100644
index 0000000..6788afc
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/var_int16_null/var_int16_null.1.ddl.sqlpp
@@ -0,0 +1,38 @@
+/*
+ * 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.
+ */
+
+drop  dataverse test if exists;
+create  dataverse test;
+
+use test;
+
+
+create type test.NumericType as
+{
+  id : bigint,
+  int8Field : tinyint?,
+  int16Field : smallint?,
+  int32Field : integer?,
+  int64Field : bigint?,
+  floatField : float?,
+  doubleField : double?
+};
+
+create external  dataset Numeric(NumericType) using 
localfs((`path`=`asterix_nc1://data/nontagged/numericData.json`),(`format`=`adm`));
+

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/2a42da45/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/var_int16_null/var_int16_null.3.query.sqlpp
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/var_int16_null/var_int16_null.3.query.sqlpp
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/var_int16_null/var_int16_null.3.query.sqlpp
new file mode 100644
index 0000000..d7a9716
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/var_int16_null/var_int16_null.3.query.sqlpp
@@ -0,0 +1,29 @@
+/*
+ * 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.
+ */
+
+use test;
+
+
+{'var':test.array_var((
+    select element x.int16Field
+    from  Numeric as x
+)), 'var_pop':test.array_var_pop((
+    select element x.int16Field
+    from  Numeric as x
+))};

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/2a42da45/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/var_int32/var_int32.1.ddl.sqlpp
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/var_int32/var_int32.1.ddl.sqlpp
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/var_int32/var_int32.1.ddl.sqlpp
new file mode 100644
index 0000000..21479a2
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/var_int32/var_int32.1.ddl.sqlpp
@@ -0,0 +1,22 @@
+/*
+ * 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.
+ */
+
+drop  dataverse test if exists;
+create  dataverse test;
+

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/2a42da45/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/var_int32/var_int32.3.query.sqlpp
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/var_int32/var_int32.3.query.sqlpp
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/var_int32/var_int32.3.query.sqlpp
new file mode 100644
index 0000000..c9f71a5
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/var_int32/var_int32.3.query.sqlpp
@@ -0,0 +1,29 @@
+/*
+ * 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.
+ */
+
+use test;
+
+
+{'var': (select element test.array_var((
+    select element x
+    from  [test.integer('1'),test.integer('2'),test.integer('3')] as x
+))), 'var_pop': (select element test.array_var_pop((
+    select element x
+    from  [test.integer('1'),test.integer('2'),test.integer('3')] as x
+)))};

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/2a42da45/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/var_int32_null/var_int32_null.1.ddl.sqlpp
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/var_int32_null/var_int32_null.1.ddl.sqlpp
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/var_int32_null/var_int32_null.1.ddl.sqlpp
new file mode 100644
index 0000000..6788afc
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/var_int32_null/var_int32_null.1.ddl.sqlpp
@@ -0,0 +1,38 @@
+/*
+ * 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.
+ */
+
+drop  dataverse test if exists;
+create  dataverse test;
+
+use test;
+
+
+create type test.NumericType as
+{
+  id : bigint,
+  int8Field : tinyint?,
+  int16Field : smallint?,
+  int32Field : integer?,
+  int64Field : bigint?,
+  floatField : float?,
+  doubleField : double?
+};
+
+create external  dataset Numeric(NumericType) using 
localfs((`path`=`asterix_nc1://data/nontagged/numericData.json`),(`format`=`adm`));
+

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/2a42da45/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/var_int32_null/var_int32_null.3.query.sqlpp
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/var_int32_null/var_int32_null.3.query.sqlpp
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/var_int32_null/var_int32_null.3.query.sqlpp
new file mode 100644
index 0000000..427e4a2
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/var_int32_null/var_int32_null.3.query.sqlpp
@@ -0,0 +1,29 @@
+/*
+ * 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.
+ */
+
+use test;
+
+
+{'var':test.array_var((
+    select element x.int32Field
+    from  Numeric as x
+)), 'var_pop':test.array_var_pop((
+    select element x.int32Field
+    from  Numeric as x
+))};

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/2a42da45/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/var_int64/var_int64.1.ddl.sqlpp
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/var_int64/var_int64.1.ddl.sqlpp
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/var_int64/var_int64.1.ddl.sqlpp
new file mode 100644
index 0000000..21479a2
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/var_int64/var_int64.1.ddl.sqlpp
@@ -0,0 +1,22 @@
+/*
+ * 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.
+ */
+
+drop  dataverse test if exists;
+create  dataverse test;
+

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/2a42da45/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/var_int64/var_int64.3.query.sqlpp
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/var_int64/var_int64.3.query.sqlpp
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/var_int64/var_int64.3.query.sqlpp
new file mode 100644
index 0000000..487070d
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/var_int64/var_int64.3.query.sqlpp
@@ -0,0 +1,29 @@
+/*
+ * 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.
+ */
+
+use test;
+
+
+{'var': (select element test.array_var((
+    select element x
+    from  [test.bigint('1'),test.bigint('2'),test.bigint('3')] as x
+))), 'var_pop': (select element test.array_var_pop((
+    select element x
+    from  [test.bigint('1'),test.bigint('2'),test.bigint('3')] as x
+)))};

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/2a42da45/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/var_int64_null/var_int64_null.1.ddl.sqlpp
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/var_int64_null/var_int64_null.1.ddl.sqlpp
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/var_int64_null/var_int64_null.1.ddl.sqlpp
new file mode 100644
index 0000000..6788afc
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/var_int64_null/var_int64_null.1.ddl.sqlpp
@@ -0,0 +1,38 @@
+/*
+ * 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.
+ */
+
+drop  dataverse test if exists;
+create  dataverse test;
+
+use test;
+
+
+create type test.NumericType as
+{
+  id : bigint,
+  int8Field : tinyint?,
+  int16Field : smallint?,
+  int32Field : integer?,
+  int64Field : bigint?,
+  floatField : float?,
+  doubleField : double?
+};
+
+create external  dataset Numeric(NumericType) using 
localfs((`path`=`asterix_nc1://data/nontagged/numericData.json`),(`format`=`adm`));
+

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/2a42da45/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/var_int64_null/var_int64_null.3.query.sqlpp
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/var_int64_null/var_int64_null.3.query.sqlpp
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/var_int64_null/var_int64_null.3.query.sqlpp
new file mode 100644
index 0000000..012c8b3
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/var_int64_null/var_int64_null.3.query.sqlpp
@@ -0,0 +1,29 @@
+/*
+ * 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.
+ */
+
+use test;
+
+
+{'var':test.array_var((
+    select element x.int64Field
+    from  Numeric as x
+)), 'var_pop':test.array_var_pop((
+    select element x.int64Field
+    from  Numeric as x
+))};

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/2a42da45/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/var_int8/var_int8.1.ddl.sqlpp
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/var_int8/var_int8.1.ddl.sqlpp
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/var_int8/var_int8.1.ddl.sqlpp
new file mode 100644
index 0000000..21479a2
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/var_int8/var_int8.1.ddl.sqlpp
@@ -0,0 +1,22 @@
+/*
+ * 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.
+ */
+
+drop  dataverse test if exists;
+create  dataverse test;
+

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/2a42da45/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/var_int8/var_int8.3.query.sqlpp
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/var_int8/var_int8.3.query.sqlpp
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/var_int8/var_int8.3.query.sqlpp
new file mode 100644
index 0000000..6bafd02
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/var_int8/var_int8.3.query.sqlpp
@@ -0,0 +1,29 @@
+/*
+ * 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.
+ */
+
+use test;
+
+
+{'var': (select element test.array_var((
+    select element x
+    from  [test.tinyint('1'),test.tinyint('2'),test.tinyint('3')] as x
+))), 'var_pop': (select element test.array_var_pop((
+    select element x
+    from  [test.tinyint('1'),test.tinyint('2'),test.tinyint('3')] as x
+)))};

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/2a42da45/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/var_int8_null/var_int8_null.1.ddl.sqlpp
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/var_int8_null/var_int8_null.1.ddl.sqlpp
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/var_int8_null/var_int8_null.1.ddl.sqlpp
new file mode 100644
index 0000000..6788afc
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/var_int8_null/var_int8_null.1.ddl.sqlpp
@@ -0,0 +1,38 @@
+/*
+ * 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.
+ */
+
+drop  dataverse test if exists;
+create  dataverse test;
+
+use test;
+
+
+create type test.NumericType as
+{
+  id : bigint,
+  int8Field : tinyint?,
+  int16Field : smallint?,
+  int32Field : integer?,
+  int64Field : bigint?,
+  floatField : float?,
+  doubleField : double?
+};
+
+create external  dataset Numeric(NumericType) using 
localfs((`path`=`asterix_nc1://data/nontagged/numericData.json`),(`format`=`adm`));
+

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/2a42da45/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/var_int8_null/var_int8_null.3.query.sqlpp
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/var_int8_null/var_int8_null.3.query.sqlpp
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/var_int8_null/var_int8_null.3.query.sqlpp
new file mode 100644
index 0000000..d36ab7a
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/var_int8_null/var_int8_null.3.query.sqlpp
@@ -0,0 +1,29 @@
+/*
+ * 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.
+ */
+
+use test;
+
+
+{'var':test.array_var((
+    select element x.int8Field
+    from  Numeric as x
+)), 'var_pop':test.array_var_pop((
+    select element x.int8Field
+    from  Numeric as x
+))};

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/2a42da45/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/var_mixed/var_mixed.3.query.sqlpp
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/var_mixed/var_mixed.3.query.sqlpp
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/var_mixed/var_mixed.3.query.sqlpp
new file mode 100644
index 0000000..3063caa
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/var_mixed/var_mixed.3.query.sqlpp
@@ -0,0 +1,28 @@
+/*
+ * 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.
+ */
+/*
+* Description  : Run array_var over an multiset with mixed types
+* Expected Res : Failure
+* Date         : March 5th 2018
+*/
+
+select element array_var((
+    select element x
+    from  [float('2.0'),'hello world',93847382783847382,date('2013-01-01')] as 
x
+));

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/2a42da45/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/var_pop_mixed/var_pop_mixed.3.query.sqlpp
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/var_pop_mixed/var_pop_mixed.3.query.sqlpp
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/var_pop_mixed/var_pop_mixed.3.query.sqlpp
new file mode 100644
index 0000000..e385855
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/var_pop_mixed/var_pop_mixed.3.query.sqlpp
@@ -0,0 +1,28 @@
+/*
+ * 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.
+ */
+/*
+* Description  : Run array_var_pop over an multiset with mixed types
+* Expected Res : Failure
+* Date         : Feb 7th 2014
+*/
+
+select element array_var_pop((
+    select element x
+    from  [float('2.0'),'hello world',93847382783847382,date('2013-01-01')] as 
x
+));

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/2a42da45/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/agg_null/agg_null.3.query.sqlpp
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/agg_null/agg_null.3.query.sqlpp
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/agg_null/agg_null.3.query.sqlpp
index f1eb9dd..b865561 100644
--- 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/agg_null/agg_null.3.query.sqlpp
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/agg_null/agg_null.3.query.sqlpp
@@ -22,4 +22,4 @@
 * Date         : Jun 2nd 2013
 */
 
-{'count1':strict_count([null]),'average1':strict_avg([null]),'sum1':strict_sum([null]),'min1':strict_min([null]),'max1':strict_max([null]),'stddev1':strict_stddev([null]),'stddev_pop1':strict_stddev_pop([null]),'count2':strict_count({{null,null}}),'average2':strict_avg({{null,null}}),'sum2':strict_sum({{null,null}}),'min2':strict_min({{null,null}}),'max2':strict_max({{null,null}}),'stddev2':strict_stddev({{null,null}}),'stddev_pop2':strict_stddev_pop({{null,null}})};
+{'count1':strict_count([null]),'average1':strict_avg([null]),'sum1':strict_sum([null]),'min1':strict_min([null]),'max1':strict_max([null]),'stddev1':strict_stddev([null]),'stddev_pop1':strict_stddev_pop([null]),'var1':strict_var([null]),'var_pop1':strict_var_pop([null]),'count2':strict_count({{null,null}}),'average2':strict_avg({{null,null}}),'sum2':strict_sum({{null,null}}),'min2':strict_min({{null,null}}),'max2':strict_max({{null,null}}),'stddev2':strict_stddev({{null,null}}),'stddev_pop2':strict_stddev_pop({{null,null}}),'var2':strict_var({{null,null}}),'var_pop2':strict_var_pop({{null,null}})};

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/2a42da45/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/agg_null_rec/agg_null_rec.3.query.sqlpp
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/agg_null_rec/agg_null_rec.3.query.sqlpp
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/agg_null_rec/agg_null_rec.3.query.sqlpp
index 6796570..03c7668 100644
--- 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/agg_null_rec/agg_null_rec.3.query.sqlpp
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/agg_null_rec/agg_null_rec.3.query.sqlpp
@@ -46,4 +46,10 @@ use test;
 )), 'stddev_pop':test.strict_stddev_pop((
     select element t.valplus
     from  Test as t
+)), 'var':test.strict_var((
+    select element t.valplus
+    from  Test as t
+)), 'var_pop':test.strict_var_pop((
+    select element t.valplus
+    from  Test as t
 ))};

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/2a42da45/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/agg_null_rec_1/agg_null_rec_1.3.query.sqlpp
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/agg_null_rec_1/agg_null_rec_1.3.query.sqlpp
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/agg_null_rec_1/agg_null_rec_1.3.query.sqlpp
index e58aefb..2d97c79 100644
--- 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/agg_null_rec_1/agg_null_rec_1.3.query.sqlpp
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/agg_null_rec_1/agg_null_rec_1.3.query.sqlpp
@@ -64,4 +64,16 @@ use test;
         select element t
         from  Test as t
     ) as i
+)),'var':test.strict_var((
+    select element i.val
+    from  (
+        select element t
+        from  Test as t
+    ) as i
+)),'var_pop':test.strict_var_pop((
+    select element i.val
+    from  (
+        select element t
+        from  Test as t
+    ) as i
 ))};

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/2a42da45/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/agg_number/agg_number.3.query.sqlpp
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/agg_number/agg_number.3.query.sqlpp
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/agg_number/agg_number.3.query.sqlpp
index 680f5c9..e0d4dca 100644
--- 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/agg_number/agg_number.3.query.sqlpp
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/agg_number/agg_number.3.query.sqlpp
@@ -22,4 +22,4 @@
 * Date         : Jun 2nd 2013
 */
 
-{'count1':strict_count([float('2.0'),double('3.0'),93847382783847382,1]),'average1':strict_avg([float('2.0'),double('3.0'),93847382783847382,1]),'sum1':strict_sum([float('2.0'),double('3.0'),93847382783847382,1]),'min1':strict_min([float('2.0'),double('3.0'),93847382783847382,1]),'max1':strict_max([float('2.0'),double('3.0'),93847382783847382,1]),'stddev1':strict_stddev([float('2.0'),double('3.0'),93847382783847382,1]),'stddev_pop1':strict_stddev_pop([float('2.0'),double('3.0'),93847382783847382,1]),'count2':strict_count({{float('2.0'),double('3.0'),93847382783847382,1}}),'average2':strict_avg({{float('2.0'),double('3.0'),93847382783847382,1}}),'sum2':strict_sum({{float('2.0'),double('3.0'),93847382783847382,1}}),'min2':strict_min({{float('2.0'),double('3.0'),93847382783847382,1}}),'max2':strict_max({{float('2.0'),double('3.0'),93847382783847382,1}}),'stddev2':strict_stddev([float('2.0'),double('3.0'),93847382783847382,1]),'stddev_pop2':strict_stddev_pop([float('2.0'),double('3.0'),
 93847382783847382,1])};
\ No newline at end of file
+{'count1':strict_count([float('2.0'),double('3.0'),93847382783847382,1]),'average1':strict_avg([float('2.0'),double('3.0'),93847382783847382,1]),'sum1':strict_sum([float('2.0'),double('3.0'),93847382783847382,1]),'min1':strict_min([float('2.0'),double('3.0'),93847382783847382,1]),'max1':strict_max([float('2.0'),double('3.0'),93847382783847382,1]),'stddev1':strict_stddev([float('2.0'),double('3.0'),93847382783847382,1]),'stddev_pop1':strict_stddev_pop([float('2.0'),double('3.0'),93847382783847382,1]),'var1':strict_var([float('2.0'),double('3.0'),93847382783847382,1]),'var_pop1':strict_var_pop([float('2.0'),double('3.0'),93847382783847382,1]),'count2':strict_count({{float('2.0'),double('3.0'),93847382783847382,1}}),'average2':strict_avg({{float('2.0'),double('3.0'),93847382783847382,1}}),'sum2':strict_sum({{float('2.0'),double('3.0'),93847382783847382,1}}),'min2':strict_min({{float('2.0'),double('3.0'),93847382783847382,1}}),'max2':strict_max({{float('2.0'),double('3.0'),9384738278384
 
7382,1}}),'stddev2':strict_stddev([float('2.0'),double('3.0'),93847382783847382,1]),'stddev_pop2':strict_stddev_pop([float('2.0'),double('3.0'),93847382783847382,1]),'var2':strict_var([float('2.0'),double('3.0'),93847382783847382,1]),'var_pop2':strict_var_pop([float('2.0'),double('3.0'),93847382783847382,1])};
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/2a42da45/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/agg_number_rec/agg_number_rec.3.query.sqlpp
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/agg_number_rec/agg_number_rec.3.query.sqlpp
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/agg_number_rec/agg_number_rec.3.query.sqlpp
index 1144a95..e2937d3 100644
--- 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/agg_number_rec/agg_number_rec.3.query.sqlpp
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/agg_number_rec/agg_number_rec.3.query.sqlpp
@@ -46,4 +46,10 @@ use test;
 )),'stddev_pop':test.strict_stddev_pop((
     select element t.valplus
     from  Test as t
+)),'var':test.strict_var((
+    select element t.valplus
+    from  Test as t
+)),'var_pop':test.strict_var_pop((
+    select element t.valplus
+    from  Test as t
 ))};

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/2a42da45/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_mixed/avg_mixed.3.query.sqlpp
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_mixed/avg_mixed.3.query.sqlpp
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_mixed/avg_mixed.3.query.sqlpp
index 0085e3f..d07bdc8 100644
--- 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_mixed/avg_mixed.3.query.sqlpp
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_mixed/avg_mixed.3.query.sqlpp
@@ -17,7 +17,7 @@
  * under the License.
  */
 /*
-* Description  : Run avg over an ordered list with mixed types
+* Description  : Run avg over an multiset with mixed types
 * Expected Res : Failure
 * Date         : Jun 2nd 2013
 */

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/2a42da45/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/scalar_var/scalar_var.1.ddl.sqlpp
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/scalar_var/scalar_var.1.ddl.sqlpp
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/scalar_var/scalar_var.1.ddl.sqlpp
new file mode 100644
index 0000000..3a3a45c
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/scalar_var/scalar_var.1.ddl.sqlpp
@@ -0,0 +1,26 @@
+/*
+ * 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.
+ */
+/*
+ * Description    : Tests the scalar version of var and var_pop without nulls.
+ * Success        : Yes
+ */
+
+drop  dataverse test if exists;
+create  dataverse test;
+

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/2a42da45/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/scalar_var/scalar_var.3.query.sqlpp
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/scalar_var/scalar_var.3.query.sqlpp
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/scalar_var/scalar_var.3.query.sqlpp
new file mode 100644
index 0000000..669e686
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/scalar_var/scalar_var.3.query.sqlpp
@@ -0,0 +1,42 @@
+/*
+ * 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.
+ */
+/*
+ * Description    : Tests the scalar version of var and var_pop without nulls.
+ * Success        : Yes
+ */
+
+use test;
+
+{'var': (with  i8 as 
test.strict_var([test.tinyint('1'),test.tinyint('2'),test.tinyint('3')]),
+      i16 as 
test.strict_var([test.smallint('1'),test.smallint('2'),test.smallint('3')]),
+      i32 as 
test.strict_var([test.integer('1'),test.integer('2'),test.integer('3')]),
+      i64 as 
test.strict_var([test.bigint('1'),test.bigint('2'),test.bigint('3')]),
+      f as test.strict_var([test.float('1'),test.float('2'),test.float('3')]),
+      d as 
test.strict_var([test.double('1'),test.double('2'),test.double('3')])
+select element i
+from  [i8,i16,i32,i64,f,d] as i),
+'var_pop': (with  i8 as 
test.strict_var_pop([test.tinyint('1'),test.tinyint('2'),test.tinyint('3')]),
+      i16 as 
test.strict_var_pop([test.smallint('1'),test.smallint('2'),test.smallint('3')]),
+      i32 as 
test.strict_var_pop([test.integer('1'),test.integer('2'),test.integer('3')]),
+      i64 as 
test.strict_var_pop([test.bigint('1'),test.bigint('2'),test.bigint('3')]),
+      f as 
test.strict_var_pop([test.float('1'),test.float('2'),test.float('3')]),
+      d as 
test.strict_var_pop([test.double('1'),test.double('2'),test.double('3')])
+select element i
+from  [i8,i16,i32,i64,f,d] as i)
+};

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/2a42da45/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/scalar_var_empty/scalar_var_empty.1.ddl.sqlpp
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/scalar_var_empty/scalar_var_empty.1.ddl.sqlpp
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/scalar_var_empty/scalar_var_empty.1.ddl.sqlpp
new file mode 100644
index 0000000..aceb0a1
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/scalar_var_empty/scalar_var_empty.1.ddl.sqlpp
@@ -0,0 +1,26 @@
+/*
+ * 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.
+ */
+/*
+ * Description    : Tests the scalar version of var and var_pop with an empty 
list.
+ * Success        : Yes
+ */
+
+drop  dataverse test if exists;
+create  dataverse test;
+

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/2a42da45/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/scalar_var_empty/scalar_var_empty.3.query.sqlpp
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/scalar_var_empty/scalar_var_empty.3.query.sqlpp
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/scalar_var_empty/scalar_var_empty.3.query.sqlpp
new file mode 100644
index 0000000..35c2a77
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/scalar_var_empty/scalar_var_empty.3.query.sqlpp
@@ -0,0 +1,25 @@
+/*
+ * 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.
+ */
+/*
+ * Description    : Tests the scalar version of var and var_pop with an empty 
list.
+ * Success        : Yes
+ */
+
+{'var': (select element strict_var([])),
+'var_pop': (select element strict_var_pop([]))};

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/2a42da45/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/scalar_var_null/scalar_var_null.1.ddl.sqlpp
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/scalar_var_null/scalar_var_null.1.ddl.sqlpp
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/scalar_var_null/scalar_var_null.1.ddl.sqlpp
new file mode 100644
index 0000000..4e53c2f
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/scalar_var_null/scalar_var_null.1.ddl.sqlpp
@@ -0,0 +1,26 @@
+/*
+ * 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.
+ */
+/*
+ * Description    : Tests the scalar version of var and var_pop with nulls.
+ * Success        : Yes
+ */
+
+drop  dataverse test if exists;
+create  dataverse test;
+

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/2a42da45/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/scalar_var_null/scalar_var_null.3.query.sqlpp
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/scalar_var_null/scalar_var_null.3.query.sqlpp
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/scalar_var_null/scalar_var_null.3.query.sqlpp
new file mode 100644
index 0000000..1c74d53
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/scalar_var_null/scalar_var_null.3.query.sqlpp
@@ -0,0 +1,42 @@
+/*
+ * 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.
+ */
+/*
+ * Description    : Tests the scalar version of var and var_pop with nulls.
+ * Success        : Yes
+ */
+
+use test;
+
+{'var': (with  i8 as 
test.strict_var([test.tinyint('1'),test.tinyint('2'),test.tinyint('3'),null]),
+      i16 as 
test.strict_var([test.smallint('1'),test.smallint('2'),test.smallint('3'),null]),
+      i32 as 
test.strict_var([test.integer('1'),test.integer('2'),test.integer('3'),null]),
+      i64 as 
test.strict_var([test.bigint('1'),test.bigint('2'),test.bigint('3'),null]),
+      f as 
test.strict_var([test.float('1'),test.float('2'),test.float('3'),null]),
+      d as 
test.strict_var([test.double('1'),test.double('2'),test.double('3'),null])
+select element i
+from  [i8,i16,i32,i64,f,d] as i),
+'var_pop': (with  i8 as 
test.strict_var_pop([test.tinyint('1'),test.tinyint('2'),test.tinyint('3'),null]),
+      i16 as 
test.strict_var_pop([test.smallint('1'),test.smallint('2'),test.smallint('3'),null]),
+      i32 as 
test.strict_var_pop([test.integer('1'),test.integer('2'),test.integer('3'),null]),
+      i64 as 
test.strict_var_pop([test.bigint('1'),test.bigint('2'),test.bigint('3'),null]),
+      f as 
test.strict_var_pop([test.float('1'),test.float('2'),test.float('3'),null]),
+      d as 
test.strict_var_pop([test.double('1'),test.double('2'),test.double('3'),null])
+select element i
+from  [i8,i16,i32,i64,f,d] as i)
+};

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/2a42da45/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/serial_stddev_mixed/serial_stddev_mixed.3.query.sqlpp
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/serial_stddev_mixed/serial_stddev_mixed.3.query.sqlpp
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/serial_stddev_mixed/serial_stddev_mixed.3.query.sqlpp
index db27904..d7889c2 100644
--- 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/serial_stddev_mixed/serial_stddev_mixed.3.query.sqlpp
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/serial_stddev_mixed/serial_stddev_mixed.3.query.sqlpp
@@ -17,7 +17,7 @@
  * under the License.
  */
  /*
- * Description  : Run serial-stddev over an ordered list with mixed types
+ * Description  : Run serial-stddev over an multiset with mixed types
  * Expected Res : Failure
  * Date         : March 5th 2018
  */

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/2a42da45/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/serial_stddev_pop_mixed/serial_stddev_pop_mixed.3.query.sqlpp
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/serial_stddev_pop_mixed/serial_stddev_pop_mixed.3.query.sqlpp
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/serial_stddev_pop_mixed/serial_stddev_pop_mixed.3.query.sqlpp
index 329fc59..51bdc07 100644
--- 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/serial_stddev_pop_mixed/serial_stddev_pop_mixed.3.query.sqlpp
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/serial_stddev_pop_mixed/serial_stddev_pop_mixed.3.query.sqlpp
@@ -17,7 +17,7 @@
  * under the License.
  */
  /*
- * Description  : Run serial-stddev_pop over an ordered list with mixed types
+ * Description  : Run serial-stddev_pop over an multiset with mixed types
  * Expected Res : Failure
  * Date         : March 5th 2018
  */

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/2a42da45/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/serial_var_double/serial_var_double.1.ddl.sqlpp
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/serial_var_double/serial_var_double.1.ddl.sqlpp
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/serial_var_double/serial_var_double.1.ddl.sqlpp
new file mode 100644
index 0000000..da0bd7b
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/serial_var_double/serial_var_double.1.ddl.sqlpp
@@ -0,0 +1,33 @@
+/*
+ * 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.
+ */
+
+drop  dataverse test if exists;
+create  dataverse test;
+
+use test;
+
+
+create type test.TestType as
+{
+  id : bigint,
+  gid : bigint,
+  val : double
+};
+
+create  dataset Test(TestType) primary key id;

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/2a42da45/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/serial_var_double/serial_var_double.2.update.sqlpp
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/serial_var_double/serial_var_double.2.update.sqlpp
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/serial_var_double/serial_var_double.2.update.sqlpp
new file mode 100644
index 0000000..88d820c
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/serial_var_double/serial_var_double.2.update.sqlpp
@@ -0,0 +1,31 @@
+/*
+ * 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.
+ */
+
+use test;
+
+insert into Test
+select element {'id':0,'gid':1,'val':double(4.32),'valplus':double(473847.0)};
+insert into Test
+select element {'id':1,'gid':1,'val':double(5.32)};
+insert into Test
+select element 
{'id':2,'gid':1,'val':double(6.32),'valplus':double(38473827484738239.0)};
+insert into Test
+select element {'id':3,'gid':1,'val':double(4.32),'valplus':double(678900.0)};
+insert into Test
+select element {'id':4,'gid':1,'val':double(4.32),'valplus':null};

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/2a42da45/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/serial_var_double/serial_var_double.3.query.sqlpp
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/serial_var_double/serial_var_double.3.query.sqlpp
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/serial_var_double/serial_var_double.3.query.sqlpp
new file mode 100644
index 0000000..23e33cc
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/serial_var_double/serial_var_double.3.query.sqlpp
@@ -0,0 +1,26 @@
+/*
+ * 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.
+ */
+
+use test;
+
+select gid, strict_var((select value g.val from g)) as var,
+   strict_var_pop((select value g.val from g)) as var_pop
+from Test as t
+/* +hash */
+group by t.gid as gid group as g(val as val);

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/2a42da45/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/serial_var_double_null/serial_var_double_null.1.ddl.sqlpp
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/serial_var_double_null/serial_var_double_null.1.ddl.sqlpp
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/serial_var_double_null/serial_var_double_null.1.ddl.sqlpp
new file mode 100644
index 0000000..da0bd7b
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/serial_var_double_null/serial_var_double_null.1.ddl.sqlpp
@@ -0,0 +1,33 @@
+/*
+ * 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.
+ */
+
+drop  dataverse test if exists;
+create  dataverse test;
+
+use test;
+
+
+create type test.TestType as
+{
+  id : bigint,
+  gid : bigint,
+  val : double
+};
+
+create  dataset Test(TestType) primary key id;

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/2a42da45/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/serial_var_double_null/serial_var_double_null.2.update.sqlpp
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/serial_var_double_null/serial_var_double_null.2.update.sqlpp
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/serial_var_double_null/serial_var_double_null.2.update.sqlpp
new file mode 100644
index 0000000..88d820c
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/serial_var_double_null/serial_var_double_null.2.update.sqlpp
@@ -0,0 +1,31 @@
+/*
+ * 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.
+ */
+
+use test;
+
+insert into Test
+select element {'id':0,'gid':1,'val':double(4.32),'valplus':double(473847.0)};
+insert into Test
+select element {'id':1,'gid':1,'val':double(5.32)};
+insert into Test
+select element 
{'id':2,'gid':1,'val':double(6.32),'valplus':double(38473827484738239.0)};
+insert into Test
+select element {'id':3,'gid':1,'val':double(4.32),'valplus':double(678900.0)};
+insert into Test
+select element {'id':4,'gid':1,'val':double(4.32),'valplus':null};

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/2a42da45/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/serial_var_double_null/serial_var_double_null.3.query.sqlpp
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/serial_var_double_null/serial_var_double_null.3.query.sqlpp
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/serial_var_double_null/serial_var_double_null.3.query.sqlpp
new file mode 100644
index 0000000..7116737
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/serial_var_double_null/serial_var_double_null.3.query.sqlpp
@@ -0,0 +1,26 @@
+/*
+ * 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.
+ */
+
+use test;
+
+select gid, strict_var((select value g.valplus from g)) as var,
+   strict_var_pop((select value g.valplus from g)) as var_pop
+from Test as t
+/* +hash */
+group by t.gid as gid group as g(valplus as valplus);

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/2a42da45/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/serial_var_empty/serial_var_empty.1.ddl.sqlpp
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/serial_var_empty/serial_var_empty.1.ddl.sqlpp
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/serial_var_empty/serial_var_empty.1.ddl.sqlpp
new file mode 100644
index 0000000..da0bd7b
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/serial_var_empty/serial_var_empty.1.ddl.sqlpp
@@ -0,0 +1,33 @@
+/*
+ * 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.
+ */
+
+drop  dataverse test if exists;
+create  dataverse test;
+
+use test;
+
+
+create type test.TestType as
+{
+  id : bigint,
+  gid : bigint,
+  val : double
+};
+
+create  dataset Test(TestType) primary key id;

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/2a42da45/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/serial_var_empty/serial_var_empty.3.query.sqlpp
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/serial_var_empty/serial_var_empty.3.query.sqlpp
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/serial_var_empty/serial_var_empty.3.query.sqlpp
new file mode 100644
index 0000000..23e33cc
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/serial_var_empty/serial_var_empty.3.query.sqlpp
@@ -0,0 +1,26 @@
+/*
+ * 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.
+ */
+
+use test;
+
+select gid, strict_var((select value g.val from g)) as var,
+   strict_var_pop((select value g.val from g)) as var_pop
+from Test as t
+/* +hash */
+group by t.gid as gid group as g(val as val);

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/2a42da45/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/serial_var_float/serial_var_float.1.ddl.sqlpp
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/serial_var_float/serial_var_float.1.ddl.sqlpp
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/serial_var_float/serial_var_float.1.ddl.sqlpp
new file mode 100644
index 0000000..ddac6a0
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/serial_var_float/serial_var_float.1.ddl.sqlpp
@@ -0,0 +1,33 @@
+/*
+ * 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.
+ */
+
+drop  dataverse test if exists;
+create  dataverse test;
+
+use test;
+
+
+create type test.TestType as
+{
+  id : bigint,
+  gid : bigint,
+  val : float
+};
+
+create  dataset Test(TestType) primary key id;

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/2a42da45/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/serial_var_float/serial_var_float.2.update.sqlpp
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/serial_var_float/serial_var_float.2.update.sqlpp
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/serial_var_float/serial_var_float.2.update.sqlpp
new file mode 100644
index 0000000..c83ba1c
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/serial_var_float/serial_var_float.2.update.sqlpp
@@ -0,0 +1,31 @@
+/*
+ * 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.
+ */
+
+use test;
+
+insert into Test
+select element {'id':0,'gid':1,'val':float('4.32'),'valplus':float('473847')};
+insert into Test
+select element {'id':1,'gid':1,'val':float('5.32')};
+insert into Test
+select element 
{'id':2,'gid':1,'val':float('6.32'),'valplus':float('38473827484738239')};
+insert into Test
+select element {'id':3,'gid':1,'val':float('4.32'),'valplus':float('678900')};
+insert into Test
+select element {'id':4,'gid':1,'val':float('4.32'),'valplus':null};

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/2a42da45/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/serial_var_float/serial_var_float.3.query.sqlpp
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/serial_var_float/serial_var_float.3.query.sqlpp
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/serial_var_float/serial_var_float.3.query.sqlpp
new file mode 100644
index 0000000..23e33cc
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/serial_var_float/serial_var_float.3.query.sqlpp
@@ -0,0 +1,26 @@
+/*
+ * 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.
+ */
+
+use test;
+
+select gid, strict_var((select value g.val from g)) as var,
+   strict_var_pop((select value g.val from g)) as var_pop
+from Test as t
+/* +hash */
+group by t.gid as gid group as g(val as val);

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/2a42da45/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/serial_var_float_null/serial_var_float_null.1.ddl.sqlpp
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/serial_var_float_null/serial_var_float_null.1.ddl.sqlpp
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/serial_var_float_null/serial_var_float_null.1.ddl.sqlpp
new file mode 100644
index 0000000..ddac6a0
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/serial_var_float_null/serial_var_float_null.1.ddl.sqlpp
@@ -0,0 +1,33 @@
+/*
+ * 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.
+ */
+
+drop  dataverse test if exists;
+create  dataverse test;
+
+use test;
+
+
+create type test.TestType as
+{
+  id : bigint,
+  gid : bigint,
+  val : float
+};
+
+create  dataset Test(TestType) primary key id;

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/2a42da45/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/serial_var_float_null/serial_var_float_null.2.update.sqlpp
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/serial_var_float_null/serial_var_float_null.2.update.sqlpp
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/serial_var_float_null/serial_var_float_null.2.update.sqlpp
new file mode 100644
index 0000000..c83ba1c
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/serial_var_float_null/serial_var_float_null.2.update.sqlpp
@@ -0,0 +1,31 @@
+/*
+ * 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.
+ */
+
+use test;
+
+insert into Test
+select element {'id':0,'gid':1,'val':float('4.32'),'valplus':float('473847')};
+insert into Test
+select element {'id':1,'gid':1,'val':float('5.32')};
+insert into Test
+select element 
{'id':2,'gid':1,'val':float('6.32'),'valplus':float('38473827484738239')};
+insert into Test
+select element {'id':3,'gid':1,'val':float('4.32'),'valplus':float('678900')};
+insert into Test
+select element {'id':4,'gid':1,'val':float('4.32'),'valplus':null};

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/2a42da45/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/serial_var_float_null/serial_var_float_null.3.query.sqlpp
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/serial_var_float_null/serial_var_float_null.3.query.sqlpp
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/serial_var_float_null/serial_var_float_null.3.query.sqlpp
new file mode 100644
index 0000000..7116737
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/serial_var_float_null/serial_var_float_null.3.query.sqlpp
@@ -0,0 +1,26 @@
+/*
+ * 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.
+ */
+
+use test;
+
+select gid, strict_var((select value g.valplus from g)) as var,
+   strict_var_pop((select value g.valplus from g)) as var_pop
+from Test as t
+/* +hash */
+group by t.gid as gid group as g(valplus as valplus);

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/2a42da45/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/serial_var_int16/serial_var_int16.1.ddl.sqlpp
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/serial_var_int16/serial_var_int16.1.ddl.sqlpp
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/serial_var_int16/serial_var_int16.1.ddl.sqlpp
new file mode 100644
index 0000000..0c0bfee
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/serial_var_int16/serial_var_int16.1.ddl.sqlpp
@@ -0,0 +1,33 @@
+/*
+ * 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.
+ */
+
+drop  dataverse test if exists;
+create  dataverse test;
+
+use test;
+
+
+create type test.TestType as
+{
+  id : bigint,
+  gid : bigint,
+  val : smallint
+};
+
+create  dataset Test(TestType) primary key id;

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/2a42da45/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/serial_var_int16/serial_var_int16.2.update.sqlpp
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/serial_var_int16/serial_var_int16.2.update.sqlpp
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/serial_var_int16/serial_var_int16.2.update.sqlpp
new file mode 100644
index 0000000..6210af4
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/serial_var_int16/serial_var_int16.2.update.sqlpp
@@ -0,0 +1,31 @@
+/*
+ * 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.
+ */
+
+use test;
+
+insert into Test
+select element {'id':0,'gid':1,'val':smallint('4'),'valplus':smallint('1')};
+insert into Test
+select element {'id':1,'gid':1,'val':smallint('5')};
+insert into Test
+select element {'id':2,'gid':1,'val':smallint('6'),'valplus':smallint('2')};
+insert into Test
+select element {'id':3,'gid':1,'val':smallint('4'),'valplus':smallint('3')};
+insert into Test
+select element {'id':4,'gid':1,'val':smallint('4'),'valplus':null};

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/2a42da45/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/serial_var_int16/serial_var_int16.3.query.sqlpp
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/serial_var_int16/serial_var_int16.3.query.sqlpp
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/serial_var_int16/serial_var_int16.3.query.sqlpp
new file mode 100644
index 0000000..23e33cc
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/serial_var_int16/serial_var_int16.3.query.sqlpp
@@ -0,0 +1,26 @@
+/*
+ * 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.
+ */
+
+use test;
+
+select gid, strict_var((select value g.val from g)) as var,
+   strict_var_pop((select value g.val from g)) as var_pop
+from Test as t
+/* +hash */
+group by t.gid as gid group as g(val as val);

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/2a42da45/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/serial_var_int16_null/serial_var_int16_null.1.ddl.sqlpp
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/serial_var_int16_null/serial_var_int16_null.1.ddl.sqlpp
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/serial_var_int16_null/serial_var_int16_null.1.ddl.sqlpp
new file mode 100644
index 0000000..0c0bfee
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/serial_var_int16_null/serial_var_int16_null.1.ddl.sqlpp
@@ -0,0 +1,33 @@
+/*
+ * 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.
+ */
+
+drop  dataverse test if exists;
+create  dataverse test;
+
+use test;
+
+
+create type test.TestType as
+{
+  id : bigint,
+  gid : bigint,
+  val : smallint
+};
+
+create  dataset Test(TestType) primary key id;

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/2a42da45/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/serial_var_int16_null/serial_var_int16_null.2.update.sqlpp
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/serial_var_int16_null/serial_var_int16_null.2.update.sqlpp
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/serial_var_int16_null/serial_var_int16_null.2.update.sqlpp
new file mode 100644
index 0000000..6210af4
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/serial_var_int16_null/serial_var_int16_null.2.update.sqlpp
@@ -0,0 +1,31 @@
+/*
+ * 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.
+ */
+
+use test;
+
+insert into Test
+select element {'id':0,'gid':1,'val':smallint('4'),'valplus':smallint('1')};
+insert into Test
+select element {'id':1,'gid':1,'val':smallint('5')};
+insert into Test
+select element {'id':2,'gid':1,'val':smallint('6'),'valplus':smallint('2')};
+insert into Test
+select element {'id':3,'gid':1,'val':smallint('4'),'valplus':smallint('3')};
+insert into Test
+select element {'id':4,'gid':1,'val':smallint('4'),'valplus':null};

Reply via email to