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/07/20 19:56:33 UTC

[4/4] asterixdb git commit: [NO ISSUE][FUN] Implement array functions p3

[NO ISSUE][FUN] Implement array functions p3

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

details:
array_concat(), array_flatten(), array_ifnull(), array_intersect()
array_range(), array_replace(), array_star(), array_symdiff(),
array_symdiffn(), array_union()

Change-Id: Ida0d12d48f8c676d5a93b024c301dd13ef400247
Reviewed-on: https://asterix-gerrit.ics.uci.edu/2790
Tested-by: Jenkins <je...@fulliautomatix.ics.uci.edu>
Contrib: Jenkins <je...@fulliautomatix.ics.uci.edu>
Integration-Tests: Jenkins <je...@fulliautomatix.ics.uci.edu>
Reviewed-by: Dmitry Lychagin <dm...@couchbase.com>


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

Branch: refs/heads/master
Commit: 9a987680d3b7b7946df34070262d1b95e8ede054
Parents: 39801f6
Author: Ali Alsuliman <al...@gmail.com>
Authored: Fri Jul 20 04:52:55 2018 -0700
Committer: Dmitry Lychagin <dm...@couchbase.com>
Committed: Fri Jul 20 12:56:12 2018 -0700

----------------------------------------------------------------------
 asterixdb/asterix-app/data/tinysocial/twm2.adm  |  12 +
 .../array_concat/array_concat.1.ddl.sqlpp       |  56 +++
 .../array_concat/array_concat.2.update.sqlpp    |  27 ++
 .../array_concat/array_concat.3.query.sqlpp     |  32 ++
 .../array_concat/array_concat.4.query.sqlpp     |  27 ++
 .../array_concat/array_concat.5.ddl.sqlpp       |  20 ++
 .../array_flatten/array_flatten.1.ddl.sqlpp     |  23 ++
 .../array_flatten/array_flatten.2.update.sqlpp  |  18 +
 .../array_flatten/array_flatten.3.query.sqlpp   |  39 +++
 .../array_flatten/array_flatten.4.ddl.sqlpp     |  20 ++
 .../array_ifnull/array_ifnull.1.ddl.sqlpp       |  56 +++
 .../array_ifnull/array_ifnull.2.update.sqlpp    |  27 ++
 .../array_ifnull/array_ifnull.3.query.sqlpp     |  36 ++
 .../array_ifnull/array_ifnull.4.ddl.sqlpp       |  20 ++
 .../array_intersect/array_intersect.1.ddl.sqlpp |  56 +++
 .../array_intersect.2.update.sqlpp              |  27 ++
 .../array_intersect.3.query.sqlpp               |  39 +++
 .../array_intersect.4.query.sqlpp               |  27 ++
 .../array_intersect.5.query.sqlpp               |  27 ++
 .../array_intersect/array_intersect.6.ddl.sqlpp |  20 ++
 .../array_range/array_range.1.ddl.sqlpp         |  23 ++
 .../array_range/array_range.2.update.sqlpp      |  20 ++
 .../array_range/array_range.3.query.sqlpp       |  40 +++
 .../array_range/array_range.4.query.sqlpp       |  27 ++
 .../array_range/array_range.5.query.sqlpp       |  27 ++
 .../array_range/array_range.6.ddl.sqlpp         |  20 ++
 .../array_replace/array_replace.1.ddl.sqlpp     |  46 +++
 .../array_replace/array_replace.2.update.sqlpp  |  22 ++
 .../array_replace/array_replace.3.query.sqlpp   |  47 +++
 .../array_replace/array_replace.4.query.sqlpp   |  27 ++
 .../array_replace/array_replace.5.query.sqlpp   |  27 ++
 .../array_replace/array_replace.6.query.sqlpp   |  27 ++
 .../array_replace/array_replace.7.ddl.sqlpp     |  20 ++
 .../array_fun/array_star/array_star.1.ddl.sqlpp |  34 ++
 .../array_star/array_star.2.update.sqlpp        |  25 ++
 .../array_star/array_star.3.query.sqlpp         |  42 +++
 .../array_fun/array_star/array_star.4.ddl.sqlpp |  20 ++
 .../array_symdiff/array_symdiff.1.ddl.sqlpp     |  56 +++
 .../array_symdiff/array_symdiff.2.update.sqlpp  |  27 ++
 .../array_symdiff/array_symdiff.3.query.sqlpp   |  37 ++
 .../array_symdiff/array_symdiff.4.query.sqlpp   |  27 ++
 .../array_symdiff/array_symdiff.5.query.sqlpp   |  27 ++
 .../array_symdiff/array_symdiff.6.ddl.sqlpp     |  20 ++
 .../array_symdiffn/array_symdiffn.1.ddl.sqlpp   |  56 +++
 .../array_symdiffn.2.update.sqlpp               |  27 ++
 .../array_symdiffn/array_symdiffn.3.query.sqlpp |  37 ++
 .../array_symdiffn/array_symdiffn.4.query.sqlpp |  27 ++
 .../array_symdiffn/array_symdiffn.5.query.sqlpp |  27 ++
 .../array_symdiffn/array_symdiffn.6.ddl.sqlpp   |  20 ++
 .../array_union/array_union.1.ddl.sqlpp         |  56 +++
 .../array_union/array_union.2.update.sqlpp      |  27 ++
 .../array_union/array_union.3.query.sqlpp       |  39 +++
 .../array_union/array_union.4.query.sqlpp       |  27 ++
 .../array_union/array_union.5.query.sqlpp       |  27 ++
 .../array_union/array_union.6.ddl.sqlpp         |  20 ++
 .../array_fun/array_concat/array_concat.3.adm   |   1 +
 .../array_fun/array_flatten/array_flatten.3.adm |   1 +
 .../array_fun/array_ifnull/array_ifnull.3.adm   |   1 +
 .../array_intersect/array_intersect.3.adm       |   1 +
 .../array_fun/array_range/array_range.3.adm     |   1 +
 .../array_fun/array_replace/array_replace.3.adm |   1 +
 .../array_fun/array_star/array_star.3.adm       |   1 +
 .../array_fun/array_symdiff/array_symdiff.3.adm |   1 +
 .../array_symdiffn/array_symdiffn.3.adm         |   1 +
 .../array_fun/array_union/array_union.3.adm     |   1 +
 .../resources/runtimets/testsuite_sqlpp.xml     |  64 ++++
 .../asterix/common/exceptions/ErrorCode.java    |   1 +
 .../main/resources/asx_errormsg/en.properties   |   3 +-
 .../asterix/om/functions/BuiltinFunctions.java  |  33 ++
 .../impl/AListFirstTypeComputer.java            |  21 +-
 .../impl/AListMultiListArgsTypeComputer.java    |  59 ++++
 .../om/typecomputer/impl/AListTypeComputer.java |  34 +-
 .../impl/ArrayIfNullTypeComputer.java           |  43 +++
 .../impl/ArrayRangeTypeComputer.java            |  65 ++++
 .../om/typecomputer/TypeComputerTest.java       |  95 ++++--
 .../runtime/base/ListAccessorFactory.java       |  32 ++
 .../AbstractArrayProcessArraysEval.java         | 184 ++++++++++
 .../functions/ArrayAppendDescriptor.java        |  21 +-
 .../functions/ArrayConcatDescriptor.java        | 119 +++++++
 .../functions/ArrayContainsDescriptor.java      |  22 +-
 .../functions/ArrayDistinctDescriptor.java      |  26 +-
 .../functions/ArrayFlattenDescriptor.java       | 223 ++++++++++++
 .../functions/ArrayIfNullDescriptor.java        | 135 ++++++++
 .../functions/ArrayInsertDescriptor.java        |  26 +-
 .../functions/ArrayIntersectDescriptor.java     | 337 +++++++++++++++++++
 .../functions/ArrayPositionDescriptor.java      |  23 +-
 .../functions/ArrayPrependDescriptor.java       |  21 +-
 .../functions/ArrayPutDescriptor.java           |  22 +-
 .../functions/ArrayRangeDescriptor.java         | 163 +++++++++
 .../functions/ArrayRemoveDescriptor.java        |  22 +-
 .../functions/ArrayRepeatDescriptor.java        |   9 +-
 .../functions/ArrayReplaceDescriptor.java       | 224 ++++++++++++
 .../functions/ArrayReverseDescriptor.java       |   7 +-
 .../functions/ArrayStarDescriptor.java          | 212 ++++++++++++
 .../functions/ArraySymDiffDescriptor.java       |  73 ++++
 .../evaluators/functions/ArraySymDiffEval.java  | 160 +++++++++
 .../functions/ArraySymDiffnDescriptor.java      |  85 +++++
 .../functions/ArrayUnionDescriptor.java         | 160 +++++++++
 .../evaluators/functions/PointableHelper.java   |   6 +
 .../runtime/functions/FunctionCollection.java   |  20 ++
 .../runtime/utils/ArrayFunctionsUtil.java       |  47 +++
 101 files changed, 4386 insertions(+), 108 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/asterixdb/blob/9a987680/asterixdb/asterix-app/data/tinysocial/twm2.adm
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/data/tinysocial/twm2.adm b/asterixdb/asterix-app/data/tinysocial/twm2.adm
new file mode 100644
index 0000000..b84a569
--- /dev/null
+++ b/asterixdb/asterix-app/data/tinysocial/twm2.adm
@@ -0,0 +1,12 @@
+{"tweetid":"1","user":{"screen-name":"NathanGiesen@211","lang":"en","friends_count":39339,"statuses_count":473,"name":"Nathan Giesen","followers_count":49416},"sender-location":point("47.44,80.65"),"send-time":datetime("2008-04-26T10:10:00"),"referred-topics":["t-mobile","customization"],"message-text":" love t-mobile its customization is good:)"}
+{"tweetid":"2","user":{"screen-name":"ColineGeyer@63","lang":"en","friends_count":121,"statuses_count":362,"name":"Coline Geyer","followers_count":17159},"sender-location":point("32.84,67.14"),"send-time":datetime("2010-05-13T10:10:00"),"referred-topics":["verizon","shortcut-menu"],"message-text":" like verizon its shortcut-menu is awesome:)"}
+{"tweetid":"3","user":{"screen-name":"NathanGiesen@211","lang":"en","friends_count":39339,"statuses_count":473,"name":"Nathan Giesen","followers_count":49416},"sender-location":point("29.72,75.8"),"send-time":datetime("2006-11-04T10:10:00"),"referred-topics":["motorola","speed"],"message-text":" like motorola the speed is good:)"}
+{"tweetid":"4","user":{"screen-name":"NathanGiesen@211","lang":"en","friends_count":39339,"statuses_count":473,"name":"Nathan Giesen","followers_count":49416},"sender-location":point("39.28,70.48"),"send-time":datetime("2011-12-26T10:10:00"),"referred-topics":["sprint","voice-command"],"message-text":" like sprint the voice-command is mind-blowing:)"}
+{"tweetid":"5","user":{"screen-name":"NathanGiesen@211","lang":"en","friends_count":39339,"statuses_count":473,"name":"Nathan Giesen","followers_count":49416},"sender-location":point("40.09,92.69"),"send-time":datetime("2006-08-04T10:10:00"),"referred-topics":["motorola","speed"],"message-text":" can't stand motorola its speed is terrible:("}
+{"tweetid":"6","user":{"screen-name":"ColineGeyer@63","lang":"en","friends_count":121,"statuses_count":362,"name":"Coline Geyer","followers_count":17159},"sender-location":point("47.51,83.99"),"send-time":datetime("2010-05-07T10:10:00"),"referred-topics":["iphone","voice-clarity"],"message-text":" like iphone the voice-clarity is good:)"}
+{"tweetid":"7","user":{"screen-name":"ChangEwing_573","lang":"en","friends_count":182,"statuses_count":394,"name":"Chang Ewing","followers_count":32136},"sender-location":point("36.21,72.6"),"send-time":datetime("2011-08-25T10:10:00"),"referred-topics":["samsung","platform"],"message-text":" like samsung the platform is good"}
+{"tweetid":"8","user":{"screen-name":"NathanGiesen@211","lang":"en","friends_count":39339,"statuses_count":473,"name":"Nathan Giesen","followers_count":49416},"sender-location":point("46.05,93.34"),"send-time":datetime("2005-10-14T10:10:00"),"referred-topics":["t-mobile","shortcut-menu"],"message-text":" like t-mobile the shortcut-menu is awesome:)"}
+{"tweetid":"9","user":{"screen-name":"NathanGiesen@211","lang":"en","friends_count":39339,"statuses_count":473,"name":"Nathan Giesen","followers_count":49416},"sender-location":point("36.86,74.62"),"send-time":datetime("2012-07-21T10:10:00"),"referred-topics":["verizon","voicemail-service"],"message-text":" love verizon its voicemail-service is awesome"}
+{"tweetid":"10","user":{"screen-name":"ColineGeyer@63","lang":"en","friends_count":121,"statuses_count":362,"name":"Coline Geyer","followers_count":17159},"sender-location":point("29.15,76.53"),"send-time":datetime("2008-01-26T10:10:00"),"referred-topics":["verizon","voice-clarity"],"message-text":" hate verizon its voice-clarity is OMG:("}
+{"tweetid":"11","user":{"screen-name":"NilaMilliron_tw","lang":"en","friends_count":445,"statuses_count":164,"name":"Nila Milliron","followers_count":22649},"sender-location":point("37.59,68.42"),"send-time":datetime("2008-03-09T10:10:00"),"referred-topics":["iphone","platform"],"message-text":" can't stand iphone its platform is terrible"}
+{"tweetid":"12","user":{"screen-name":"OliJackson_512","lang":"en","friends_count":445,"statuses_count":164,"name":"Oli Jackson","followers_count":22649},"sender-location":point("24.82,94.63"),"send-time":datetime("2010-02-13T10:10:00"),"referred-topics":["samsung","voice-command"],"message-text":" like samsung the voice-command is amazing:)"}

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/9a987680/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/array_fun/array_concat/array_concat.1.ddl.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/array_fun/array_concat/array_concat.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/array_fun/array_concat/array_concat.1.ddl.sqlpp
new file mode 100755
index 0000000..1c55a9a
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/array_fun/array_concat/array_concat.1.ddl.sqlpp
@@ -0,0 +1,56 @@
+/*
+ * 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 TinySocial if exists;
+create  dataverse TinySocial;
+
+use TinySocial;
+
+
+create type TinySocial.TwitterUserType as
+{
+  `screen-name` : string,
+  lang : string,
+  friends_count : bigint,
+  statuses_count : bigint,
+  name : string,
+  followers_count : bigint
+};
+
+create type TinySocial.TweetMessageType as
+ closed {
+  tweetid : string,
+  user : TwitterUserType,
+  `sender-location` : point?,
+  `send-time` : datetime,
+  `referred-topics` : {{string}},
+  `message-text` : string
+};
+
+create type t1 AS {
+
+};
+
+create type t2 AS {
+id: int,
+compType: t1
+};
+
+create  dataset TweetMessages(TweetMessageType) primary key tweetid hints (`CARDINALITY`=`100`);
+create dataset d1(t2) primary key id;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/9a987680/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/array_fun/array_concat/array_concat.2.update.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/array_fun/array_concat/array_concat.2.update.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/array_fun/array_concat/array_concat.2.update.sqlpp
new file mode 100755
index 0000000..2767210
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/array_fun/array_concat/array_concat.2.update.sqlpp
@@ -0,0 +1,27 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+use TinySocial;
+
+load  dataset TweetMessages using localfs ((`path`=`asterix_nc1://data/tinysocial/twm.adm`),(`format`=`adm`));
+
+insert into d1([
+{"id":1, "compType":{"sth":33}},
+{"id":2, "compType":{"sth":44}}
+]);
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/9a987680/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/array_fun/array_concat/array_concat.3.query.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/array_fun/array_concat/array_concat.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/array_fun/array_concat/array_concat.3.query.sqlpp
new file mode 100755
index 0000000..c36b56f
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/array_fun/array_concat/array_concat.3.query.sqlpp
@@ -0,0 +1,32 @@
+/*
+ * 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 TinySocial;
+
+{
+  "t1": (select array_concat(t.`referred-topics`, {{"sth", 5}}, {{3,2}}) from TweetMessages t order by t.tweetid),
+  "t2": (select array_concat([3, "John"], (select value v.compType from d1 v))),
+  "t3": (array_concat([3,5,1], null, missing)),   // missing
+  "t4": (array_concat([3,1,6], "non_array")),     // null
+  "t5": (array_concat(null, [3, 9])),             // null
+  "t6": (array_concat("non_array", [5], missing)),// missing
+  "t7": (array_concat([], [5, 10], [12.0], [])),  // OK
+  "t8": (array_concat(missing, 3, 9)),            // missing
+  "t9": (array_concat([3, missing], [3, [9], null, missing, null]))  // OK with nulls
+};
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/9a987680/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/array_fun/array_concat/array_concat.4.query.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/array_fun/array_concat/array_concat.4.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/array_fun/array_concat/array_concat.4.query.sqlpp
new file mode 100755
index 0000000..805dd99
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/array_fun/array_concat/array_concat.4.query.sqlpp
@@ -0,0 +1,27 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/*
+* Description  : Testing different input list types
+* Expected Res : Error due to processing different list types
+*/
+
+use TinySocial;
+
+select array_concat([3,5,1], [2,1], {{3, 1}});
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/9a987680/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/array_fun/array_concat/array_concat.5.ddl.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/array_fun/array_concat/array_concat.5.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/array_fun/array_concat/array_concat.5.ddl.sqlpp
new file mode 100755
index 0000000..3f8c8ec
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/array_fun/array_concat/array_concat.5.ddl.sqlpp
@@ -0,0 +1,20 @@
+/*
+ * 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 TinySocial;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/9a987680/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/array_fun/array_flatten/array_flatten.1.ddl.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/array_fun/array_flatten/array_flatten.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/array_fun/array_flatten/array_flatten.1.ddl.sqlpp
new file mode 100755
index 0000000..8c406c9
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/array_fun/array_flatten/array_flatten.1.ddl.sqlpp
@@ -0,0 +1,23 @@
+/*
+ * 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 TinySocial if exists;
+create  dataverse TinySocial;
+
+use TinySocial;

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/9a987680/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/array_fun/array_flatten/array_flatten.2.update.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/array_fun/array_flatten/array_flatten.2.update.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/array_fun/array_flatten/array_flatten.2.update.sqlpp
new file mode 100755
index 0000000..042f3ce
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/array_fun/array_flatten/array_flatten.2.update.sqlpp
@@ -0,0 +1,18 @@
+/*
+ * 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.
+ */

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/9a987680/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/array_fun/array_flatten/array_flatten.3.query.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/array_fun/array_flatten/array_flatten.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/array_fun/array_flatten/array_flatten.3.query.sqlpp
new file mode 100755
index 0000000..685c96a
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/array_fun/array_flatten/array_flatten.3.query.sqlpp
@@ -0,0 +1,39 @@
+/*
+ * 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 TinySocial;
+
+{
+  "t1": (array_flatten([2, 3, [7,1,2], [8, [12, 13, 14]]], 1)),
+  "t2": (array_flatten([2, 3, [7,1,"a"], [8, [12, "b", 14]]], 1)),
+  "t3": (array_flatten([2, 3, [7,1,"a"], [8, [12, "b", 14]]], 2)),
+  "t4": (array_flatten([2, 3, [7,1,"a"], [8, [12, "b", 14]]], 4)),
+  "t5": (array_flatten([2, 3, [7,1,"a"], [8, [12, "b", 14]]], 0)),
+  "t6": (array_flatten([2, 3, [7,1,"a"], [8, [12, "b", 14]]], -1)),
+  "t7": (array_flatten([2, 3, [7,1,"a"], [8, [12, "b", 14]]], 2.0)),  // OK
+  "t8": (array_flatten([2, 3, [7,1,"a"], [8, [12, "b", 14]]], 2.1)),  // null
+  "t9": (array_flatten([2, 3, null, [7,1, missing, "a"], [8, [12, null, "b", 14, missing]]], 2)),
+  "t10": (array_flatten([2, 3, [7,1,"a"], [8, [12, "b", 14]]], missing)),
+  "t11": (array_flatten([2, 3, [7,1,"a"], [8, [12, "b", 14]]], null)),
+  "t12": (array_flatten(missing, 2)),
+  "t13": (array_flatten(null, 2)),
+  "t14": (array_flatten(null, missing)),
+  "t15": (array_flatten("non_array", 2)),
+  "t16": (array_flatten([1,2,3, [5,6,7]], "non-numeric"))
+};
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/9a987680/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/array_fun/array_flatten/array_flatten.4.ddl.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/array_fun/array_flatten/array_flatten.4.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/array_fun/array_flatten/array_flatten.4.ddl.sqlpp
new file mode 100755
index 0000000..3f8c8ec
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/array_fun/array_flatten/array_flatten.4.ddl.sqlpp
@@ -0,0 +1,20 @@
+/*
+ * 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 TinySocial;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/9a987680/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/array_fun/array_ifnull/array_ifnull.1.ddl.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/array_fun/array_ifnull/array_ifnull.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/array_fun/array_ifnull/array_ifnull.1.ddl.sqlpp
new file mode 100755
index 0000000..c1acf81
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/array_fun/array_ifnull/array_ifnull.1.ddl.sqlpp
@@ -0,0 +1,56 @@
+/*
+ * 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 TinySocial if exists;
+create  dataverse TinySocial;
+
+use TinySocial;
+
+
+create type TinySocial.TwitterUserType as
+{
+  `screen-name` : string,
+  lang : string,
+  friends_count : bigint,
+  statuses_count : bigint,
+  name : string,
+  followers_count : bigint
+};
+
+create type TinySocial.TweetMessageType as
+ closed {
+  tweetid : string,
+  user : TwitterUserType,
+  `sender-location` : point?,
+  `send-time` : datetime,
+  `referred-topics` : {{string}},
+  `message-text` : string
+};
+
+create type t1 AS {
+
+};
+
+create type t2 AS {
+id: int,
+compType: t1?
+};
+
+create  dataset TweetMessages(TweetMessageType) primary key tweetid hints (`CARDINALITY`=`100`);
+create dataset d1(t2) primary key id;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/9a987680/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/array_fun/array_ifnull/array_ifnull.2.update.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/array_fun/array_ifnull/array_ifnull.2.update.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/array_fun/array_ifnull/array_ifnull.2.update.sqlpp
new file mode 100755
index 0000000..4b7a23a
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/array_fun/array_ifnull/array_ifnull.2.update.sqlpp
@@ -0,0 +1,27 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+use TinySocial;
+
+load  dataset TweetMessages using localfs ((`path`=`asterix_nc1://data/tinysocial/twm.adm`),(`format`=`adm`));
+
+insert into d1([
+{"id":1, "compType":null},
+{"id":2, "compType":{"sth":44}}
+]);
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/9a987680/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/array_fun/array_ifnull/array_ifnull.3.query.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/array_fun/array_ifnull/array_ifnull.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/array_fun/array_ifnull/array_ifnull.3.query.sqlpp
new file mode 100755
index 0000000..e2d834e
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/array_fun/array_ifnull/array_ifnull.3.query.sqlpp
@@ -0,0 +1,36 @@
+/*
+ * 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 TinySocial;
+
+{
+  "t1": (select array_ifnull(t.`referred-topics`) from TweetMessages t order by t.tweetid),
+  "t2": (select array_ifnull((select value v.compType from d1 v))),
+  "t3": (array_ifnull([null, null, 3, 4.9, null])),
+  "t4": (array_ifnull([missing, 2, "a"])),
+  "t5": (array_ifnull([4, 2, "a"])),
+  "t6": (array_ifnull([4, 2, null, missing])),
+  "t7": (array_ifnull([null, null, null])),           // null
+  "t8": (array_ifnull([missing, missing, missing])),  // null
+  "t9": (array_ifnull([missing, null, missing])),   // null
+  "t10": (array_ifnull("non_array")),               // null
+  "t11": (array_ifnull([])),                        // null
+  "t12": (array_ifnull(missing)),                   // missing
+  "t13": (array_ifnull(null))                       // null
+};
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/9a987680/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/array_fun/array_ifnull/array_ifnull.4.ddl.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/array_fun/array_ifnull/array_ifnull.4.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/array_fun/array_ifnull/array_ifnull.4.ddl.sqlpp
new file mode 100755
index 0000000..3f8c8ec
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/array_fun/array_ifnull/array_ifnull.4.ddl.sqlpp
@@ -0,0 +1,20 @@
+/*
+ * 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 TinySocial;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/9a987680/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/array_fun/array_intersect/array_intersect.1.ddl.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/array_fun/array_intersect/array_intersect.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/array_fun/array_intersect/array_intersect.1.ddl.sqlpp
new file mode 100755
index 0000000..1c55a9a
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/array_fun/array_intersect/array_intersect.1.ddl.sqlpp
@@ -0,0 +1,56 @@
+/*
+ * 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 TinySocial if exists;
+create  dataverse TinySocial;
+
+use TinySocial;
+
+
+create type TinySocial.TwitterUserType as
+{
+  `screen-name` : string,
+  lang : string,
+  friends_count : bigint,
+  statuses_count : bigint,
+  name : string,
+  followers_count : bigint
+};
+
+create type TinySocial.TweetMessageType as
+ closed {
+  tweetid : string,
+  user : TwitterUserType,
+  `sender-location` : point?,
+  `send-time` : datetime,
+  `referred-topics` : {{string}},
+  `message-text` : string
+};
+
+create type t1 AS {
+
+};
+
+create type t2 AS {
+id: int,
+compType: t1
+};
+
+create  dataset TweetMessages(TweetMessageType) primary key tweetid hints (`CARDINALITY`=`100`);
+create dataset d1(t2) primary key id;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/9a987680/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/array_fun/array_intersect/array_intersect.2.update.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/array_fun/array_intersect/array_intersect.2.update.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/array_fun/array_intersect/array_intersect.2.update.sqlpp
new file mode 100755
index 0000000..2767210
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/array_fun/array_intersect/array_intersect.2.update.sqlpp
@@ -0,0 +1,27 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+use TinySocial;
+
+load  dataset TweetMessages using localfs ((`path`=`asterix_nc1://data/tinysocial/twm.adm`),(`format`=`adm`));
+
+insert into d1([
+{"id":1, "compType":{"sth":33}},
+{"id":2, "compType":{"sth":44}}
+]);
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/9a987680/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/array_fun/array_intersect/array_intersect.3.query.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/array_fun/array_intersect/array_intersect.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/array_fun/array_intersect/array_intersect.3.query.sqlpp
new file mode 100755
index 0000000..283af63
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/array_fun/array_intersect/array_intersect.3.query.sqlpp
@@ -0,0 +1,39 @@
+/*
+ * 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 TinySocial;
+
+{
+  "t1": (select array_intersect(t.`referred-topics`, {{"t-mobile", "platform"}}, {{"t-mobile"}}) from TweetMessages t order by t.tweetid),
+  "t2": (select array_intersect([1, "John", 2], (select value v.id from d1 v), [2,4,1])),
+  "t3": (array_intersect([3,5,1], [5,7,3], [3,2,5,1])),
+  "t4": (array_intersect([3,5.0,1], [5,7,3], [3,2,5,1])),
+  "t5": (array_intersect([3,"a",1], ["a",7,3], [3,2,"a",1])),
+  "t6": (array_intersect([3,"a",1], ["A",7,3], [3,2,"a",1])),
+  "t7": (array_intersect([3,"a",null], ["A",7,missing], [3,2,"a",1, null])),
+  "t8": (array_intersect([3,"a",null], ["A",7,null], [3,2,"a",1, null])),
+  "t9": (array_intersect([3,missing,"a",null], [missing,"A",7,null], [3,2,"a",1, null,missing])),
+  "t10": (array_intersect([3,5,1], [7,3], [2,5,1])),
+  "t11": (array_intersect([3,5,1], missing, [2,5,1])),
+  "t12": (array_intersect([3,5,1], null, [2,5,1])),
+  "t13": (array_intersect([3,5,1], "non_array", [2,5,1])),
+  "t14": (array_intersect(missing, "non_array", [2,5,1])),
+  "t15": (array_intersect([], [], [])),
+  "t16": (array_intersect([], [3,2], []))
+};
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/9a987680/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/array_fun/array_intersect/array_intersect.4.query.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/array_fun/array_intersect/array_intersect.4.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/array_fun/array_intersect/array_intersect.4.query.sqlpp
new file mode 100755
index 0000000..351797c
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/array_fun/array_intersect/array_intersect.4.query.sqlpp
@@ -0,0 +1,27 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/*
+* Description  : Testing different input list types
+* Expected Res : Error due to processing different list types
+*/
+
+use TinySocial;
+
+select array_intersect([3,5,1], [2,1], {{3, 1}});
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/9a987680/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/array_fun/array_intersect/array_intersect.5.query.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/array_fun/array_intersect/array_intersect.5.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/array_fun/array_intersect/array_intersect.5.query.sqlpp
new file mode 100755
index 0000000..e8df7a8
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/array_fun/array_intersect/array_intersect.5.query.sqlpp
@@ -0,0 +1,27 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/*
+* Description  : Testing deep equality
+* Expected Res : Error as deep equality is not yet supported
+*/
+
+use TinySocial;
+
+select array_intersect([3,5,1], [2,1], [5, [3,2]]);
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/9a987680/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/array_fun/array_intersect/array_intersect.6.ddl.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/array_fun/array_intersect/array_intersect.6.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/array_fun/array_intersect/array_intersect.6.ddl.sqlpp
new file mode 100755
index 0000000..3f8c8ec
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/array_fun/array_intersect/array_intersect.6.ddl.sqlpp
@@ -0,0 +1,20 @@
+/*
+ * 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 TinySocial;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/9a987680/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/array_fun/array_range/array_range.1.ddl.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/array_fun/array_range/array_range.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/array_fun/array_range/array_range.1.ddl.sqlpp
new file mode 100755
index 0000000..f016d76
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/array_fun/array_range/array_range.1.ddl.sqlpp
@@ -0,0 +1,23 @@
+/*
+ * 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 TinySocial if exists;
+create  dataverse TinySocial;
+
+use TinySocial;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/9a987680/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/array_fun/array_range/array_range.2.update.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/array_fun/array_range/array_range.2.update.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/array_fun/array_range/array_range.2.update.sqlpp
new file mode 100755
index 0000000..adf6a6c
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/array_fun/array_range/array_range.2.update.sqlpp
@@ -0,0 +1,20 @@
+/*
+ * 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 TinySocial;

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/9a987680/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/array_fun/array_range/array_range.3.query.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/array_fun/array_range/array_range.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/array_fun/array_range/array_range.3.query.sqlpp
new file mode 100755
index 0000000..f189fc1
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/array_fun/array_range/array_range.3.query.sqlpp
@@ -0,0 +1,40 @@
+/*
+ * 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 TinySocial;
+
+{
+  "t1": (array_range(1,6)),
+  "t2": (array_range(0,25,5)),
+  "t3": (array_range(0.1,2)),
+  "t4": (array_range(10, 3, -3)),
+  "t5": (array_range(-1, -8, -3)),
+  "t6": (array_range(1, 8, -3)),
+  "t7": (array_range(10, 2, 3)),
+  "t8": (array_range(1, 13, 0)),
+  "t9": (array_range(2, 2, 1)),
+  "t10": (array_range(2, 3, 1)),
+  "t11": (array_range(2, 9, 1.1)),
+  "t12": (array_range(2, 9, null)),
+  "t13": (array_range(2, missing, 1)),
+  "t14": (array_range(2, missing)),
+  "t15": (array_range(2, 7, "a")),
+  "t16": (array_range(2, "a", 1)),
+  "t17": (array_range("a", 7, 1))
+};
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/9a987680/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/array_fun/array_range/array_range.4.query.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/array_fun/array_range/array_range.4.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/array_fun/array_range/array_range.4.query.sqlpp
new file mode 100755
index 0000000..314360d
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/array_fun/array_range/array_range.4.query.sqlpp
@@ -0,0 +1,27 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/*
+* Description  : Testing correct number of arguments required
+* Expected Res : Error, 2 or 3 args are required
+*/
+
+use TinySocial;
+
+select array_range(2);
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/9a987680/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/array_fun/array_range/array_range.5.query.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/array_fun/array_range/array_range.5.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/array_fun/array_range/array_range.5.query.sqlpp
new file mode 100755
index 0000000..e18dfdc
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/array_fun/array_range/array_range.5.query.sqlpp
@@ -0,0 +1,27 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/*
+* Description  : Testing correct number of arguments required
+* Expected Res : Error, 2 or 3 args are required
+*/
+
+use TinySocial;
+
+select array_range(2,6,1,4,5);
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/9a987680/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/array_fun/array_range/array_range.6.ddl.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/array_fun/array_range/array_range.6.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/array_fun/array_range/array_range.6.ddl.sqlpp
new file mode 100755
index 0000000..3f8c8ec
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/array_fun/array_range/array_range.6.ddl.sqlpp
@@ -0,0 +1,20 @@
+/*
+ * 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 TinySocial;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/9a987680/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/array_fun/array_replace/array_replace.1.ddl.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/array_fun/array_replace/array_replace.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/array_fun/array_replace/array_replace.1.ddl.sqlpp
new file mode 100755
index 0000000..257c4dd
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/array_fun/array_replace/array_replace.1.ddl.sqlpp
@@ -0,0 +1,46 @@
+/*
+ * 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 TinySocial if exists;
+create  dataverse TinySocial;
+
+use TinySocial;
+
+
+create type TinySocial.TwitterUserType as
+{
+  `screen-name` : string,
+  lang : string,
+  friends_count : bigint,
+  statuses_count : bigint,
+  name : string,
+  followers_count : bigint
+};
+
+create type TinySocial.TweetMessageType as
+ closed {
+  tweetid : string,
+  user : TwitterUserType,
+  `sender-location` : point?,
+  `send-time` : datetime,
+  `referred-topics` : {{string}},
+  `message-text` : string
+};
+
+create  dataset TweetMessages(TweetMessageType) primary key tweetid hints (`CARDINALITY`=`100`);
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/9a987680/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/array_fun/array_replace/array_replace.2.update.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/array_fun/array_replace/array_replace.2.update.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/array_fun/array_replace/array_replace.2.update.sqlpp
new file mode 100755
index 0000000..4a0e7ed
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/array_fun/array_replace/array_replace.2.update.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.
+ */
+
+use TinySocial;
+
+load  dataset TweetMessages using localfs ((`path`=`asterix_nc1://data/tinysocial/twm.adm`),(`format`=`adm`));

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/9a987680/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/array_fun/array_replace/array_replace.3.query.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/array_fun/array_replace/array_replace.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/array_fun/array_replace/array_replace.3.query.sqlpp
new file mode 100755
index 0000000..1bea679
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/array_fun/array_replace/array_replace.3.query.sqlpp
@@ -0,0 +1,47 @@
+/*
+ * 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 TinySocial;
+
+{
+  "t1": (select array_replace(t.`referred-topics`, "t-mobile", "coffee-mobile") from TweetMessages t order by t.tweetid),
+  "t2": (array_replace([3,-2,1,5,2,9,2,3,2,1,2], 2, -2)),
+  "t3": (array_replace([3,-2,1,5,2,9,2,3,2,1,2], 2.0, -4)),
+  "t4": (array_replace([3,-2,1,5,"2",9,2,3,2,1,2], 2.0, -4)),
+  "t5": (array_replace([3,-2,"a",5,"2",9,"a",3,"A",1,2], "a", -2)),
+  "t6": (array_replace([3,-2,"a",5,"2",9,[2,3,"A"],1,2], 2, -2)),
+  "t7": (array_replace([3,-2,"a",5,"2",9,[2,3,"A"],1,2], 2, [-2])),
+  "t8": (array_replace([3,1,1,2,2,1,2,1,1], 1, -5, 3)),
+  "t9": (array_replace([3,1,1,2,2,1,2,1,1], 1, -5, 0)),
+  "t10": (array_replace([3,1,1,2,2,1,2,1,1], 1, -5, 4)),
+  "t11": (array_replace([3,1,1,2,2,1,2,1,1], 1, -5, 5)),
+  "t12": (array_replace([3,1,1,2,2,1,2,1,1], 1, -5, 10)),
+  "t13": (array_replace([3,1,1,2,2,1,2,1,1], 1, -5, -3)),
+  "t14": (array_replace([3,1,1,2,2,1,2,1,1], 1, -5, 1.0)),
+  "t15": (array_replace([3,1,1,2,2,1,2,1,1], 1, -5, 1.2)),
+  "t16": (array_replace([3,1,1,2,2,1,2,1,1], 1, -5, "4")),
+  "t17": (array_replace("non_array", 1, -5, 3)),
+  "t18": (array_replace([], 1, -5, 3)),
+  "t19": (array_replace([3,2], 1, -5, 3)),
+  "t20": (array_replace([3,2,3], 3, missing, 8)),
+  "t21": (array_replace([3,2,3], 3, null, 8)),
+  "t22": (array_replace([3,2], null, 3, 3)),
+  "t23": (array_replace([3,null,2], null, 3, 3)),
+  "t24": (array_replace(missing, null, 3, 3))
+};
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/9a987680/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/array_fun/array_replace/array_replace.4.query.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/array_fun/array_replace/array_replace.4.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/array_fun/array_replace/array_replace.4.query.sqlpp
new file mode 100755
index 0000000..7cd1cd3
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/array_fun/array_replace/array_replace.4.query.sqlpp
@@ -0,0 +1,27 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/*
+* Description  : Testing an array function that needs to compare elements
+* Expected Res : Error due to comparing non-primitive values
+*/
+
+use TinySocial;
+
+select array_replace([3,2,3], [3], 9);
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/9a987680/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/array_fun/array_replace/array_replace.5.query.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/array_fun/array_replace/array_replace.5.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/array_fun/array_replace/array_replace.5.query.sqlpp
new file mode 100755
index 0000000..5cd8753
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/array_fun/array_replace/array_replace.5.query.sqlpp
@@ -0,0 +1,27 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/*
+* Description  : Testing correct number of arguments required
+* Expected Res : Error, 3 or 4 args are required
+*/
+
+use TinySocial;
+
+select array_replace([2,6],2);
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/9a987680/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/array_fun/array_replace/array_replace.6.query.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/array_fun/array_replace/array_replace.6.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/array_fun/array_replace/array_replace.6.query.sqlpp
new file mode 100755
index 0000000..61f682f
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/array_fun/array_replace/array_replace.6.query.sqlpp
@@ -0,0 +1,27 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/*
+* Description  : Testing correct number of arguments required
+* Expected Res : Error, 3 or 4 args are required
+*/
+
+use TinySocial;
+
+select array_replace([2,6],2,5,1,6);
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/9a987680/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/array_fun/array_replace/array_replace.7.ddl.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/array_fun/array_replace/array_replace.7.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/array_fun/array_replace/array_replace.7.ddl.sqlpp
new file mode 100755
index 0000000..3f8c8ec
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/array_fun/array_replace/array_replace.7.ddl.sqlpp
@@ -0,0 +1,20 @@
+/*
+ * 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 TinySocial;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/9a987680/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/array_fun/array_star/array_star.1.ddl.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/array_fun/array_star/array_star.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/array_fun/array_star/array_star.1.ddl.sqlpp
new file mode 100755
index 0000000..ad018d3
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/array_fun/array_star/array_star.1.ddl.sqlpp
@@ -0,0 +1,34 @@
+/*
+ * 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 TinySocial if exists;
+create  dataverse TinySocial;
+
+use TinySocial;
+
+create type t1 AS {
+
+};
+
+create type t2 AS {
+id: int,
+compType: t1
+};
+
+create dataset d1(t2) primary key id;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/9a987680/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/array_fun/array_star/array_star.2.update.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/array_fun/array_star/array_star.2.update.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/array_fun/array_star/array_star.2.update.sqlpp
new file mode 100755
index 0000000..4a490a9
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/array_fun/array_star/array_star.2.update.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.
+ */
+
+use TinySocial;
+
+insert into d1([
+{"id":1, "compType":{"sth":33}},
+{"id":2, "compType":{"sth":44}}
+]);
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/9a987680/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/array_fun/array_star/array_star.3.query.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/array_fun/array_star/array_star.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/array_fun/array_star/array_star.3.query.sqlpp
new file mode 100755
index 0000000..5b027ee
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/array_fun/array_star/array_star.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.
+ */
+
+use TinySocial;
+
+{
+  "t1": (array_star([{"a":"a_val1", "b": "b_val1"}, {"a":"a_val2", "b":"b_val2"}, {"a":"a_val3", "b":"b_val3"}])),
+  "t2": (array_star((select value v from d1 v))),
+  "t3": (array_star([{"b": "b_val1", "a":"a_val1"}, {"a":"a_val2", "b":"b_val2"}, {"a":"a_val3", "b":"b_val3"}])),
+  "t4": (array_star([{"b": "b_val1", "a":"a_val1"}, {"b":"b_val2"}, {"a":"a_val3", "b":"b_val3"}])),
+  "t5": (array_star([{"b": "b_val1", "a":"a_val1"}, {"a": null, "b":"b_val2"}, {"a":"a_val3", "b":"b_val3"}])),
+  "t6": (array_star([{"b": "b_val1", "a":"a_val1"}, {"a": null, "b":"b_val2"}, {"a":"a_val3", "b":"b_val3", "c":"c_val3"}])),
+  "t7": (array_star([{"b": "b_val1", "a":5}, {"a": 3.2, "b":"b_val2"}, {"a":"a_val3", "b":"b_val3", "c":"c_val3"}])),
+  "t8": (array_star([{"b": "b_val1", "a":"a_val1"}, {}, {"a":"a_val3", "b":"b_val3"}])),
+  "t9": (array_star([{"b": "b_val1", "a":"a_val1"}, 5, {"a":"a_val3", "b":"b_val3"}])),
+  "t10": (array_star([{"b": "b_val1", "a":"a_val1"}, null, {"a":"a_val3", "b":"b_val3"}])),
+  "t11": (array_star([{"b": "b_val1", "a":"a_val1"}, missing, {"a":"a_val3", "b":"b_val3"}])),
+  "t12": (array_star([{"b": "b_val1", "a":"a_val1"}, 5, [3] ])),
+  "t13": (array_star([{}, {}, {}])),
+  "t14": (array_star([1, 2, 3])),
+  "t15": (array_star([1])),
+  "t16": (array_star([])),
+  "t17": (array_star("non_array")),
+  "t18": (array_star(missing)),
+  "t19": (array_star(null))
+};
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/9a987680/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/array_fun/array_star/array_star.4.ddl.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/array_fun/array_star/array_star.4.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/array_fun/array_star/array_star.4.ddl.sqlpp
new file mode 100755
index 0000000..3f8c8ec
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/array_fun/array_star/array_star.4.ddl.sqlpp
@@ -0,0 +1,20 @@
+/*
+ * 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 TinySocial;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/9a987680/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/array_fun/array_symdiff/array_symdiff.1.ddl.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/array_fun/array_symdiff/array_symdiff.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/array_fun/array_symdiff/array_symdiff.1.ddl.sqlpp
new file mode 100755
index 0000000..1c55a9a
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/array_fun/array_symdiff/array_symdiff.1.ddl.sqlpp
@@ -0,0 +1,56 @@
+/*
+ * 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 TinySocial if exists;
+create  dataverse TinySocial;
+
+use TinySocial;
+
+
+create type TinySocial.TwitterUserType as
+{
+  `screen-name` : string,
+  lang : string,
+  friends_count : bigint,
+  statuses_count : bigint,
+  name : string,
+  followers_count : bigint
+};
+
+create type TinySocial.TweetMessageType as
+ closed {
+  tweetid : string,
+  user : TwitterUserType,
+  `sender-location` : point?,
+  `send-time` : datetime,
+  `referred-topics` : {{string}},
+  `message-text` : string
+};
+
+create type t1 AS {
+
+};
+
+create type t2 AS {
+id: int,
+compType: t1
+};
+
+create  dataset TweetMessages(TweetMessageType) primary key tweetid hints (`CARDINALITY`=`100`);
+create dataset d1(t2) primary key id;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/9a987680/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/array_fun/array_symdiff/array_symdiff.2.update.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/array_fun/array_symdiff/array_symdiff.2.update.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/array_fun/array_symdiff/array_symdiff.2.update.sqlpp
new file mode 100755
index 0000000..2767210
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/array_fun/array_symdiff/array_symdiff.2.update.sqlpp
@@ -0,0 +1,27 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+use TinySocial;
+
+load  dataset TweetMessages using localfs ((`path`=`asterix_nc1://data/tinysocial/twm.adm`),(`format`=`adm`));
+
+insert into d1([
+{"id":1, "compType":{"sth":33}},
+{"id":2, "compType":{"sth":44}}
+]);
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/9a987680/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/array_fun/array_symdiff/array_symdiff.3.query.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/array_fun/array_symdiff/array_symdiff.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/array_fun/array_symdiff/array_symdiff.3.query.sqlpp
new file mode 100755
index 0000000..412580b
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/array_fun/array_symdiff/array_symdiff.3.query.sqlpp
@@ -0,0 +1,37 @@
+/*
+ * 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 TinySocial;
+
+{
+  "t1": (select array_symdiff(t.`referred-topics`, {{"coffee-mobile", "t-mobile"}}, {{"platform"}}) from TweetMessages t order by t.tweetid),
+  "t2": (select array_symdiff([1, "John", 6], (select value v.id from d1 v), [4,4,5,6])),
+  "t3": (array_symdiff([3,5,1], [5,7,3], [3,2,5,1])),
+  "t4": (array_symdiff([3,5.0,1], [7,3], [3,2,1])),
+  "t5": (array_symdiff([3,"a",1], [7,3], [3,2,1])),
+  "t6": (array_symdiff([3,"a",1], ["A",7,3], [3,2,"a",1])),
+  "t7": (array_symdiff([3,"a",null], ["A",7,missing], [3,2,"a",1, null])),
+  "t8": (array_symdiff([3,"a",null], ["A",7,missing], [3,2,"a",1])),
+  "t9": (array_symdiff([3,5,1], missing, [2,5,1])),
+  "t10": (array_symdiff([3,5,1], null, [2,5,1])),
+  "t11": (array_symdiff([3,5,1], "non_array", [2,5,1])),
+  "t12": (array_symdiff(missing, "non_array", [2,5,1])),
+  "t13": (array_symdiff([], [], [])),
+  "t14": (array_symdiff([2], [3,2], []))
+};
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/9a987680/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/array_fun/array_symdiff/array_symdiff.4.query.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/array_fun/array_symdiff/array_symdiff.4.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/array_fun/array_symdiff/array_symdiff.4.query.sqlpp
new file mode 100755
index 0000000..15636a5
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/array_fun/array_symdiff/array_symdiff.4.query.sqlpp
@@ -0,0 +1,27 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/*
+* Description  : Testing different input list types
+* Expected Res : Error due to processing different list types
+*/
+
+use TinySocial;
+
+select array_symdiff([3,5,1], [2,1], {{3, 1}});
\ No newline at end of file