You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@asterixdb.apache.org by ti...@apache.org on 2016/01/11 17:20:51 UTC
[6/6] incubator-asterixdb git commit: ASTERIXDB-1187,
ASTERIXDB-1162 and ASTERIXDB-1252 fixes, plus new internal functions
ASTERIXDB-1187, ASTERIXDB-1162 and ASTERIXDB-1252 fixes, plus new internal functions
This change contains the following updates and fixes:
- New deep-equality function which also handles numeric equality,
e.g., [2.0, 2, 1.0] == [2, 2, 1].
- New internal functions for record manipulation, including add and remove fields from records
- Fixes for ASTERIXDB-1187: The RecordMergeDescriptor does not fully support
open record merge. Merging records with open fields results in "NullPointerException".
- Fixes to address issue ASTERIXDB-1162: dealing with closed or partly closed record
added to an open record field.
- Fixes issue ASTERIXDB-1252: Problems with Autogenerated Key
Change-Id: I3621ebdd71c7cd91b50d77a972ad863cea7fcbc2
Reviewed-on: https://asterix-gerrit.ics.uci.edu/298
Tested-by: Jenkins <je...@fulliautomatix.ics.uci.edu>
Reviewed-by: Till Westmann <ti...@apache.org>
Project: http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/commit/4053f390
Tree: http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/tree/4053f390
Diff: http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/diff/4053f390
Branch: refs/heads/master
Commit: 4053f390af30d7d8cbf906fd874291a28a1b1c0b
Parents: 633acc4
Author: Heri Ramampiaro <he...@gmail.com>
Authored: Mon Jan 11 00:21:39 2016 +0100
Committer: Till Westmann <ti...@apache.org>
Committed: Mon Jan 11 08:16:05 2016 -0800
----------------------------------------------------------------------
.../comparison/deep_equal/DeepEqualQueries.xml | 28 +
.../deep-equal.1.query.aql | 28 +
.../deep-equal.2.query.aql | 19 +
.../deep-equal.3.query.aql | 19 +
.../deep-equal.4.query.aql | 19 +
.../deep-equal.5.query.aql | 19 +
.../open-records-example/deep-equal.1.ddl.aql | 45 ++
.../deep-equal.2.update.aql | 38 ++
.../open-records-example/deep-equal.3.query.aql | 22 +
.../queries/records/RecordsQueries.xml | 46 ++
.../documentation-example.1.query.aql | 28 +
.../documentation-example.2.query.aql | 28 +
.../documentation-example.3.query.aql | 28 +
.../highly-nested-open.1.ddl.aql | 72 ++
.../highly-nested-open.2.update.aql | 27 +
.../highly-nested-open.3.query.aql | 30 +
.../tiny-social-example.1.ddl.aql | 68 ++
.../tiny-social-example.2.ddl.aql | 43 ++
.../tiny-social-example.3.update.aql | 36 +
.../tiny-social-example.4.query.aql | 30 +
.../documentation-example.1.query.aql | 28 +
.../documentation-example.2.query.aql | 32 +
.../documentation-example.3.query.aql | 32 +
.../highly-nested-open.1.ddl.aql | 72 ++
.../highly-nested-open.2.update.aql | 27 +
.../highly-nested-open.3.query.aql | 30 +
.../tiny-social-example.1.ddl.aql | 67 ++
.../tiny-social-example.2.ddl.aql | 42 ++
.../tiny-social-example.3.update.aql | 36 +
.../tiny-social-example.4.query.aql | 30 +
.../documentation-example.1.query.aql | 28 +
.../documentation-example.2.query.aql | 28 +
.../documentation-example.3.query.aql | 28 +
.../highly-nested-open.1.ddl.aql | 72 ++
.../highly-nested-open.2.update.aql | 27 +
.../highly-nested-open.3.query.aql | 29 +
.../tiny-social-example.1.ddl.aql | 67 ++
.../tiny-social-example.2.ddl.aql | 42 ++
.../tiny-social-example.3.update.aql | 36 +
.../tiny-social-example.4.query.aql | 29 +
.../documentation-example.1.adm | 1 +
.../documentation-example.2.adm | 1 +
.../documentation-example.3.adm | 1 +
.../documentation-example.4.adm | 1 +
.../documentation-example.5.adm | 1 +
.../open-records-example.3.adm | 1 +
.../documentation-example.1.adm | 1 +
.../documentation-example.2.adm | 1 +
.../documentation-example.3.adm | 1 +
.../highly-nested-open/highly-nested-open.3.adm | 4 +
.../tiny-social-example.4.adm | 10 +
.../documentation-example.1.adm | 1 +
.../documentation-example.2.adm | 1 +
.../documentation-example.3.adm | 1 +
.../highly-nested-open/highly-nested-open.3.adm | 4 +
.../tiny-social-example.4.adm | 180 +++++
.../documentation-example.1.adm | 1 +
.../documentation-example.2.adm | 1 +
.../documentation-example.3.adm | 1 +
.../highly-nested-open/highly-nested-open.3.adm | 4 +
.../tiny-social-example.4.adm | 12 +
.../src/test/resources/runtimets/testsuite.xml | 8 +-
asterix-doc/src/site/markdown/aql/functions.md | 679 +++++++++++--------
.../asterix/builders/IARecordBuilder.java | 2 +-
.../AqlSerializerDeserializerProvider.java | 10 +-
.../om/functions/AsterixBuiltinFunctions.java | 31 +-
.../pointables/ARecordVisitablePointable.java | 10 +-
.../om/pointables/cast/ARecordCaster.java | 16 +-
.../impl/RecordAddFieldsTypeComputer.java | 185 +++++
.../impl/RecordMergeTypeComputer.java | 84 ++-
.../impl/RecordRemoveFieldsTypeComputer.java | 328 +++++++++
.../om/typecomputer/impl/TypeComputerUtils.java | 75 ++
.../om/types/hierachy/ATypeHierarchy.java | 18 +-
.../comparisons/DeepEqualAssessor.java | 83 +++
.../functions/DeepEqualityDescriptor.java | 113 +++
.../evaluators/functions/PointableHelper.java | 129 ++++
.../records/RecordAddFieldsDescriptor.java | 287 ++++++++
.../records/RecordMergeDescriptor.java | 125 ++--
.../records/RecordRemoveFieldsDescriptor.java | 68 ++
.../records/RecordRemoveFieldsEvalFactory.java | 235 +++++++
.../visitors/DeepEqualityVisitor.java | 114 ++++
.../visitors/DeepEqualityVisitorHelper.java | 59 ++
.../visitors/ListDeepEqualityChecker.java | 142 ++++
.../visitors/RecordDeepEqualityChecker.java | 112 +++
.../runtime/formats/NonTaggedDataFormat.java | 141 ++--
85 files changed, 4220 insertions(+), 518 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/4053f390/asterix-app/src/test/resources/runtimets/queries/comparison/deep_equal/DeepEqualQueries.xml
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/comparison/deep_equal/DeepEqualQueries.xml b/asterix-app/src/test/resources/runtimets/queries/comparison/deep_equal/DeepEqualQueries.xml
new file mode 100644
index 0000000..83d0061
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/comparison/deep_equal/DeepEqualQueries.xml
@@ -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.
+ !-->
+ <test-case FilePath="comparison/deep_equal">
+ <compilation-unit name="documentation-example">
+ <output-dir compare="Text">documentation-example</output-dir>
+ </compilation-unit>
+ </test-case>
+ <test-case FilePath="comparison/deep_equal">
+ <compilation-unit name="open-records-example">
+ <output-dir compare="Text">open-records-example</output-dir>
+ </compilation-unit>
+ </test-case>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/4053f390/asterix-app/src/test/resources/runtimets/queries/comparison/deep_equal/documentation-example/deep-equal.1.query.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/comparison/deep_equal/documentation-example/deep-equal.1.query.aql b/asterix-app/src/test/resources/runtimets/queries/comparison/deep_equal/documentation-example/deep-equal.1.query.aql
new file mode 100644
index 0000000..85e24c3
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/comparison/deep_equal/documentation-example/deep-equal.1.query.aql
@@ -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.
+ */
+let $r1 := {"id":1,
+ "project":"AsterixDB",
+ "address":{"city":"Irvine", "state":"CA"},
+ "related":["Hivestrix", "Preglix", "Apache VXQuery"] }
+
+let $r2 := {"id":1,
+ "project":"AsterixDB",
+ "address":{"city":"Irvine", "state":"CA"},
+ "related":["Hivestrix", "Preglix", "Apache VXQuery"] }
+return deep-equal($r1, $r2)
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/4053f390/asterix-app/src/test/resources/runtimets/queries/comparison/deep_equal/documentation-example/deep-equal.2.query.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/comparison/deep_equal/documentation-example/deep-equal.2.query.aql b/asterix-app/src/test/resources/runtimets/queries/comparison/deep_equal/documentation-example/deep-equal.2.query.aql
new file mode 100644
index 0000000..d41702e
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/comparison/deep_equal/documentation-example/deep-equal.2.query.aql
@@ -0,0 +1,19 @@
+/*
+ * 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.
+ */
+ deep-equal(["Hivestrix", "Preglix", "Apache VXQuery"], ["Hivestrix", "Preglix", "Apache VXQuery"]);
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/4053f390/asterix-app/src/test/resources/runtimets/queries/comparison/deep_equal/documentation-example/deep-equal.3.query.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/comparison/deep_equal/documentation-example/deep-equal.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/comparison/deep_equal/documentation-example/deep-equal.3.query.aql
new file mode 100644
index 0000000..7279b64
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/comparison/deep_equal/documentation-example/deep-equal.3.query.aql
@@ -0,0 +1,19 @@
+/*
+ * 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.
+ */
+deep-equal({{{"s":"Hivestrix", "v":"0.1.0"}, "Preglix", "Apache VXQuery"}}, {{ "Apache VXQuery",{"s":"Hivestrix", "v":"0.1.0"}, "Preglix"}});
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/4053f390/asterix-app/src/test/resources/runtimets/queries/comparison/deep_equal/documentation-example/deep-equal.4.query.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/comparison/deep_equal/documentation-example/deep-equal.4.query.aql b/asterix-app/src/test/resources/runtimets/queries/comparison/deep_equal/documentation-example/deep-equal.4.query.aql
new file mode 100644
index 0000000..333c9d6
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/comparison/deep_equal/documentation-example/deep-equal.4.query.aql
@@ -0,0 +1,19 @@
+/*
+ * 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.
+ */
+deep-equal("test","test");
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/4053f390/asterix-app/src/test/resources/runtimets/queries/comparison/deep_equal/documentation-example/deep-equal.5.query.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/comparison/deep_equal/documentation-example/deep-equal.5.query.aql b/asterix-app/src/test/resources/runtimets/queries/comparison/deep_equal/documentation-example/deep-equal.5.query.aql
new file mode 100644
index 0000000..06fa4cd
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/comparison/deep_equal/documentation-example/deep-equal.5.query.aql
@@ -0,0 +1,19 @@
+/*
+ * 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.
+ */
+deep-equal([1,2.0,3],[1,2,3.0]);
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/4053f390/asterix-app/src/test/resources/runtimets/queries/comparison/deep_equal/open-records-example/deep-equal.1.ddl.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/comparison/deep_equal/open-records-example/deep-equal.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/comparison/deep_equal/open-records-example/deep-equal.1.ddl.aql
new file mode 100644
index 0000000..aa26843
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/comparison/deep_equal/open-records-example/deep-equal.1.ddl.aql
@@ -0,0 +1,45 @@
+/*
+ * 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.
+ */
+
+create dataverse feeds if not exists;
+use dataverse feeds;
+
+drop dataset SourceInfo if exists
+drop type SourceType if exists
+create type SourceType as open {
+ id: int32
+}
+
+create dataset SourceInfo(SourceType)
+primary key id;
+
+drop dataset StreamDocuments if exists
+drop type StreamType if exists
+create type StreamType as open {
+ doc_id: string,
+ stream_id: string,
+ title_cleansed: string,
+ body_cleansed: string,
+ dir_name: string,
+ anchor_cleansed: string,
+ language: string,
+ schost: string
+}
+create dataset StreamDocuments(StreamType)
+primary key doc_id;
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/4053f390/asterix-app/src/test/resources/runtimets/queries/comparison/deep_equal/open-records-example/deep-equal.2.update.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/comparison/deep_equal/open-records-example/deep-equal.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/comparison/deep_equal/open-records-example/deep-equal.2.update.aql
new file mode 100644
index 0000000..2867286
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/comparison/deep_equal/open-records-example/deep-equal.2.update.aql
@@ -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.
+ */
+use dataverse feeds;
+insert into dataset StreamDocuments (
+ { "doc_id": "doc3",
+ "stream_id": "3dd",
+ "title_cleansed": "",
+ "body_cleansed": "ccc aharon barak born in Israel jeremy mckinnon",
+ "dir_name": "2010-11-24-00",
+ "anchor_cleansed": "",
+ "language": "EN",
+ "schost": "http...",
+ "name":"social"
+});
+
+insert into dataset SourceInfo (
+{
+"id": 1,
+"name":"social",
+"description":"social media data"
+}
+);
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/4053f390/asterix-app/src/test/resources/runtimets/queries/comparison/deep_equal/open-records-example/deep-equal.3.query.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/comparison/deep_equal/open-records-example/deep-equal.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/comparison/deep_equal/open-records-example/deep-equal.3.query.aql
new file mode 100644
index 0000000..0355e31
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/comparison/deep_equal/open-records-example/deep-equal.3.query.aql
@@ -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 dataverse feeds;
+for $x in dataset StreamDocuments
+for $extra in dataset SourceInfo
+return deep-equal($x,$extra);
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/4053f390/asterix-app/src/test/resources/runtimets/queries/records/RecordsQueries.xml
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/records/RecordsQueries.xml b/asterix-app/src/test/resources/runtimets/queries/records/RecordsQueries.xml
index 93a3a99..283120f 100644
--- a/asterix-app/src/test/resources/runtimets/queries/records/RecordsQueries.xml
+++ b/asterix-app/src/test/resources/runtimets/queries/records/RecordsQueries.xml
@@ -129,3 +129,49 @@
<expected-error>org.apache.asterix.common.exceptions.AsterixException</expected-error>
</compilation-unit>
</test-case>
+ <!-- RECORD MANIPULATION TESTS -->
+ <test-case FilePath="records/record-merge">
+ <compilation-unit name="documentation-example">
+ <output-dir compare="Text">documentation-example</output-dir>
+ </compilation-unit>
+ </test-case>
+ <test-case FilePath="records/record-merge">
+ <compilation-unit name="tiny-social-example-only-records">
+ <output-dir compare="Text">tiny-social-example-only-records</output-dir>
+ </compilation-unit>
+ </test-case>
+ <test-case FilePath="records/record-merge">
+ <compilation-unit name="highly-nested-open">
+ <output-dir compare="Text">highly-nested-open</output-dir>
+ </compilation-unit>
+ </test-case>
+ <test-case FilePath="records/record-add-fields">
+ <compilation-unit name="documentation-example">
+ <output-dir compare="Text">documentation-example</output-dir>
+ </compilation-unit>
+ </test-case>
+ <test-case FilePath="records/record-add-fields">
+ <compilation-unit name="tiny-social-example-only-records">
+ <output-dir compare="Text">tiny-social-example-only-records</output-dir>
+ </compilation-unit>
+ </test-case>
+ <test-case FilePath="records/record-add-fields">
+ <compilation-unit name="highly-nested-open">
+ <output-dir compare="Text">highly-nested-open</output-dir>
+ </compilation-unit>
+ </test-case>
+ <test-case FilePath="records/record-remove-fields">
+ <compilation-unit name="documentation-example">
+ <output-dir compare="Text">documentation-example</output-dir>
+ </compilation-unit>
+ </test-case>
+ <test-case FilePath="records/record-remove-fields">
+ <compilation-unit name="tiny-social-example-only-records">
+ <output-dir compare="Text">tiny-social-example-only-records</output-dir>
+ </compilation-unit>
+ </test-case>
+ <test-case FilePath="records/record-remove-fields">
+ <compilation-unit name="highly-nested-open">
+ <output-dir compare="Text">highly-nested-open</output-dir>
+ </compilation-unit>
+ </test-case>
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/4053f390/asterix-app/src/test/resources/runtimets/queries/records/record-add-fields/documentation-example/documentation-example.1.query.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/records/record-add-fields/documentation-example/documentation-example.1.query.aql b/asterix-app/src/test/resources/runtimets/queries/records/record-add-fields/documentation-example/documentation-example.1.query.aql
new file mode 100644
index 0000000..5e76429
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/records/record-add-fields/documentation-example/documentation-example.1.query.aql
@@ -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 : Testing record-add-fields under different queries.
+* Expected Res : Success
+* Date : 04 Aug 2015
+*/
+ let $r1 := {"id":1,
+ "project":"AsterixDB",
+ "address":{"city":"Irvine", "state":"CA"},
+ "related":["Hivestrix", "Preglix", "Apache VXQuery"] }
+ return record-add-fields($r1, [{"field-name":"employment-location", "field-value":create-point(30.0,70.0)}])
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/4053f390/asterix-app/src/test/resources/runtimets/queries/records/record-add-fields/documentation-example/documentation-example.2.query.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/records/record-add-fields/documentation-example/documentation-example.2.query.aql b/asterix-app/src/test/resources/runtimets/queries/records/record-add-fields/documentation-example/documentation-example.2.query.aql
new file mode 100644
index 0000000..856aed2
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/records/record-add-fields/documentation-example/documentation-example.2.query.aql
@@ -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 : Testing record-add-fields under different queries.
+* Expected Res : Success
+* Date : 04 Aug 2015
+*/
+ let $r1 := {"id":1,
+ "project":"AsterixDB",
+ "address":{"city":"Irvine", "state":"CA"},
+ "related":["Hivestrix", "Preglix", "Apache VXQuery"] }
+ return record-add-fields($r1, [{"field-name":"employment-type", "field-value":"visitor"}])
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/4053f390/asterix-app/src/test/resources/runtimets/queries/records/record-add-fields/documentation-example/documentation-example.3.query.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/records/record-add-fields/documentation-example/documentation-example.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/records/record-add-fields/documentation-example/documentation-example.3.query.aql
new file mode 100644
index 0000000..aad677b
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/records/record-add-fields/documentation-example/documentation-example.3.query.aql
@@ -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 : Testing record-add-fields under different queries.
+* Expected Res : Success
+* Date : 04 Aug 2015
+*/
+ let $r1 := {"id":1,
+ "project":"AsterixDB",
+ "address":{"city":"Irvine", "state":"CA"},
+ "related":["Hivestrix", "Preglix", "Apache VXQuery"] }
+ return record-add-fields($r1, [{"field-name":"employment-years", "field-value":2}])
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/4053f390/asterix-app/src/test/resources/runtimets/queries/records/record-add-fields/highly-nested-open/highly-nested-open.1.ddl.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/records/record-add-fields/highly-nested-open/highly-nested-open.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/records/record-add-fields/highly-nested-open/highly-nested-open.1.ddl.aql
new file mode 100644
index 0000000..94556f0
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/records/record-add-fields/highly-nested-open/highly-nested-open.1.ddl.aql
@@ -0,0 +1,72 @@
+/*
+ * 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 record-add-fields under different queries.
+* Expected Res : Success
+* Date : 04 Aug 2015
+*/
+drop dataverse test if exists;
+create dataverse test;
+
+use dataverse test;
+
+create type S as open{
+ id: int64
+}
+
+create type GS as open{
+ id: int64,
+ Genus: string
+}
+
+create type FGS as open{
+ id: int64,
+ Family: string
+}
+
+create type OFGS as open{
+ id: int64,
+ Order: string
+}
+
+create type COFGS as open{
+ id: int64,
+ Class: string
+}
+
+create type PCOFGS as open{
+ id: int64,
+ Phylum: string
+}
+
+create type KPCOFGS as open{
+ id: int64,
+ Kingdom: string
+}
+
+create type Classification as open{
+ id: int64
+}
+
+create type Animal as open{
+ id: int64
+}
+
+create dataset Animals(Animal)
+primary key id;
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/4053f390/asterix-app/src/test/resources/runtimets/queries/records/record-add-fields/highly-nested-open/highly-nested-open.2.update.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/records/record-add-fields/highly-nested-open/highly-nested-open.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/records/record-add-fields/highly-nested-open/highly-nested-open.2.update.aql
new file mode 100644
index 0000000..cab8eb7
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/records/record-add-fields/highly-nested-open/highly-nested-open.2.update.aql
@@ -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 record-add-fields under different queries.
+* Expected Res : Success
+* Date : 04 Aug 2015
+*/
+use dataverse test;
+
+load dataset Animals using localfs
+(("path"="asterix_nc1://data/classifications/animals.adm"),("format"="adm"));
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/4053f390/asterix-app/src/test/resources/runtimets/queries/records/record-add-fields/highly-nested-open/highly-nested-open.3.query.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/records/record-add-fields/highly-nested-open/highly-nested-open.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/records/record-add-fields/highly-nested-open/highly-nested-open.3.query.aql
new file mode 100644
index 0000000..fb937e4
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/records/record-add-fields/highly-nested-open/highly-nested-open.3.query.aql
@@ -0,0 +1,30 @@
+/*
+ * 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 record-add-fields under different queries.
+* Expected Res : Success
+* Date : 04 Aug 2015
+*/
+use dataverse test;
+
+let $rec:=[{"field-name":"animal-info", "field-value":"Test information"}]
+for $test in dataset Animals
+let $result := record-add-fields($test, $rec)
+order by $result.id
+return $result;
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/4053f390/asterix-app/src/test/resources/runtimets/queries/records/record-add-fields/tiny-social-example/tiny-social-example.1.ddl.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/records/record-add-fields/tiny-social-example/tiny-social-example.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/records/record-add-fields/tiny-social-example/tiny-social-example.1.ddl.aql
new file mode 100644
index 0000000..5aedc05
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/records/record-add-fields/tiny-social-example/tiny-social-example.1.ddl.aql
@@ -0,0 +1,68 @@
+/*
+ * 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 record-add-fields under different queries.
+* Expected Res : Success
+* Date : 04 Aug 2015
+*/
+
+drop dataverse TinySocial if exists;
+create dataverse TinySocial;
+use dataverse TinySocial;
+
+create type TwitterUserType as open {
+ screen-name: string,
+ lang: string,
+ friends_count: int64,
+ statuses_count: int64,
+ name: string,
+ followers_count: int64
+}
+
+create type TweetMessageType as closed {
+ tweetid: string,
+ user: TwitterUserType,
+ sender-location: point?,
+ send-time: datetime,
+ referred-topics: {{ string }},
+ message-text: string
+}
+
+create type EmploymentType as open {
+ organization-name: string,
+ start-date: date,
+ end-date: date?
+}
+
+create type FacebookUserType as closed {
+ id: int64,
+ alias: string,
+ name: string,
+ user-since: datetime,
+ friend-ids: {{ int64 }},
+ employment: [EmploymentType]
+}
+
+create type FacebookMessageType as closed {
+ message-id: int64,
+ author-id: int64,
+ in-response-to: int64?,
+ sender-location: point?,
+ message: string
+}
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/4053f390/asterix-app/src/test/resources/runtimets/queries/records/record-add-fields/tiny-social-example/tiny-social-example.2.ddl.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/records/record-add-fields/tiny-social-example/tiny-social-example.2.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/records/record-add-fields/tiny-social-example/tiny-social-example.2.ddl.aql
new file mode 100644
index 0000000..c47f048
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/records/record-add-fields/tiny-social-example/tiny-social-example.2.ddl.aql
@@ -0,0 +1,43 @@
+/*
+ * 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 record-add-fields under different queries.
+* Expected Res : Success
+* Date : 04 Aug 2015
+*/
+
+use dataverse TinySocial;
+
+create dataset FacebookUsers(FacebookUserType)
+primary key id;
+
+create dataset FacebookMessages(FacebookMessageType)
+primary key message-id;
+
+create dataset TwitterUsers(TwitterUserType)
+primary key screen-name;
+
+create dataset TweetMessages(TweetMessageType)
+primary key tweetid
+hints(cardinality=100);
+
+create index fbUserSinceIdx on FacebookUsers(user-since);
+create index fbAuthorIdx on FacebookMessages(author-id) type btree;
+create index fbSenderLocIndex on FacebookMessages(sender-location) type rtree;
+create index fbMessageIdx on FacebookMessages(message) type keyword;
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/4053f390/asterix-app/src/test/resources/runtimets/queries/records/record-add-fields/tiny-social-example/tiny-social-example.3.update.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/records/record-add-fields/tiny-social-example/tiny-social-example.3.update.aql b/asterix-app/src/test/resources/runtimets/queries/records/record-add-fields/tiny-social-example/tiny-social-example.3.update.aql
new file mode 100644
index 0000000..80f1615
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/records/record-add-fields/tiny-social-example/tiny-social-example.3.update.aql
@@ -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.
+ */
+/*
+* Description : Testing record-add-fields under different queries.
+* Expected Res : Success
+* Date : 04 Aug 2015
+*/
+use dataverse TinySocial;
+
+load dataset FacebookUsers using localfs
+(("path"="nc1://data/tinysocial/fbu.adm"),("format"="adm"));
+
+load dataset FacebookMessages using localfs
+(("path"="nc1://data/tinysocial/fbm.adm"),("format"="adm"));
+
+load dataset TwitterUsers using localfs
+(("path"="nc1://data/tinysocial/twu.adm"),("format"="adm"));
+
+load dataset TweetMessages using localfs
+(("path"="nc1://data/tinysocial/twm.adm"),("format"="adm"));
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/4053f390/asterix-app/src/test/resources/runtimets/queries/records/record-add-fields/tiny-social-example/tiny-social-example.4.query.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/records/record-add-fields/tiny-social-example/tiny-social-example.4.query.aql b/asterix-app/src/test/resources/runtimets/queries/records/record-add-fields/tiny-social-example/tiny-social-example.4.query.aql
new file mode 100644
index 0000000..ec7c77d
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/records/record-add-fields/tiny-social-example/tiny-social-example.4.query.aql
@@ -0,0 +1,30 @@
+/*
+ * 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 record-add-fields under different queries.
+* Expected Res : Success
+* Date : 04 Aug 2015
+*/
+use dataverse TinySocial;
+
+for $r in dataset TweetMessages
+for $f in dataset FacebookMessages
+let $result := record-add-fields($r, [{"field-name":"fb-author-id", "field-value":$f.author-id}])
+order by $result
+return $result
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/4053f390/asterix-app/src/test/resources/runtimets/queries/records/record-merge/documentation-example/documentation-example.1.query.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/records/record-merge/documentation-example/documentation-example.1.query.aql b/asterix-app/src/test/resources/runtimets/queries/records/record-merge/documentation-example/documentation-example.1.query.aql
new file mode 100644
index 0000000..7abb690
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/records/record-merge/documentation-example/documentation-example.1.query.aql
@@ -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 : record-merge under different queries.
+* Expected Res : Success
+* Date : 04 Aug 2015
+*/
+let $r1 := {"id":1, "project":"AsterixDB",
+"address":{"city":"Irvine", "state":"CA"}, "related":["Hivestrix", "Preglix", "Apache VXQuery"]}
+let $r2 := {"user_id": 22, "employer": "UC Irvine", "employment-type": "visitor" }
+let $result := record-merge($r1, $r2)
+return $result
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/4053f390/asterix-app/src/test/resources/runtimets/queries/records/record-merge/documentation-example/documentation-example.2.query.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/records/record-merge/documentation-example/documentation-example.2.query.aql b/asterix-app/src/test/resources/runtimets/queries/records/record-merge/documentation-example/documentation-example.2.query.aql
new file mode 100644
index 0000000..137cdfb
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/records/record-merge/documentation-example/documentation-example.2.query.aql
@@ -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.
+ */
+/*
+* Description : record-merge under different queries.
+* Expected Res : Success
+* Date : 04 Aug 2015
+*/
+ let $r1 := {"id":1,
+ "project":"AsterixDB",
+ "address":{"city":"Irvine", "state":"CA"},
+ "related":["Hivestrix", "Preglix", "Apache VXQuery"] }
+
+ let $r2 := {"user_id": 22,
+ "employer": "UC Irvine",
+ "employment-location": create-point(30.0,70.0) }
+ return record-merge($r1, $r2)
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/4053f390/asterix-app/src/test/resources/runtimets/queries/records/record-merge/documentation-example/documentation-example.3.query.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/records/record-merge/documentation-example/documentation-example.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/records/record-merge/documentation-example/documentation-example.3.query.aql
new file mode 100644
index 0000000..92ee00f
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/records/record-merge/documentation-example/documentation-example.3.query.aql
@@ -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.
+ */
+/*
+* Description : record-merge under different queries.
+* Expected Res : Success
+* Date : 04 Aug 2015
+*/
+ let $r1 := {"id":1,
+ "project":"AsterixDB",
+ "address":{"city":"Irvine", "state":"CA"},
+ "related":["Hivestrix", "Preglix", "Apache VXQuery"] }
+
+ let $r2 := {"user_id": 22,
+ "employer": "UC Irvine",
+ "address":{"city":"Irvine", "state":"CA"} }
+ return record-merge($r1, $r2)
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/4053f390/asterix-app/src/test/resources/runtimets/queries/records/record-merge/highly-nested-open/highly-nested-open.1.ddl.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/records/record-merge/highly-nested-open/highly-nested-open.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/records/record-merge/highly-nested-open/highly-nested-open.1.ddl.aql
new file mode 100644
index 0000000..d4af896
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/records/record-merge/highly-nested-open/highly-nested-open.1.ddl.aql
@@ -0,0 +1,72 @@
+/*
+ * 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 record-merge under different queries.
+* Expected Res : Success
+* Date : 04 Aug 2015
+*/
+drop dataverse test if exists;
+create dataverse test;
+
+use dataverse test;
+
+create type S as open{
+ id: int64
+}
+
+create type GS as open{
+ id: int64,
+ Genus: string
+}
+
+create type FGS as open{
+ id: int64,
+ Family: string
+}
+
+create type OFGS as open{
+ id: int64,
+ Order: string
+}
+
+create type COFGS as open{
+ id: int64,
+ Class: string
+}
+
+create type PCOFGS as open{
+ id: int64,
+ Phylum: string
+}
+
+create type KPCOFGS as open{
+ id: int64,
+ Kingdom: string
+}
+
+create type Classification as open{
+ id: int64
+}
+
+create type Animal as open{
+ id: int64
+}
+
+create dataset Animals(Animal)
+primary key id;
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/4053f390/asterix-app/src/test/resources/runtimets/queries/records/record-merge/highly-nested-open/highly-nested-open.2.update.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/records/record-merge/highly-nested-open/highly-nested-open.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/records/record-merge/highly-nested-open/highly-nested-open.2.update.aql
new file mode 100644
index 0000000..7db2401
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/records/record-merge/highly-nested-open/highly-nested-open.2.update.aql
@@ -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 record-merge under different queries.
+* Expected Res : Success
+* Date : 04 Aug 2015
+*/
+use dataverse test;
+
+load dataset Animals using localfs
+(("path"="asterix_nc1://data/classifications/animals.adm"),("format"="adm"));
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/4053f390/asterix-app/src/test/resources/runtimets/queries/records/record-merge/highly-nested-open/highly-nested-open.3.query.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/records/record-merge/highly-nested-open/highly-nested-open.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/records/record-merge/highly-nested-open/highly-nested-open.3.query.aql
new file mode 100644
index 0000000..70a3ad5
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/records/record-merge/highly-nested-open/highly-nested-open.3.query.aql
@@ -0,0 +1,30 @@
+/*
+ * 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 record-merge under different queries.
+* Expected Res : Success
+* Date : 04 Aug 2015
+*/
+use dataverse test;
+
+let $rec:={"animal-info": "Test information"}
+for $test in dataset Animals
+let $result := record-merge($test, $rec)
+order by $result.id
+return $result;
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/4053f390/asterix-app/src/test/resources/runtimets/queries/records/record-merge/tiny-social-example/tiny-social-example.1.ddl.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/records/record-merge/tiny-social-example/tiny-social-example.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/records/record-merge/tiny-social-example/tiny-social-example.1.ddl.aql
new file mode 100644
index 0000000..fbc09c9
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/records/record-merge/tiny-social-example/tiny-social-example.1.ddl.aql
@@ -0,0 +1,67 @@
+/*
+ * 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 record-merge under different queries.
+* Expected Res : Success
+* Date : 04 Aug 2015
+*/
+drop dataverse TinySocial if exists;
+create dataverse TinySocial;
+use dataverse TinySocial;
+
+create type TwitterUserType as open {
+ screen-name: string,
+ lang: string,
+ friends_count: int64,
+ statuses_count: int64,
+ name: string,
+ followers_count: int64
+}
+
+create type TweetMessageType as closed {
+ tweetid: string,
+ user: TwitterUserType,
+ sender-location: point?,
+ send-time: datetime,
+ referred-topics: {{ string }},
+ message-text: string
+}
+
+create type EmploymentType as open {
+ organization-name: string,
+ start-date: date,
+ end-date: date?
+}
+
+create type FacebookUserType as closed {
+ id: int64,
+ alias: string,
+ name: string,
+ user-since: datetime,
+ friend-ids: {{ int64 }},
+ employment: [EmploymentType]
+}
+
+create type FacebookMessageType as closed {
+ message-id: int64,
+ author-id: int64,
+ in-response-to: int64?,
+ sender-location: point?,
+ message: string
+}
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/4053f390/asterix-app/src/test/resources/runtimets/queries/records/record-merge/tiny-social-example/tiny-social-example.2.ddl.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/records/record-merge/tiny-social-example/tiny-social-example.2.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/records/record-merge/tiny-social-example/tiny-social-example.2.ddl.aql
new file mode 100644
index 0000000..97ee993
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/records/record-merge/tiny-social-example/tiny-social-example.2.ddl.aql
@@ -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 : Testing record-merge under different queries.
+* Expected Res : Success
+* Date : 04 Aug 2015
+*/
+use dataverse TinySocial;
+
+create dataset FacebookUsers(FacebookUserType)
+primary key id;
+
+create dataset FacebookMessages(FacebookMessageType)
+primary key message-id;
+
+create dataset TwitterUsers(TwitterUserType)
+primary key screen-name;
+
+create dataset TweetMessages(TweetMessageType)
+primary key tweetid
+hints(cardinality=100);
+
+create index fbUserSinceIdx on FacebookUsers(user-since);
+create index fbAuthorIdx on FacebookMessages(author-id) type btree;
+create index fbSenderLocIndex on FacebookMessages(sender-location) type rtree;
+create index fbMessageIdx on FacebookMessages(message) type keyword;
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/4053f390/asterix-app/src/test/resources/runtimets/queries/records/record-merge/tiny-social-example/tiny-social-example.3.update.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/records/record-merge/tiny-social-example/tiny-social-example.3.update.aql b/asterix-app/src/test/resources/runtimets/queries/records/record-merge/tiny-social-example/tiny-social-example.3.update.aql
new file mode 100644
index 0000000..5bc4f5c
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/records/record-merge/tiny-social-example/tiny-social-example.3.update.aql
@@ -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.
+ */
+/*
+* Description : Testing record-merge under different queries.
+* Expected Res : Success
+* Date : 04 Aug 2015
+*/
+use dataverse TinySocial;
+
+load dataset FacebookUsers using localfs
+(("path"="nc1://data/tinysocial/fbu.adm"),("format"="adm"));
+
+load dataset FacebookMessages using localfs
+(("path"="nc1://data/tinysocial/fbm.adm"),("format"="adm"));
+
+load dataset TwitterUsers using localfs
+(("path"="nc1://data/tinysocial/twu.adm"),("format"="adm"));
+
+load dataset TweetMessages using localfs
+(("path"="nc1://data/tinysocial/twm.adm"),("format"="adm"));
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/4053f390/asterix-app/src/test/resources/runtimets/queries/records/record-merge/tiny-social-example/tiny-social-example.4.query.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/records/record-merge/tiny-social-example/tiny-social-example.4.query.aql b/asterix-app/src/test/resources/runtimets/queries/records/record-merge/tiny-social-example/tiny-social-example.4.query.aql
new file mode 100644
index 0000000..8601155
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/records/record-merge/tiny-social-example/tiny-social-example.4.query.aql
@@ -0,0 +1,30 @@
+/*
+ * 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 record-merge under different queries.
+* Expected Res : Success
+* Date : 04 Aug 2015
+*/
+use dataverse TinySocial;
+
+for $r in dataset TweetMessages
+for $f in dataset FacebookMessages
+let $result := record-merge($r, $f)
+order by $result
+return $result
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/4053f390/asterix-app/src/test/resources/runtimets/queries/records/record-remove-fields/documentation-example/documentation-example.1.query.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/records/record-remove-fields/documentation-example/documentation-example.1.query.aql b/asterix-app/src/test/resources/runtimets/queries/records/record-remove-fields/documentation-example/documentation-example.1.query.aql
new file mode 100644
index 0000000..9ff79ac
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/records/record-remove-fields/documentation-example/documentation-example.1.query.aql
@@ -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 : record-remove-fields under different queries.
+* Expected Res : Success
+* Date : 04 Aug 2015
+*/
+ let $r1 := {"id":1,
+ "project":"AsterixDB",
+ "address":{"city":"Irvine", "state":"CA"},
+ "related":["Hivestrix", "Preglix", "Apache VXQuery"] }
+ return record-remove-fields($r1, ["project"])
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/4053f390/asterix-app/src/test/resources/runtimets/queries/records/record-remove-fields/documentation-example/documentation-example.2.query.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/records/record-remove-fields/documentation-example/documentation-example.2.query.aql b/asterix-app/src/test/resources/runtimets/queries/records/record-remove-fields/documentation-example/documentation-example.2.query.aql
new file mode 100644
index 0000000..7600912
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/records/record-remove-fields/documentation-example/documentation-example.2.query.aql
@@ -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 : record-remove-fields under different queries.
+* Expected Res : Success
+* Date : 04 Aug 2015
+*/
+ let $r1 := {"id":1,
+ "project":"AsterixDB",
+ "address":{"city":"Irvine", "state":"CA"},
+ "related":["Hivestrix", "Preglix", "Apache VXQuery"] }
+ return record-remove-fields($r1, [["address", "city"]])
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/4053f390/asterix-app/src/test/resources/runtimets/queries/records/record-remove-fields/documentation-example/documentation-example.3.query.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/records/record-remove-fields/documentation-example/documentation-example.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/records/record-remove-fields/documentation-example/documentation-example.3.query.aql
new file mode 100644
index 0000000..9409891
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/records/record-remove-fields/documentation-example/documentation-example.3.query.aql
@@ -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 : record-remove-fields under different queries.
+* Expected Res : Success
+* Date : 04 Aug 2015
+*/
+ let $r1 := {"id":1,
+ "project":"AsterixDB",
+ "address":{"city":"Irvine", "state":"CA"},
+ "related":["Hivestrix", "Preglix", "Apache VXQuery"] }
+ return record-remove-fields($r1, [["address", "state"], ["address", "city"]])
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/4053f390/asterix-app/src/test/resources/runtimets/queries/records/record-remove-fields/highly-nested-open/highly-nested-open.1.ddl.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/records/record-remove-fields/highly-nested-open/highly-nested-open.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/records/record-remove-fields/highly-nested-open/highly-nested-open.1.ddl.aql
new file mode 100644
index 0000000..d850caa
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/records/record-remove-fields/highly-nested-open/highly-nested-open.1.ddl.aql
@@ -0,0 +1,72 @@
+/*
+ * 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 record-remove-fields under different queries.
+* Expected Res : Success
+* Date : 04 Aug 2015
+*/
+drop dataverse test if exists;
+create dataverse test;
+
+use dataverse test;
+
+create type S as open{
+ id: int64
+}
+
+create type GS as open{
+ id: int64,
+ Genus: string
+}
+
+create type FGS as open{
+ id: int64,
+ Family: string
+}
+
+create type OFGS as open{
+ id: int64,
+ Order: string
+}
+
+create type COFGS as open{
+ id: int64,
+ Class: string
+}
+
+create type PCOFGS as open{
+ id: int64,
+ Phylum: string
+}
+
+create type KPCOFGS as open{
+ id: int64,
+ Kingdom: string
+}
+
+create type Classification as open{
+ id: int64
+}
+
+create type Animal as open{
+ id: int64
+}
+
+create dataset Animals(Animal)
+primary key id;
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/4053f390/asterix-app/src/test/resources/runtimets/queries/records/record-remove-fields/highly-nested-open/highly-nested-open.2.update.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/records/record-remove-fields/highly-nested-open/highly-nested-open.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/records/record-remove-fields/highly-nested-open/highly-nested-open.2.update.aql
new file mode 100644
index 0000000..d96edf0
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/records/record-remove-fields/highly-nested-open/highly-nested-open.2.update.aql
@@ -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 record-remove-fields under different queries.
+* Expected Res : Success
+* Date : 04 Aug 2015
+*/
+use dataverse test;
+
+load dataset Animals using localfs
+(("path"="asterix_nc1://data/classifications/animals.adm"),("format"="adm"));
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/4053f390/asterix-app/src/test/resources/runtimets/queries/records/record-remove-fields/highly-nested-open/highly-nested-open.3.query.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/records/record-remove-fields/highly-nested-open/highly-nested-open.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/records/record-remove-fields/highly-nested-open/highly-nested-open.3.query.aql
new file mode 100644
index 0000000..af8c258
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/records/record-remove-fields/highly-nested-open/highly-nested-open.3.query.aql
@@ -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.
+ */
+/*
+* Description : Testing record-remove-fields under different queries.
+* Expected Res : Success
+* Date : 04 Aug 2015
+*/
+use dataverse test;
+
+for $test in dataset Animals
+let $result := record-remove-fields($test, [["class", "fullClassification"]])
+order by $result.id
+return $result;
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/4053f390/asterix-app/src/test/resources/runtimets/queries/records/record-remove-fields/tiny-social-example/tiny-social-example.1.ddl.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/records/record-remove-fields/tiny-social-example/tiny-social-example.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/records/record-remove-fields/tiny-social-example/tiny-social-example.1.ddl.aql
new file mode 100644
index 0000000..6ade854
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/records/record-remove-fields/tiny-social-example/tiny-social-example.1.ddl.aql
@@ -0,0 +1,67 @@
+/*
+ * 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 record-remove-fields under different queries.
+* Expected Res : Success
+* Date : 04 Aug 2015
+*/
+drop dataverse TinySocial if exists;
+create dataverse TinySocial;
+use dataverse TinySocial;
+
+create type TwitterUserType as open {
+ screen-name: string,
+ lang: string,
+ friends_count: int64,
+ statuses_count: int64,
+ name: string,
+ followers_count: int64
+}
+
+create type TweetMessageType as closed {
+ tweetid: string,
+ user: TwitterUserType,
+ sender-location: point?,
+ send-time: datetime,
+ referred-topics: {{ string }},
+ message-text: string
+}
+
+create type EmploymentType as open {
+ organization-name: string,
+ start-date: date,
+ end-date: date?
+}
+
+create type FacebookUserType as closed {
+ id: int64,
+ alias: string,
+ name: string,
+ user-since: datetime,
+ friend-ids: {{ int64 }},
+ employment: [EmploymentType]
+}
+
+create type FacebookMessageType as closed {
+ message-id: int64,
+ author-id: int64,
+ in-response-to: int64?,
+ sender-location: point?,
+ message: string
+}
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/4053f390/asterix-app/src/test/resources/runtimets/queries/records/record-remove-fields/tiny-social-example/tiny-social-example.2.ddl.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/records/record-remove-fields/tiny-social-example/tiny-social-example.2.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/records/record-remove-fields/tiny-social-example/tiny-social-example.2.ddl.aql
new file mode 100644
index 0000000..d9e2569
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/records/record-remove-fields/tiny-social-example/tiny-social-example.2.ddl.aql
@@ -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 : Testing record-remove-fields under different queries.
+* Expected Res : Success
+* Date : 04 Jun 2015
+*/
+use dataverse TinySocial;
+
+create dataset FacebookUsers(FacebookUserType)
+primary key id;
+
+create dataset FacebookMessages(FacebookMessageType)
+primary key message-id;
+
+create dataset TwitterUsers(TwitterUserType)
+primary key screen-name;
+
+create dataset TweetMessages(TweetMessageType)
+primary key tweetid
+hints(cardinality=100);
+
+create index fbUserSinceIdx on FacebookUsers(user-since);
+create index fbAuthorIdx on FacebookMessages(author-id) type btree;
+create index fbSenderLocIndex on FacebookMessages(sender-location) type rtree;
+create index fbMessageIdx on FacebookMessages(message) type keyword;
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/4053f390/asterix-app/src/test/resources/runtimets/queries/records/record-remove-fields/tiny-social-example/tiny-social-example.3.update.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/records/record-remove-fields/tiny-social-example/tiny-social-example.3.update.aql b/asterix-app/src/test/resources/runtimets/queries/records/record-remove-fields/tiny-social-example/tiny-social-example.3.update.aql
new file mode 100644
index 0000000..542b97e
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/records/record-remove-fields/tiny-social-example/tiny-social-example.3.update.aql
@@ -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.
+ */
+/*
+* Description : Testing record-remove-fields under different queries.
+* Expected Res : Success
+* Date : 04 Jun 2015
+*/
+use dataverse TinySocial;
+
+load dataset FacebookUsers using localfs
+(("path"="nc1://data/tinysocial/fbu.adm"),("format"="adm"));
+
+load dataset FacebookMessages using localfs
+(("path"="nc1://data/tinysocial/fbm.adm"),("format"="adm"));
+
+load dataset TwitterUsers using localfs
+(("path"="nc1://data/tinysocial/twu.adm"),("format"="adm"));
+
+load dataset TweetMessages using localfs
+(("path"="nc1://data/tinysocial/twm.adm"),("format"="adm"));