http://git-wip-us.apache.org/repos/asf/asterixdb/blob/10351a74/asterixdb/asterix-app/src/test/resources/runtimets/queries/objects/closed-nullable-fields_issue1616/closed-nullable-fileds_issue1616.1.ddl.aql
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries/objects/closed-nullable-fields_issue1616/closed-nullable-fileds_issue1616.1.ddl.aql
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/objects/closed-nullable-fields_issue1616/closed-nullable-fileds_issue1616.1.ddl.aql
new file mode 100644
index 0000000..fc6fdc9
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/objects/closed-nullable-fields_issue1616/closed-nullable-fileds_issue1616.1.ddl.aql
@@ -0,0 +1,862 @@
+/*
+ * 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  : Fix ArrayOutOfBound and IndexOutOfBound exception
+* Expected Res : Success
+* Issue        : 1334 and 1616
+* Date         : 12th Sept. 2016
+*/
+
+drop dataverse test if exists;
+create dataverse test;
+use dataverse test;
+
+create type userType1 as open {
+    'utc_offset':int64?,
+    'friends_count':int64?,
+    'profile_image_url_https':string?,
+    'listed_count':int64?,
+    'profile_background_image_url':string?,
+    'default_profile_image':boolean?,
+    'favourites_count':int64?,
+    'description':string?,
+    'created_at':string?,
+    'is_translator':boolean?,
+    'profile_background_image_url_https':string?,
+    'protected':boolean?,
+    'screen_name':string?,
+    'id_str':string?,
+    'profile_link_color':string?,
+    'id':int64?,
+    'geo_enabled':boolean?,
+    'profile_background_color':string?,
+    'lang':string?,
+    'profile_sidebar_border_color':string?,
+    'profile_text_color':string?,
+    'verified':boolean?,
+    'profile_image_url':string?,
+    'time_zone':string?,
+    'contributors_enabled':boolean?,
+    'profile_background_tile':boolean?,
+    'profile_banner_url':string?,
+    'statuses_count':int64?,
+    'followers_count':int64?,
+    'profile_use_background_image':boolean?,
+    'default_profile':boolean?,
+    'name':string?,
+    'location':string?,
+    'profile_sidebar_fill_color':string?,
+    'url':string?
+}
+create type smallType1 as open {
+    'w':int64?,
+    'h':int64?,
+    'resize':string?
+}
+create type largeType1 as open {
+    'w':int64?,
+    'h':int64?,
+    'resize':string?
+}
+create type thumbType1 as open {
+    'w':int64?,
+    'h':int64?,
+    'resize':string?
+}
+create type mediumType1 as open {
+    'w':int64?,
+    'h':int64?,
+    'resize':string?
+}
+create type sizesType1 as open {
+    'small':smallType1?,
+    'large':largeType1?,
+    'thumb':thumbType1?,
+    'medium':mediumType1?
+}
+create type listType2 as open {
+    'content_type':string?,
+    'bitrate':int64?,
+    'url':string?
+}
+create type video_infoType1 as open {
+    'aspect_ratio':[int64]?,
+    'duration_millis':int64?,
+    'variants':[listType2]?
+}
+create type listType1 as open {
+    'display_url':string?,
+    'indices':[int64]?,
+    'sizes':sizesType1?,
+    'id_str':string?,
+    'expanded_url':string?,
+    'media_url_https':string?,
+    'id':int64?,
+    'type':string?,
+    'media_url':string?,
+    'url':string?,
+    'video_info':video_infoType1?,
+    'source_user_id':int64?,
+    'source_status_id':int64?,
+    'source_status_id_str':string?,
+    'source_user_id_str':string?
+}
+create type extended_entitiesType1 as open {
+    'media':[listType1]?
+}
+create type smallType2 as open {
+    'w':int64?,
+    'h':int64?,
+    'resize':string?
+}
+create type largeType2 as open {
+    'w':int64?,
+    'h':int64?,
+    'resize':string?
+}
+create type thumbType2 as open {
+    'w':int64?,
+    'h':int64?,
+    'resize':string?
+}
+create type mediumType2 as open {
+    'w':int64?,
+    'h':int64?,
+    'resize':string?
+}
+create type sizesType2 as open {
+    'small':smallType2?,
+    'large':largeType2?,
+    'thumb':thumbType2?,
+    'medium':mediumType2?
+}
+create type listType3 as open {
+    'display_url':string?,
+    'indices':[int64]?,
+    'sizes':sizesType2?,
+    'id_str':string?,
+    'expanded_url':string?,
+    'media_url_https':string?,
+    'id':int64?,
+    'type':string?,
+    'media_url':string?,
+    'url':string?,
+    'source_user_id':int64?,
+    'source_status_id':int64?,
+    'source_status_id_str':string?,
+    'source_user_id_str':string?
+}
+create type listType4 as open {
+    'display_url':string?,
+    'indices':[int64]?,
+    'expanded_url':string?,
+    'url':string?
+}
+create type listType5 as open {
+    'indices':[int64]?,
+    'text':string?
+}
+create type listType6 as open {
+    'indices':[int64]?,
+    'screen_name':string?,
+    'id_str':string?,
+    'name':string?,
+    'id':int64?
+}
+create type entitiesType1 as open {
+    'media':[listType3]?,
+    'urls':[listType4]?,
+    'hashtags':[listType5]?,
+    'user_mentions':[listType6]?
+}
+create type bounding_boxType1 as open {
+    'coordinates':[[[double]]]?,
+    'type':string?
+}
+create type placeType1 as open {
+    'country_code':string?,
+    'country':string?,
+    'full_name':string?,
+    'bounding_box':bounding_boxType1?,
+    'place_type':string?,
+    'name':string?,
+    'id':string?,
+    'url':string?
+}
+create type userType2 as open {
+    'utc_offset':int64?,
+    'friends_count':int64?,
+    'profile_image_url_https':string?,
+    'listed_count':int64?,
+    'profile_background_image_url':string?,
+    'default_profile_image':boolean?,
+    'favourites_count':int64?,
+    'description':string?,
+    'created_at':string?,
+    'is_translator':boolean?,
+    'profile_background_image_url_https':string?,
+    'protected':boolean?,
+    'screen_name':string?,
+    'id_str':string?,
+    'profile_link_color':string?,
+    'id':int64?,
+    'geo_enabled':boolean?,
+    'profile_background_color':string?,
+    'lang':string?,
+    'profile_sidebar_border_color':string?,
+    'profile_text_color':string?,
+    'verified':boolean?,
+    'profile_image_url':string?,
+    'time_zone':string?,
+    'contributors_enabled':boolean?,
+    'profile_background_tile':boolean?,
+    'profile_banner_url':string?,
+    'statuses_count':int64?,
+    'followers_count':int64?,
+    'profile_use_background_image':boolean?,
+    'default_profile':boolean?,
+    'name':string?,
+    'profile_sidebar_fill_color':string?,
+    'location':string?,
+    'url':string?
+}
+create type listType7 as open {
+    'display_url':string?,
+    'indices':[int64]?,
+    'expanded_url':string?,
+    'url':string?
+}
+create type listType8 as open {
+    'indices':[int64]?,
+    'text':string?
+}
+create type listType9 as open {
+    'indices':[int64]?,
+    'screen_name':string?,
+    'id_str':string?,
+    'name':string?,
+    'id':int64?
+}
+create type smallType3 as open {
+    'w':int64?,
+    'h':int64?,
+    'resize':string?
+}
+create type largeType3 as open {
+    'w':int64?,
+    'h':int64?,
+    'resize':string?
+}
+create type thumbType3 as open {
+    'w':int64?,
+    'h':int64?,
+    'resize':string?
+}
+create type mediumType3 as open {
+    'w':int64?,
+    'h':int64?,
+    'resize':string?
+}
+create type sizesType3 as open {
+    'small':smallType3?,
+    'large':largeType3?,
+    'thumb':thumbType3?,
+    'medium':mediumType3?
+}
+create type listType10 as open {
+    'display_url':string?,
+    'indices':[int64]?,
+    'sizes':sizesType3?,
+    'id_str':string?,
+    'expanded_url':string?,
+    'media_url_https':string?,
+    'id':int64?,
+    'type':string?,
+    'media_url':string?,
+    'url':string?,
+    'source_user_id':int64?,
+    'source_status_id':int64?,
+    'source_status_id_str':string?,
+    'source_user_id_str':string?
+}
+create type entitiesType2 as open {
+    'urls':[listType7]?,
+    'hashtags':[listType8]?,
+    'user_mentions':[listType9]?,
+    'media':[listType10]?
+}
+create type smallType4 as open {
+    'w':int64?,
+    'h':int64?,
+    'resize':string?
+}
+create type largeType4 as open {
+    'w':int64?,
+    'h':int64?,
+    'resize':string?
+}
+create type thumbType4 as open {
+    'w':int64?,
+    'h':int64?,
+    'resize':string?
+}
+create type mediumType4 as open {
+    'w':int64?,
+    'h':int64?,
+    'resize':string?
+}
+create type sizesType4 as open {
+    'small':smallType4?,
+    'large':largeType4?,
+    'thumb':thumbType4?,
+    'medium':mediumType4?
+}
+create type listType12 as open {
+    'content_type':string?,
+    'url':string?,
+    'bitrate':int64?
+}
+create type video_infoType2 as open {
+    'aspect_ratio':[int64]?,
+    'duration_millis':int64?,
+    'variants':[listType12]?
+}
+create type listType11 as open {
+    'display_url':string?,
+    'indices':[int64]?,
+    'sizes':sizesType4?,
+    'id_str':string?,
+    'expanded_url':string?,
+    'media_url_https':string?,
+    'id':int64?,
+    'type':string?,
+    'media_url':string?,
+    'url':string?,
+    'source_user_id':int64?,
+    'source_status_id':int64?,
+    'source_status_id_str':string?,
+    'source_user_id_str':string?,
+    'video_info':video_infoType2?
+}
+create type extended_entitiesType2 as open {
+    'media':[listType11]?
+}
+create type bounding_boxType2 as open {
+    'coordinates':[[[double]]]?,
+    'type':string?
+}
+create type placeType2 as open {
+    'country_code':string?,
+    'country':string?,
+    'full_name':string?,
+    'bounding_box':bounding_boxType2?,
+    'place_type':string?,
+    'name':string?,
+    'id':string?,
+    'url':string?
+}
+create type quoted_statusType1 as open {
+    'created_at':string?,
+    'truncated':boolean?,
+    'source':string?,
+    'retweet_count':int64?,
+    'retweeted':boolean?,
+    'filter_level':string?,
+    'is_quote_status':boolean?,
+    'id_str':string?,
+    'favorite_count':int64?,
+    'id':int64?,
+    'text':string?,
+    'lang':string?,
+    'user':userType2?,
+    'favorited':boolean?,
+    'quoted_status_id':int64?,
+    'possibly_sensitive':boolean?,
+    'entities':entitiesType2?,
+    'quoted_status_id_str':string?,
+    'extended_entities':extended_entitiesType2?,
+    'in_reply_to_status_id_str':string?,
+    'in_reply_to_status_id':int64?,
+    'in_reply_to_user_id_str':string?,
+    'in_reply_to_screen_name':string?,
+    'in_reply_to_user_id':int64?,
+    'place':placeType2?
+}
+create type coordinatesType1 as open {
+    'coordinates':[double]?,
+    'type':string?
+}
+create type geoType1 as open {
+    'coordinates':[double]?,
+    'type':string?
+}
+create type scopesType1 as open {
+    'followers':boolean?
+}
+create type retweeted_statusType1 as open {
+    'created_at':string?,
+    'truncated':boolean?,
+    'source':string?,
+    'retweet_count':int64?,
+    'retweeted':boolean?,
+    'filter_level':string?,
+    'is_quote_status':boolean?,
+    'id_str':string?,
+    'favorite_count':int64?,
+    'id':int64?,
+    'text':string?,
+    'lang':string?,
+    'user':userType1?,
+    'favorited':boolean?,
+    'extended_entities':extended_entitiesType1?,
+    'possibly_sensitive':boolean?,
+    'entities':entitiesType1?,
+    'place':placeType1?,
+    'quoted_status':quoted_statusType1?,
+    'quoted_status_id':int64?,
+    'quoted_status_id_str':string?,
+    'in_reply_to_status_id_str':string?,
+    'in_reply_to_status_id':int64?,
+    'in_reply_to_user_id_str':string?,
+    'in_reply_to_screen_name':string?,
+    'in_reply_to_user_id':int64?,
+    'coordinates':coordinatesType1?,
+    'geo':geoType1?,
+    'scopes':scopesType1?
+}
+create type listType13 as open {
+    'indices':[int64]?,
+    'screen_name':string?,
+    'id_str':string?,
+    'name':string?,
+    'id':int64?
+}
+create type smallType5 as open {
+    'w':int64?,
+    'h':int64?,
+    'resize':string?
+}
+create type largeType5 as open {
+    'w':int64?,
+    'h':int64?,
+    'resize':string?
+}
+create type thumbType5 as open {
+    'w':int64?,
+    'h':int64?,
+    'resize':string?
+}
+create type mediumType5 as open {
+    'w':int64?,
+    'h':int64?,
+    'resize':string?
+}
+create type sizesType5 as open {
+    'small':smallType5?,
+    'large':largeType5?,
+    'thumb':thumbType5?,
+    'medium':mediumType5?
+}
+create type listType14 as open {
+    'display_url':string?,
+    'indices':[int64]?,
+    'sizes':sizesType5?,
+    'id_str':string?,
+    'expanded_url':string?,
+    'media_url_https':string?,
+    'id':int64?,
+    'type':string?,
+    'media_url':string?,
+    'url':string?,
+    'source_user_id':int64?,
+    'source_status_id':int64?,
+    'source_status_id_str':string?,
+    'source_user_id_str':string?
+}
+create type listType15 as open {
+    'display_url':string?,
+    'indices':[int64]?,
+    'expanded_url':string?,
+    'url':string?
+}
+create type listType16 as open {
+    'indices':[int64]?,
+    'text':string?
+}
+create type listType17 as open {
+    'indices':[int64]?,
+    'text':string?
+}
+create type entitiesType3 as open {
+    'user_mentions':[listType13]?,
+    'media':[listType14]?,
+    'urls':[listType15]?,
+    'hashtags':[listType16]?,
+    'symbols':[listType17]?
+}
+create type userType3 as open {
+    'friends_count':int64?,
+    'profile_image_url_https':string?,
+    'listed_count':int64?,
+    'profile_background_image_url':string?,
+    'default_profile_image':boolean?,
+    'favourites_count':int64?,
+    'description':string?,
+    'created_at':string?,
+    'is_translator':boolean?,
+    'profile_background_image_url_https':string?,
+    'protected':boolean?,
+    'screen_name':string?,
+    'id_str':string?,
+    'profile_link_color':string?,
+    'id':int64?,
+    'geo_enabled':boolean?,
+    'profile_background_color':string?,
+    'lang':string?,
+    'profile_sidebar_border_color':string?,
+    'profile_text_color':string?,
+    'verified':boolean?,
+    'profile_image_url':string?,
+    'contributors_enabled':boolean?,
+    'profile_background_tile':boolean?,
+    'profile_banner_url':string?,
+    'statuses_count':int64?,
+    'followers_count':int64?,
+    'profile_use_background_image':boolean?,
+    'default_profile':boolean?,
+    'name':string?,
+    'location':string?,
+    'profile_sidebar_fill_color':string?,
+    'utc_offset':int64?,
+    'time_zone':string?,
+    'url':string?
+}
+create type smallType6 as open {
+    'w':int64?,
+    'h':int64?,
+    'resize':string?
+}
+create type largeType6 as open {
+    'w':int64?,
+    'h':int64?,
+    'resize':string?
+}
+create type thumbType6 as open {
+    'w':int64?,
+    'h':int64?,
+    'resize':string?
+}
+create type mediumType6 as open {
+    'w':int64?,
+    'h':int64?,
+    'resize':string?
+}
+create type sizesType6 as open {
+    'small':smallType6?,
+    'large':largeType6?,
+    'thumb':thumbType6?,
+    'medium':mediumType6?
+}
+create type listType19 as open {
+    'content_type':string?,
+    'bitrate':int64?,
+    'url':string?
+}
+create type video_infoType3 as open {
+    'aspect_ratio':[int64]?,
+    'duration_millis':int64?,
+    'variants':[listType19]?
+}
+create type listType18 as open {
+    'display_url':string?,
+    'indices':[int64]?,
+    'sizes':sizesType6?,
+    'id_str':string?,
+    'expanded_url':string?,
+    'media_url_https':string?,
+    'id':int64?,
+    'type':string?,
+    'media_url':string?,
+    'url':string?,
+    'source_user_id':int64?,
+    'source_status_id':int64?,
+    'source_status_id_str':string?,
+    'source_user_id_str':string?,
+    'video_info':video_infoType3?
+}
+create type extended_entitiesType3 as open {
+    'media':[listType18]?
+}
+create type userType4 as open {
+    'utc_offset':int64?,
+    'friends_count':int64?,
+    'profile_image_url_https':string?,
+    'listed_count':int64?,
+    'profile_background_image_url':string?,
+    'default_profile_image':boolean?,
+    'favourites_count':int64?,
+    'description':string?,
+    'created_at':string?,
+    'is_translator':boolean?,
+    'profile_background_image_url_https':string?,
+    'protected':boolean?,
+    'screen_name':string?,
+    'id_str':string?,
+    'profile_link_color':string?,
+    'id':int64?,
+    'geo_enabled':boolean?,
+    'profile_background_color':string?,
+    'lang':string?,
+    'profile_sidebar_border_color':string?,
+    'profile_text_color':string?,
+    'verified':boolean?,
+    'profile_image_url':string?,
+    'time_zone':string?,
+    'contributors_enabled':boolean?,
+    'profile_background_tile':boolean?,
+    'profile_banner_url':string?,
+    'statuses_count':int64?,
+    'followers_count':int64?,
+    'profile_use_background_image':boolean?,
+    'default_profile':boolean?,
+    'name':string?,
+    'profile_sidebar_fill_color':string?,
+    'location':string?,
+    'url':string?
+}
+create type smallType7 as open {
+    'w':int64?,
+    'h':int64?,
+    'resize':string?
+}
+create type largeType7 as open {
+    'w':int64?,
+    'h':int64?,
+    'resize':string?
+}
+create type thumbType7 as open {
+    'w':int64?,
+    'h':int64?,
+    'resize':string?
+}
+create type mediumType7 as open {
+    'w':int64?,
+    'h':int64?,
+    'resize':string?
+}
+create type sizesType7 as open {
+    'small':smallType7?,
+    'large':largeType7?,
+    'thumb':thumbType7?,
+    'medium':mediumType7?
+}
+create type listType21 as open {
+    'content_type':string?,
+    'bitrate':int64?,
+    'url':string?
+}
+create type video_infoType4 as open {
+    'aspect_ratio':[int64]?,
+    'variants':[listType21]?,
+    'duration_millis':int64?
+}
+create type listType20 as open {
+    'display_url':string?,
+    'source_user_id':int64?,
+    'type':string?,
+    'media_url':string?,
+    'source_status_id':int64?,
+    'url':string?,
+    'indices':[int64]?,
+    'sizes':sizesType7?,
+    'id_str':string?,
+    'expanded_url':string?,
+    'source_status_id_str':string?,
+    'media_url_https':string?,
+    'id':int64?,
+    'source_user_id_str':string?,
+    'video_info':video_infoType4?
+}
+create type extended_entitiesType4 as open {
+    'media':[listType20]?
+}
+create type smallType8 as open {
+    'w':int64?,
+    'h':int64?,
+    'resize':string?
+}
+create type largeType8 as open {
+    'w':int64?,
+    'h':int64?,
+    'resize':string?
+}
+create type thumbType8 as open {
+    'w':int64?,
+    'h':int64?,
+    'resize':string?
+}
+create type mediumType8 as open {
+    'w':int64?,
+    'h':int64?,
+    'resize':string?
+}
+create type sizesType8 as open {
+    'small':smallType8?,
+    'large':largeType8?,
+    'thumb':thumbType8?,
+    'medium':mediumType8?
+}
+create type listType22 as open {
+    'display_url':string?,
+    'source_user_id':int64?,
+    'type':string?,
+    'media_url':string?,
+    'source_status_id':int64?,
+    'url':string?,
+    'indices':[int64]?,
+    'sizes':sizesType8?,
+    'id_str':string?,
+    'expanded_url':string?,
+    'source_status_id_str':string?,
+    'media_url_https':string?,
+    'id':int64?,
+    'source_user_id_str':string?
+}
+create type listType23 as open {
+    'display_url':string?,
+    'indices':[int64]?,
+    'expanded_url':string?,
+    'url':string?
+}
+create type listType24 as open {
+    'indices':[int64]?,
+    'screen_name':string?,
+    'id_str':string?,
+    'name':string?,
+    'id':int64?
+}
+create type listType25 as open {
+    'indices':[int64]?,
+    'text':string?
+}
+create type entitiesType4 as open {
+    'media':[listType22]?,
+    'urls':[listType23]?,
+    'user_mentions':[listType24]?,
+    'hashtags':[listType25]?
+}
+create type bounding_boxType3 as open {
+    'coordinates':[[[double]]]?,
+    'type':string?
+}
+create type placeType3 as open {
+    'country_code':string?,
+    'country':string?,
+    'full_name':string?,
+    'bounding_box':bounding_boxType3?,
+    'place_type':string?,
+    'name':string?,
+    'id':string?,
+    'url':string?
+}
+create type quoted_statusType2 as open {
+    'created_at':string?,
+    'truncated':boolean?,
+    'source':string?,
+    'retweet_count':int64?,
+    'retweeted':boolean?,
+    'filter_level':string?,
+    'is_quote_status':boolean?,
+    'id_str':string?,
+    'favorite_count':int64?,
+    'id':int64?,
+    'text':string?,
+    'lang':string?,
+    'user':userType4?,
+    'favorited':boolean?,
+    'extended_entities':extended_entitiesType4?,
+    'possibly_sensitive':boolean?,
+    'entities':entitiesType4?,
+    'quoted_status_id':int64?,
+    'quoted_status_id_str':string?,
+    'in_reply_to_status_id_str':string?,
+    'in_reply_to_status_id':int64?,
+    'in_reply_to_user_id_str':string?,
+    'in_reply_to_screen_name':string?,
+    'in_reply_to_user_id':int64?,
+    'place':placeType3?
+}
+create type bounding_boxType4 as open {
+    'coordinates':[[[double]]]?,
+    'type':string?
+}
+create type placeType4 as open {
+    'country_code':string?,
+    'country':string?,
+    'full_name':string?,
+    'bounding_box':bounding_boxType4?,
+    'place_type':string?,
+    'name':string?,
+    'id':string?,
+    'url':string?
+}
+create type geoType2 as open {
+    'coordinates':[double]?,
+    'type':string?
+}
+create type coordinatesType2 as open {
+    'coordinates':[double]?,
+    'type':string?
+}
+create type TweetType as open {
+    'id':string,
+    'created_at':string?,
+    'source':string?,
+    'retweeted_status':retweeted_statusType1?,
+    'retweet_count':int64?,
+    'retweeted':boolean?,
+    'filter_level':string?,
+    'is_quote_status':boolean?,
+    'id_str':string?,
+    'favorite_count':int64?,
+    'text':string?,
+    'lang':string?,
+    'favorited':boolean?,
+    'truncated':boolean?,
+    'timestamp_ms':string?,
+    'entities':entitiesType3?,
+    'user':userType3?,
+    'extended_entities':extended_entitiesType3?,
+    'in_reply_to_status_id_str':string?,
+    'in_reply_to_status_id':int64?,
+    'in_reply_to_user_id_str':string?,
+    'in_reply_to_screen_name':string?,
+    'in_reply_to_user_id':int64?,
+    'possibly_sensitive':boolean?,
+    'quoted_status':quoted_statusType2?,
+    'quoted_status_id':int64?,
+    'quoted_status_id_str':string?,
+    'place':placeType4?,
+    'geo':geoType2?,
+    'coordinates':coordinatesType2?
+}
+
+create dataset Tweets(TweetType)
+primary key id
+

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/10351a74/asterixdb/asterix-app/src/test/resources/runtimets/queries/objects/closed-nullable-fields_issue1616/closed-nullable-fileds_issue1616.2.update.aql
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries/objects/closed-nullable-fields_issue1616/closed-nullable-fileds_issue1616.2.update.aql
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/objects/closed-nullable-fields_issue1616/closed-nullable-fileds_issue1616.2.update.aql
new file mode 100644
index 0000000..1932679
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/objects/closed-nullable-fields_issue1616/closed-nullable-fileds_issue1616.2.update.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  : Fix ArrayOutOfBound and IndexOutOfBound exception
+* Expected Res : Success
+* Issue        : 1334 and 1616
+* Date         : 12th Sept. 2016
+*/
+use dataverse test;
+
+load dataset Tweets using localfs
+(("path"="asterix_nc1://data/twitter/closed-nullable-fields-issue_1616.adm"),("format"="adm"));
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/10351a74/asterixdb/asterix-app/src/test/resources/runtimets/queries/objects/closed-nullable-fields_issue1616/closed-nullable-fileds_issue1616.3.query.aql
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries/objects/closed-nullable-fields_issue1616/closed-nullable-fileds_issue1616.3.query.aql
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/objects/closed-nullable-fields_issue1616/closed-nullable-fileds_issue1616.3.query.aql
new file mode 100644
index 0000000..cc59c2e
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/objects/closed-nullable-fields_issue1616/closed-nullable-fileds_issue1616.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  : Fix ArrayOutOfBound and IndexOutOfBound exception
+* Expected Res : Success
+* Issue        : 1334 and 1616
+* Date         : 12th Sept. 2016
+*/
+use dataverse test;
+
+for $x in dataset Tweets
+order by $x.id
+return $x
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/10351a74/asterixdb/asterix-app/src/test/resources/runtimets/queries/objects/closed-object-constructor_01/closed-record-constructor_01.1.ddl.aql
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries/objects/closed-object-constructor_01/closed-record-constructor_01.1.ddl.aql
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/objects/closed-object-constructor_01/closed-record-constructor_01.1.ddl.aql
new file mode 100644
index 0000000..d17ea60
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/objects/closed-object-constructor_01/closed-record-constructor_01.1.ddl.aql
@@ -0,0 +1,21 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+drop dataverse test if exists;
+create dataverse test;
+

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/10351a74/asterixdb/asterix-app/src/test/resources/runtimets/queries/objects/closed-object-constructor_01/closed-record-constructor_01.2.update.aql
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries/objects/closed-object-constructor_01/closed-record-constructor_01.2.update.aql
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/objects/closed-object-constructor_01/closed-record-constructor_01.2.update.aql
new file mode 100644
index 0000000..042f3ce
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/objects/closed-object-constructor_01/closed-record-constructor_01.2.update.aql
@@ -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/10351a74/asterixdb/asterix-app/src/test/resources/runtimets/queries/objects/closed-object-constructor_01/closed-record-constructor_01.3.query.aql
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries/objects/closed-object-constructor_01/closed-record-constructor_01.3.query.aql
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/objects/closed-object-constructor_01/closed-record-constructor_01.3.query.aql
new file mode 100644
index 0000000..1c32906
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/objects/closed-object-constructor_01/closed-record-constructor_01.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 test;
+set import-private-functions 'true';
+
+closed-object-constructor("foo1", 10, "bar1", 20, "foo2", 30, "bar2", 40)

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/10351a74/asterixdb/asterix-app/src/test/resources/runtimets/queries/objects/closed-object-constructor_02/closed-record-constructor_02.1.ddl.aql
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries/objects/closed-object-constructor_02/closed-record-constructor_02.1.ddl.aql
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/objects/closed-object-constructor_02/closed-record-constructor_02.1.ddl.aql
new file mode 100644
index 0000000..cbc5458
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/objects/closed-object-constructor_02/closed-record-constructor_02.1.ddl.aql
@@ -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 test if exists;
+create dataverse test;

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/10351a74/asterixdb/asterix-app/src/test/resources/runtimets/queries/objects/closed-object-constructor_02/closed-record-constructor_02.2.update.aql
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries/objects/closed-object-constructor_02/closed-record-constructor_02.2.update.aql
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/objects/closed-object-constructor_02/closed-record-constructor_02.2.update.aql
new file mode 100644
index 0000000..7cae9fa
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/objects/closed-object-constructor_02/closed-record-constructor_02.2.update.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.
+ */
+// no inserts, deletes

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/10351a74/asterixdb/asterix-app/src/test/resources/runtimets/queries/objects/closed-object-constructor_02/closed-record-constructor_02.3.query.aql
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries/objects/closed-object-constructor_02/closed-record-constructor_02.3.query.aql
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/objects/closed-object-constructor_02/closed-record-constructor_02.3.query.aql
new file mode 100644
index 0000000..7246866
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/objects/closed-object-constructor_02/closed-record-constructor_02.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 test;
+set import-private-functions 'true';
+
+closed-object-constructor("foo1", 10, "bar1", 
closed-object-constructor("bar1.1", 10, "bar1.2", 20, "bar1.3", 30, "bar1.4", 
closed-object-constructor("bar1.4.1", 10, "bar1.4.2", 20, "bar1.4.3", 30, 
"bar1.4.4", 40), "foo2", 30, "bar2", 40), "foo2", 30, "bar2", 40)

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/10351a74/asterixdb/asterix-app/src/test/resources/runtimets/queries/objects/closed-object-constructor_03/closed-record-constructor_03.1.ddl.aql
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries/objects/closed-object-constructor_03/closed-record-constructor_03.1.ddl.aql
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/objects/closed-object-constructor_03/closed-record-constructor_03.1.ddl.aql
new file mode 100644
index 0000000..d17ea60
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/objects/closed-object-constructor_03/closed-record-constructor_03.1.ddl.aql
@@ -0,0 +1,21 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+drop dataverse test if exists;
+create dataverse test;
+

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/10351a74/asterixdb/asterix-app/src/test/resources/runtimets/queries/objects/closed-object-constructor_03/closed-record-constructor_03.2.update.aql
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries/objects/closed-object-constructor_03/closed-record-constructor_03.2.update.aql
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/objects/closed-object-constructor_03/closed-record-constructor_03.2.update.aql
new file mode 100644
index 0000000..042f3ce
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/objects/closed-object-constructor_03/closed-record-constructor_03.2.update.aql
@@ -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/10351a74/asterixdb/asterix-app/src/test/resources/runtimets/queries/objects/closed-object-constructor_03/closed-record-constructor_03.3.query.aql
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries/objects/closed-object-constructor_03/closed-record-constructor_03.3.query.aql
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/objects/closed-object-constructor_03/closed-record-constructor_03.3.query.aql
new file mode 100644
index 0000000..6d4238c
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/objects/closed-object-constructor_03/closed-record-constructor_03.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 test;
+set import-private-functions 'true';
+
+{"foo1": 10, "bar1": {"bar1.1": 10, "bar1.2": 20, "bar1.3": 30, "bar1.4": 
{"bar1.4.1": 10, "bar1.4.2": 20 } }, "foo2": 30, "bar2": 40}

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/10351a74/asterixdb/asterix-app/src/test/resources/runtimets/queries/objects/expFieldName/expFieldName.1.ddl.aql
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries/objects/expFieldName/expFieldName.1.ddl.aql
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/objects/expFieldName/expFieldName.1.ddl.aql
new file mode 100644
index 0000000..d17ea60
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/objects/expFieldName/expFieldName.1.ddl.aql
@@ -0,0 +1,21 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+drop dataverse test if exists;
+create dataverse test;
+

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/10351a74/asterixdb/asterix-app/src/test/resources/runtimets/queries/objects/expFieldName/expFieldName.2.update.aql
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries/objects/expFieldName/expFieldName.2.update.aql
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/objects/expFieldName/expFieldName.2.update.aql
new file mode 100644
index 0000000..042f3ce
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/objects/expFieldName/expFieldName.2.update.aql
@@ -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/10351a74/asterixdb/asterix-app/src/test/resources/runtimets/queries/objects/expFieldName/expFieldName.3.query.aql
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries/objects/expFieldName/expFieldName.3.query.aql
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/objects/expFieldName/expFieldName.3.query.aql
new file mode 100644
index 0000000..a88fa3f
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/objects/expFieldName/expFieldName.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 test;
+
+for $x in ["field1", "field2"] 
+return {$x: 1}

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/10351a74/asterixdb/asterix-app/src/test/resources/runtimets/queries/objects/field-access-by-index_01/field-access-by-index_01.1.ddl.aql
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries/objects/field-access-by-index_01/field-access-by-index_01.1.ddl.aql
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/objects/field-access-by-index_01/field-access-by-index_01.1.ddl.aql
new file mode 100644
index 0000000..cbc5458
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/objects/field-access-by-index_01/field-access-by-index_01.1.ddl.aql
@@ -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 test if exists;
+create dataverse test;

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/10351a74/asterixdb/asterix-app/src/test/resources/runtimets/queries/objects/field-access-by-index_01/field-access-by-index_01.2.update.aql
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries/objects/field-access-by-index_01/field-access-by-index_01.2.update.aql
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/objects/field-access-by-index_01/field-access-by-index_01.2.update.aql
new file mode 100644
index 0000000..042f3ce
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/objects/field-access-by-index_01/field-access-by-index_01.2.update.aql
@@ -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/10351a74/asterixdb/asterix-app/src/test/resources/runtimets/queries/objects/field-access-by-index_01/field-access-by-index_01.3.query.aql
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries/objects/field-access-by-index_01/field-access-by-index_01.3.query.aql
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/objects/field-access-by-index_01/field-access-by-index_01.3.query.aql
new file mode 100644
index 0000000..7dcfaa8
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/objects/field-access-by-index_01/field-access-by-index_01.3.query.aql
@@ -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.
+ */
+use dataverse test;
+set import-private-functions 'true';
+
+let $x := { "foo1": 10, "bar1": 20, "foo2": 30, "bar2": 40 }
+return field-access-by-index($x,int32("2"))

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/10351a74/asterixdb/asterix-app/src/test/resources/runtimets/queries/objects/field-access-on-open-field/field-access-on-open-field.1.ddl.aql
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries/objects/field-access-on-open-field/field-access-on-open-field.1.ddl.aql
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/objects/field-access-on-open-field/field-access-on-open-field.1.ddl.aql
new file mode 100644
index 0000000..2f8426f
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/objects/field-access-on-open-field/field-access-on-open-field.1.ddl.aql
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/*
+ * Description    : Tests whether a field access on an open field (statically 
of type ANY) succeeds.
+ *                  Guards against regression to issue 207.
+ * Success        : Yes
+ */
+
+drop dataverse test if exists;
+create dataverse test;
+use dataverse test;
+
+create type TestType as open {
+  id : int32,
+  name : string
+}
+
+create dataset testds(TestType) primary key id;
+

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/10351a74/asterixdb/asterix-app/src/test/resources/runtimets/queries/objects/field-access-on-open-field/field-access-on-open-field.2.update.aql
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries/objects/field-access-on-open-field/field-access-on-open-field.2.update.aql
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/objects/field-access-on-open-field/field-access-on-open-field.2.update.aql
new file mode 100644
index 0000000..ab14683
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/objects/field-access-on-open-field/field-access-on-open-field.2.update.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    : Tests whether a field access on an open field (statically 
of type ANY) succeeds.
+ *                  Guards against regression to issue 207.
+ * Success        : Yes
+ */
+
+use dataverse test;
+
+insert into dataset testds({"id": 123, "name": "John Doe", "address": { "zip": 
92617} });
+

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/10351a74/asterixdb/asterix-app/src/test/resources/runtimets/queries/objects/field-access-on-open-field/field-access-on-open-field.3.query.aql
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries/objects/field-access-on-open-field/field-access-on-open-field.3.query.aql
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/objects/field-access-on-open-field/field-access-on-open-field.3.query.aql
new file mode 100644
index 0000000..3ee293d
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/objects/field-access-on-open-field/field-access-on-open-field.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    : Tests whether a field access on an open field (statically 
of type ANY) succeeds.
+ *                  Guards against regression to issue 207.
+ * Success        : Yes
+ */
+
+use dataverse test;
+
+for $l in dataset("testds")
+let $a := $l.address
+return $a.zip

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/10351a74/asterixdb/asterix-app/src/test/resources/runtimets/queries/objects/get-object-field-value/documentation-example/documentation-example.1.query.aql
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries/objects/get-object-field-value/documentation-example/documentation-example.1.query.aql
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/objects/get-object-field-value/documentation-example/documentation-example.1.query.aql
new file mode 100644
index 0000000..1878e27
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/objects/get-object-field-value/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 get-object-field-value under different queries.
+* Expected Res : Success
+* Date         : 04 Jun 2015
+*/
+        let $r1 := {"id":1, 
+            "project":"AsterixDB", 
+            "address":{"city":"Irvine", "state":"CA"}, 
+            "related":["Hivestrix", "Preglix", "Apache VXQuery"] }
+        return get-object-field-value($r1, "project")

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/10351a74/asterixdb/asterix-app/src/test/resources/runtimets/queries/objects/get-object-field-value/documentation-example/documentation-example.2.query.aql
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries/objects/get-object-field-value/documentation-example/documentation-example.2.query.aql
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/objects/get-object-field-value/documentation-example/documentation-example.2.query.aql
new file mode 100644
index 0000000..96d0394
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/objects/get-object-field-value/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 get-object-field-value under different queries.
+* Expected Res : Success
+* Date         : 04 Jun 2015
+*/
+        let $r1 := {"id":1, 
+            "project":"AsterixDB", 
+            "address":{"city":"Irvine", "state":"CA"}, 
+            "related":["Hivestrix", "Preglix", "Apache VXQuery"] }
+        return get-object-field-value($r1, "address")

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/10351a74/asterixdb/asterix-app/src/test/resources/runtimets/queries/objects/get-object-field-value/documentation-example/documentation-example.3.query.aql
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries/objects/get-object-field-value/documentation-example/documentation-example.3.query.aql
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/objects/get-object-field-value/documentation-example/documentation-example.3.query.aql
new file mode 100644
index 0000000..3a5b8ed
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/objects/get-object-field-value/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 get-object-field-value under different queries.
+* Expected Res : Success
+* Date         : 04 Jun 2015
+*/
+        let $r1 := {"id": 1, 
+            "project": "AsterixDB", 
+            "address": { "city": "Irvine", "state": "CA" }, 
+            "related": [ "Hivestrix", "Preglix", "Apache VXQuery" ] }
+        return get-object-field-value($r1, "related")

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/10351a74/asterixdb/asterix-app/src/test/resources/runtimets/queries/objects/get-object-field-value/highly-nested-closed/highly-nested-open.1.ddl.aql
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries/objects/get-object-field-value/highly-nested-closed/highly-nested-open.1.ddl.aql
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/objects/get-object-field-value/highly-nested-closed/highly-nested-open.1.ddl.aql
new file mode 100644
index 0000000..cac4146
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/objects/get-object-field-value/highly-nested-closed/highly-nested-open.1.ddl.aql
@@ -0,0 +1,81 @@
+/*
+ * 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 get-object-field-value under different queries.
+* Expected Res : Success
+* Date         : 04 Jun 2015
+*/
+drop dataverse test if exists;
+create dataverse test;
+
+use dataverse test;
+
+create type S as closed{
+    id: int64,
+    Species: string
+}
+
+create type GS as closed{
+    id: int64,
+    Genus: string,
+    lower: S
+}
+
+create type FGS as closed{
+    id: int64,
+    Family: string,
+    lower:GS
+}
+
+create type OFGS as closed{
+    id: int64,
+    Order: string,
+    lower: FGS
+}
+
+create type COFGS as closed{
+    id: int64,
+    Class: string,
+    lower: OFGS
+}
+
+create type PCOFGS as closed{
+    id: int64,
+    Phylum: string,
+    lower: COFGS
+}
+
+create type KPCOFGS as closed{
+    id: int64,
+    Kingdom: string,
+    lower: PCOFGS
+}
+
+create type Classification as closed{
+    id: int64,
+    fullClassification:KPCOFGS
+}
+
+create type Animal as closed{
+    id: int64,
+    class: Classification
+}
+
+create dataset Animals(Animal)
+primary key id;

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/10351a74/asterixdb/asterix-app/src/test/resources/runtimets/queries/objects/get-object-field-value/highly-nested-closed/highly-nested-open.2.update.aql
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries/objects/get-object-field-value/highly-nested-closed/highly-nested-open.2.update.aql
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/objects/get-object-field-value/highly-nested-closed/highly-nested-open.2.update.aql
new file mode 100644
index 0000000..e676df1
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/objects/get-object-field-value/highly-nested-closed/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 get-object-field-value under different queries.
+* Expected Res : Success
+* Date         : 04 Jun 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/asterixdb/blob/10351a74/asterixdb/asterix-app/src/test/resources/runtimets/queries/objects/get-object-field-value/highly-nested-closed/highly-nested-open.3.query.aql
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries/objects/get-object-field-value/highly-nested-closed/highly-nested-open.3.query.aql
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/objects/get-object-field-value/highly-nested-closed/highly-nested-open.3.query.aql
new file mode 100644
index 0000000..27bd83b
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/objects/get-object-field-value/highly-nested-closed/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 get-object-field-value under different queries.
+* Expected Res : Success
+* Date         : 04 Jun 2015
+*/
+use dataverse test;
+
+for $test in dataset Animals
+let $result := get-object-field-value($test, "class")
+order by $result.id
+return $result;

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/10351a74/asterixdb/asterix-app/src/test/resources/runtimets/queries/objects/get-object-field-value/highly-nested-mixed/highly-nested-mixed.1.ddl.aql
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries/objects/get-object-field-value/highly-nested-mixed/highly-nested-mixed.1.ddl.aql
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/objects/get-object-field-value/highly-nested-mixed/highly-nested-mixed.1.ddl.aql
new file mode 100644
index 0000000..a85ba82
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/objects/get-object-field-value/highly-nested-mixed/highly-nested-mixed.1.ddl.aql
@@ -0,0 +1,77 @@
+/*
+ * 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 get-object-field-value under different queries.
+* Expected Res : Success
+* Date         : 04 Jun 2015
+*/
+drop dataverse test if exists;
+create dataverse test;
+
+use dataverse test;
+
+create type S as open{
+    id: int64
+}
+
+create type GS as closed{
+    id: int64,
+    Genus: string,
+    lower: S
+}
+
+create type FGS as open{
+    id: int64,
+    Family: string
+}
+
+create type OFGS as closed{
+    id: int64,
+    Order: string,
+    lower: FGS
+}
+
+create type COFGS as open{
+    id: int64,
+    Class: string,
+    lower: OFGS
+}
+
+create type PCOFGS as closed{
+    id: int64,
+    Phylum: string,
+    lower: COFGS
+}
+
+create type KPCOFGS as open{
+    id: int64,
+    Kingdom: string
+}
+
+create type Classification as closed{
+    id: int64,
+    fullClassification:KPCOFGS
+}
+
+create type Animal as open{
+    id: int64
+}
+
+create dataset Animals(Animal)
+primary key id;

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/10351a74/asterixdb/asterix-app/src/test/resources/runtimets/queries/objects/get-object-field-value/highly-nested-mixed/highly-nested-mixed.2.update.aql
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries/objects/get-object-field-value/highly-nested-mixed/highly-nested-mixed.2.update.aql
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/objects/get-object-field-value/highly-nested-mixed/highly-nested-mixed.2.update.aql
new file mode 100644
index 0000000..e676df1
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/objects/get-object-field-value/highly-nested-mixed/highly-nested-mixed.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 get-object-field-value under different queries.
+* Expected Res : Success
+* Date         : 04 Jun 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/asterixdb/blob/10351a74/asterixdb/asterix-app/src/test/resources/runtimets/queries/objects/get-object-field-value/highly-nested-mixed/highly-nested-mixed.3.query.aql
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries/objects/get-object-field-value/highly-nested-mixed/highly-nested-mixed.3.query.aql
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/objects/get-object-field-value/highly-nested-mixed/highly-nested-mixed.3.query.aql
new file mode 100644
index 0000000..27bd83b
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/objects/get-object-field-value/highly-nested-mixed/highly-nested-mixed.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 get-object-field-value under different queries.
+* Expected Res : Success
+* Date         : 04 Jun 2015
+*/
+use dataverse test;
+
+for $test in dataset Animals
+let $result := get-object-field-value($test, "class")
+order by $result.id
+return $result;

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/10351a74/asterixdb/asterix-app/src/test/resources/runtimets/queries/objects/get-object-field-value/highly-nested-open/highly-nested-open.1.ddl.aql
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries/objects/get-object-field-value/highly-nested-open/highly-nested-open.1.ddl.aql
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/objects/get-object-field-value/highly-nested-open/highly-nested-open.1.ddl.aql
new file mode 100644
index 0000000..7724802
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/objects/get-object-field-value/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 get-object-field-value under different queries.
+* Expected Res : Success
+* Date         : 04 Jun 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/asterixdb/blob/10351a74/asterixdb/asterix-app/src/test/resources/runtimets/queries/objects/get-object-field-value/highly-nested-open/highly-nested-open.2.update.aql
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries/objects/get-object-field-value/highly-nested-open/highly-nested-open.2.update.aql
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/objects/get-object-field-value/highly-nested-open/highly-nested-open.2.update.aql
new file mode 100644
index 0000000..e676df1
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/objects/get-object-field-value/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 get-object-field-value under different queries.
+* Expected Res : Success
+* Date         : 04 Jun 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/asterixdb/blob/10351a74/asterixdb/asterix-app/src/test/resources/runtimets/queries/objects/get-object-field-value/highly-nested-open/highly-nested-open.3.query.aql
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries/objects/get-object-field-value/highly-nested-open/highly-nested-open.3.query.aql
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/objects/get-object-field-value/highly-nested-open/highly-nested-open.3.query.aql
new file mode 100644
index 0000000..27bd83b
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/objects/get-object-field-value/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 get-object-field-value under different queries.
+* Expected Res : Success
+* Date         : 04 Jun 2015
+*/
+use dataverse test;
+
+for $test in dataset Animals
+let $result := get-object-field-value($test, "class")
+order by $result.id
+return $result;

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/10351a74/asterixdb/asterix-app/src/test/resources/runtimets/queries/objects/get-object-field-value/tiny-social-example/tiny-social-example.1.ddl.aql
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries/objects/get-object-field-value/tiny-social-example/tiny-social-example.1.ddl.aql
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/objects/get-object-field-value/tiny-social-example/tiny-social-example.1.ddl.aql
new file mode 100644
index 0000000..ab2ef4b
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/objects/get-object-field-value/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 get-object-field-value under different queries.
+* Expected Res : Success
+* Date         : 04 Jun 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/asterixdb/blob/10351a74/asterixdb/asterix-app/src/test/resources/runtimets/queries/objects/get-object-field-value/tiny-social-example/tiny-social-example.2.ddl.aql
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries/objects/get-object-field-value/tiny-social-example/tiny-social-example.2.ddl.aql
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/objects/get-object-field-value/tiny-social-example/tiny-social-example.2.ddl.aql
new file mode 100644
index 0000000..f3c06ba
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/objects/get-object-field-value/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 get-object-field-value 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;

Reply via email to