You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@asterixdb.apache.org by im...@apache.org on 2015/07/18 03:40:38 UTC

[1/9] incubator-asterixdb git commit: Adding introspection for getting record details.

Repository: incubator-asterixdb
Updated Branches:
  refs/heads/master c66d23a5a -> 397f2361c


http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/formats/NonTaggedDataFormat.java
----------------------------------------------------------------------
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/formats/NonTaggedDataFormat.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/formats/NonTaggedDataFormat.java
index 8fdd14c..29d2afd 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/formats/NonTaggedDataFormat.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/formats/NonTaggedDataFormat.java
@@ -134,8 +134,6 @@ import edu.uci.ics.asterix.runtime.evaluators.accessors.TemporalMonthAccessor;
 import edu.uci.ics.asterix.runtime.evaluators.accessors.TemporalSecondAccessor;
 import edu.uci.ics.asterix.runtime.evaluators.accessors.TemporalYearAccessor;
 import edu.uci.ics.asterix.runtime.evaluators.common.CreateMBREvalFactory;
-import edu.uci.ics.asterix.runtime.evaluators.common.FieldAccessByIndexEvalFactory;
-import edu.uci.ics.asterix.runtime.evaluators.common.FieldAccessNestedEvalFactory;
 import edu.uci.ics.asterix.runtime.evaluators.common.FunctionManagerImpl;
 import edu.uci.ics.asterix.runtime.evaluators.constructors.ABinaryBase64StringConstructorDescriptor;
 import edu.uci.ics.asterix.runtime.evaluators.constructors.ABinaryHexStringConstructorDescriptor;
@@ -166,11 +164,12 @@ import edu.uci.ics.asterix.runtime.evaluators.constructors.ARectangleConstructor
 import edu.uci.ics.asterix.runtime.evaluators.constructors.AStringConstructorDescriptor;
 import edu.uci.ics.asterix.runtime.evaluators.constructors.ATimeConstructorDescriptor;
 import edu.uci.ics.asterix.runtime.evaluators.constructors.AYearMonthDurationConstructorDescriptor;
+import edu.uci.ics.asterix.runtime.evaluators.constructors.ClosedRecordConstructorDescriptor;
+import edu.uci.ics.asterix.runtime.evaluators.constructors.OpenRecordConstructorDescriptor;
 import edu.uci.ics.asterix.runtime.evaluators.functions.AndDescriptor;
 import edu.uci.ics.asterix.runtime.evaluators.functions.AnyCollectionMemberDescriptor;
 import edu.uci.ics.asterix.runtime.evaluators.functions.CastListDescriptor;
 import edu.uci.ics.asterix.runtime.evaluators.functions.CastRecordDescriptor;
-import edu.uci.ics.asterix.runtime.evaluators.functions.ClosedRecordConstructorDescriptor;
 import edu.uci.ics.asterix.runtime.evaluators.functions.CodePointToStringDescriptor;
 import edu.uci.ics.asterix.runtime.evaluators.functions.ContainsDescriptor;
 import edu.uci.ics.asterix.runtime.evaluators.functions.CountHashedGramTokensDescriptor;
@@ -189,9 +188,6 @@ import edu.uci.ics.asterix.runtime.evaluators.functions.EditDistanceListIsFilter
 import edu.uci.ics.asterix.runtime.evaluators.functions.EditDistanceStringIsFilterable;
 import edu.uci.ics.asterix.runtime.evaluators.functions.EmbedTypeDescriptor;
 import edu.uci.ics.asterix.runtime.evaluators.functions.EndsWithDescriptor;
-import edu.uci.ics.asterix.runtime.evaluators.functions.FieldAccessByIndexDescriptor;
-import edu.uci.ics.asterix.runtime.evaluators.functions.FieldAccessByNameDescriptor;
-import edu.uci.ics.asterix.runtime.evaluators.functions.FieldAccessNestedDescriptor;
 import edu.uci.ics.asterix.runtime.evaluators.functions.FlowRecordDescriptor;
 import edu.uci.ics.asterix.runtime.evaluators.functions.FuzzyEqDescriptor;
 import edu.uci.ics.asterix.runtime.evaluators.functions.GetItemDescriptor;
@@ -218,11 +214,9 @@ import edu.uci.ics.asterix.runtime.evaluators.functions.NumericRoundHalfToEven2D
 import edu.uci.ics.asterix.runtime.evaluators.functions.NumericRoundHalfToEvenDescriptor;
 import edu.uci.ics.asterix.runtime.evaluators.functions.NumericSubDescriptor;
 import edu.uci.ics.asterix.runtime.evaluators.functions.NumericUnaryMinusDescriptor;
-import edu.uci.ics.asterix.runtime.evaluators.functions.OpenRecordConstructorDescriptor;
 import edu.uci.ics.asterix.runtime.evaluators.functions.OrDescriptor;
 import edu.uci.ics.asterix.runtime.evaluators.functions.OrderedListConstructorDescriptor;
 import edu.uci.ics.asterix.runtime.evaluators.functions.PrefixLenJaccardDescriptor;
-import edu.uci.ics.asterix.runtime.evaluators.functions.RecordMergeDescriptor;
 import edu.uci.ics.asterix.runtime.evaluators.functions.RegExpDescriptor;
 import edu.uci.ics.asterix.runtime.evaluators.functions.SimilarityJaccardCheckDescriptor;
 import edu.uci.ics.asterix.runtime.evaluators.functions.SimilarityJaccardDescriptor;
@@ -263,6 +257,14 @@ import edu.uci.ics.asterix.runtime.evaluators.functions.binary.ParseBinaryDescri
 import edu.uci.ics.asterix.runtime.evaluators.functions.binary.PrintBinaryDescriptor;
 import edu.uci.ics.asterix.runtime.evaluators.functions.binary.SubBinaryFromDescriptor;
 import edu.uci.ics.asterix.runtime.evaluators.functions.binary.SubBinaryFromToDescriptor;
+import edu.uci.ics.asterix.runtime.evaluators.functions.records.FieldAccessByIndexDescriptor;
+import edu.uci.ics.asterix.runtime.evaluators.functions.records.FieldAccessByIndexEvalFactory;
+import edu.uci.ics.asterix.runtime.evaluators.functions.records.FieldAccessByNameDescriptor;
+import edu.uci.ics.asterix.runtime.evaluators.functions.records.FieldAccessNestedDescriptor;
+import edu.uci.ics.asterix.runtime.evaluators.functions.records.FieldAccessNestedEvalFactory;
+import edu.uci.ics.asterix.runtime.evaluators.functions.records.GetRecordFieldValueDescriptor;
+import edu.uci.ics.asterix.runtime.evaluators.functions.records.GetRecordFieldsDescriptor;
+import edu.uci.ics.asterix.runtime.evaluators.functions.records.RecordMergeDescriptor;
 import edu.uci.ics.asterix.runtime.evaluators.functions.temporal.AdjustDateTimeForTimeZoneDescriptor;
 import edu.uci.ics.asterix.runtime.evaluators.functions.temporal.AdjustTimeForTimeZoneDescriptor;
 import edu.uci.ics.asterix.runtime.evaluators.functions.temporal.CalendarDuartionFromDateDescriptor;
@@ -409,6 +411,9 @@ public class NonTaggedDataFormat implements IDataFormat {
         temp.add(FieldAccessByIndexDescriptor.FACTORY);
         temp.add(FieldAccessByNameDescriptor.FACTORY);
         temp.add(FieldAccessNestedDescriptor.FACTORY);
+        temp.add(GetRecordFieldsDescriptor.FACTORY);
+        temp.add(GetRecordFieldValueDescriptor.FACTORY);
+        temp.add(FieldAccessByNameDescriptor.FACTORY);
         temp.add(GetItemDescriptor.FACTORY);
         temp.add(NumericUnaryMinusDescriptor.FACTORY);
         temp.add(OpenRecordConstructorDescriptor.FACTORY);
@@ -759,13 +764,10 @@ public class NonTaggedDataFormat implements IDataFormat {
                     throw new AlgebricksException(e);
                 }
             }
-            ICopyEvaluatorFactory fldNameEvalFactory = new ConstantEvalFactory(Arrays.copyOf(abvs.getByteArray(),
-                    abvs.getLength()));
             ICopyEvaluatorFactory[] factories = new ICopyEvaluatorFactory[2];
             factories[0] = recordEvalFactory;
-            factories[1] = fldNameEvalFactory;
             if (fldName.size() > 1) {
-                evalFactory = new FieldAccessNestedEvalFactory(recordEvalFactory, fldNameEvalFactory, recType, fldName);
+                evalFactory = new FieldAccessNestedEvalFactory(recordEvalFactory, recType, fldName);
             } else {
                 evalFactory = FieldAccessByNameDescriptor.FACTORY.createFunctionDescriptor().createEvaluatorFactory(
                         factories);
@@ -861,10 +863,7 @@ public class NonTaggedDataFormat implements IDataFormat {
             } catch (HyracksDataException e) {
                 throw new AlgebricksException(e);
             }
-            ICopyEvaluatorFactory fldNameEvalFactory = new ConstantEvalFactory(Arrays.copyOf(abvs.getByteArray(),
-                    abvs.getLength()));
-            ICopyEvaluatorFactory evalFactory = new FieldAccessNestedEvalFactory(recordEvalFactory, fldNameEvalFactory,
-                    recType, fldName);
+            ICopyEvaluatorFactory evalFactory = new FieldAccessNestedEvalFactory(recordEvalFactory, recType, fldName);
             IFunctionInfo finfoAccess = AsterixBuiltinFunctions
                     .getAsterixFunctionInfo(AsterixBuiltinFunctions.FIELD_ACCESS_NESTED);
 
@@ -1004,6 +1003,26 @@ public class NonTaggedDataFormat implements IDataFormat {
                 }
             }
         }
+        if (fd.getIdentifier().equals(AsterixBuiltinFunctions.GET_RECORD_FIELDS)) {
+            AbstractFunctionCallExpression fce = (AbstractFunctionCallExpression) expr;
+            IAType t = (IAType) context.getType(fce.getArguments().get(0).getValue());
+            if (t.getTypeTag().equals(ATypeTag.RECORD)) {
+                ARecordType recType = (ARecordType) t;
+                ((GetRecordFieldsDescriptor) fd).reset(recType);
+            } else {
+                throw new NotImplementedException("get-record-fields for data of type " + t);
+            }
+        }
+        if (fd.getIdentifier().equals(AsterixBuiltinFunctions.GET_RECORD_FIELD_VALUE)) {
+            AbstractFunctionCallExpression fce = (AbstractFunctionCallExpression) expr;
+            IAType t = (IAType) context.getType(fce.getArguments().get(0).getValue());
+            if (t.getTypeTag().equals(ATypeTag.RECORD)) {
+                ARecordType recType = (ARecordType) t;
+                ((GetRecordFieldValueDescriptor) fd).reset(recType);
+            } else {
+                throw new NotImplementedException("get-record-field-value for data of type " + t);
+            }
+        }
     }
 
     private boolean[] computeOpenFields(AbstractFunctionCallExpression expr, ARecordType recType) {

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/operators/file/ADMDataParser.java
----------------------------------------------------------------------
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/operators/file/ADMDataParser.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/operators/file/ADMDataParser.java
index 7e6ff04..1bdd264 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/operators/file/ADMDataParser.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/operators/file/ADMDataParser.java
@@ -17,15 +17,16 @@ package edu.uci.ics.asterix.runtime.operators.file;
 import java.io.DataOutput;
 import java.io.IOException;
 import java.io.InputStream;
-import java.util.ArrayDeque;
 import java.util.BitSet;
 import java.util.List;
-import java.util.Queue;
 
+import edu.uci.ics.asterix.builders.AbvsBuilderFactory;
 import edu.uci.ics.asterix.builders.IARecordBuilder;
 import edu.uci.ics.asterix.builders.IAsterixListBuilder;
+import edu.uci.ics.asterix.builders.ListBuilderFactory;
 import edu.uci.ics.asterix.builders.OrderedListBuilder;
 import edu.uci.ics.asterix.builders.RecordBuilder;
+import edu.uci.ics.asterix.builders.RecordBuilderFactory;
 import edu.uci.ics.asterix.builders.UnorderedListBuilder;
 import edu.uci.ics.asterix.common.exceptions.AsterixException;
 import edu.uci.ics.asterix.dataflow.data.nontagged.serde.AIntervalSerializerDeserializer;
@@ -41,11 +42,13 @@ import edu.uci.ics.asterix.om.types.IAType;
 import edu.uci.ics.asterix.om.types.hierachy.ATypeHierarchy;
 import edu.uci.ics.asterix.om.types.hierachy.ITypeConvertComputer;
 import edu.uci.ics.asterix.om.util.NonTaggedFormatUtil;
+import edu.uci.ics.asterix.om.util.container.IObjectPool;
+import edu.uci.ics.asterix.om.util.container.ListObjectPool;
 import edu.uci.ics.asterix.runtime.operators.file.adm.AdmLexer;
 import edu.uci.ics.asterix.runtime.operators.file.adm.AdmLexerException;
 import edu.uci.ics.hyracks.api.exceptions.HyracksDataException;
+import edu.uci.ics.hyracks.data.std.api.IMutableValueStorage;
 import edu.uci.ics.hyracks.data.std.util.ArrayBackedValueStorage;
-import edu.uci.ics.hyracks.dataflow.common.data.marshalling.Integer64SerializerDeserializer;
 
 /**
  * Parser for ADM formatted data.
@@ -59,10 +62,12 @@ public class ADMDataParser extends AbstractDataParser {
     private int nullableFieldId = 0;
     private ArrayBackedValueStorage castBuffer = new ArrayBackedValueStorage();
 
-    private Queue<ArrayBackedValueStorage> baaosPool = new ArrayDeque<ArrayBackedValueStorage>();
-    private Queue<IARecordBuilder> recordBuilderPool = new ArrayDeque<IARecordBuilder>();
-    private Queue<IAsterixListBuilder> orderedListBuilderPool = new ArrayDeque<IAsterixListBuilder>();
-    private Queue<IAsterixListBuilder> unorderedListBuilderPool = new ArrayDeque<IAsterixListBuilder>();
+    private IObjectPool<IARecordBuilder, String> recordBuilderPool = new ListObjectPool<IARecordBuilder, String>(
+            new RecordBuilderFactory());
+    private IObjectPool<IAsterixListBuilder, String> listBuilderPool = new ListObjectPool<IAsterixListBuilder, String>(
+            new ListBuilderFactory());
+    private IObjectPool<IMutableValueStorage, String> abvsBuilderPool = new ListObjectPool<IMutableValueStorage, String>(
+            new AbvsBuilderFactory());
 
     private String mismatchErrorMessage = "Mismatch Type, expecting a value of type ";
     private String mismatchErrorMessage2 = " got a value of type ";
@@ -637,9 +642,6 @@ public class ADMDataParser extends AbstractDataParser {
             }
         }
         recBuilder.write(out, true);
-        returnRecordBuilder(recBuilder);
-        returnTempBuffer(fieldNameBuffer);
-        returnTempBuffer(fieldValueBuffer);
     }
 
     private int checkNullConstraints(ARecordType recType, BitSet nulls) {
@@ -708,8 +710,6 @@ public class ADMDataParser extends AbstractDataParser {
             first = false;
         } while (inList);
         orderedListBuilder.write(out, true);
-        returnOrderedListBuilder(orderedListBuilder);
-        returnTempBuffer(itemBuffer);
     }
 
     private void parseUnorderedList(AUnorderedListType uoltype, DataOutput out) throws IOException, AsterixException,
@@ -757,60 +757,22 @@ public class ADMDataParser extends AbstractDataParser {
             first = false;
         } while (inList);
         unorderedListBuilder.write(out, true);
-        returnUnorderedListBuilder(unorderedListBuilder);
-        returnTempBuffer(itemBuffer);
     }
 
     private IARecordBuilder getRecordBuilder() {
-        RecordBuilder recBuilder = (RecordBuilder) recordBuilderPool.poll();
-        if (recBuilder != null) {
-            return recBuilder;
-        } else {
-            return new RecordBuilder();
-        }
-    }
-
-    private void returnRecordBuilder(IARecordBuilder recBuilder) {
-        this.recordBuilderPool.add(recBuilder);
+        return (RecordBuilder) recordBuilderPool.allocate("record");
     }
 
     private IAsterixListBuilder getOrderedListBuilder() {
-        OrderedListBuilder orderedListBuilder = (OrderedListBuilder) orderedListBuilderPool.poll();
-        if (orderedListBuilder != null) {
-            return orderedListBuilder;
-        } else {
-            return new OrderedListBuilder();
-        }
-    }
-
-    private void returnOrderedListBuilder(IAsterixListBuilder orderedListBuilder) {
-        this.orderedListBuilderPool.add(orderedListBuilder);
+        return listBuilderPool.allocate("ordered");
     }
 
     private IAsterixListBuilder getUnorderedListBuilder() {
-        UnorderedListBuilder unorderedListBuilder = (UnorderedListBuilder) unorderedListBuilderPool.poll();
-        if (unorderedListBuilder != null) {
-            return unorderedListBuilder;
-        } else {
-            return new UnorderedListBuilder();
-        }
-    }
-
-    private void returnUnorderedListBuilder(IAsterixListBuilder unorderedListBuilder) {
-        this.unorderedListBuilderPool.add(unorderedListBuilder);
+        return listBuilderPool.allocate("unordered");
     }
 
     private ArrayBackedValueStorage getTempBuffer() {
-        ArrayBackedValueStorage tmpBaaos = baaosPool.poll();
-        if (tmpBaaos != null) {
-            return tmpBaaos;
-        } else {
-            return new ArrayBackedValueStorage();
-        }
-    }
-
-    private void returnTempBuffer(ArrayBackedValueStorage tempBaaos) {
-        baaosPool.add(tempBaaos);
+        return (ArrayBackedValueStorage) abvsBuilderPool.allocate("buffer");
     }
 
     private void parseToBinaryTarget(int lexerToken, String tokenImage, DataOutput out) throws ParseException,

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-test-framework/src/main/java/edu/uci/ics/asterix/testframework/context/TestCaseContext.java
----------------------------------------------------------------------
diff --git a/asterix-test-framework/src/main/java/edu/uci/ics/asterix/testframework/context/TestCaseContext.java b/asterix-test-framework/src/main/java/edu/uci/ics/asterix/testframework/context/TestCaseContext.java
index dbd12cd..3167a17 100644
--- a/asterix-test-framework/src/main/java/edu/uci/ics/asterix/testframework/context/TestCaseContext.java
+++ b/asterix-test-framework/src/main/java/edu/uci/ics/asterix/testframework/context/TestCaseContext.java
@@ -77,6 +77,7 @@ public class TestCaseContext {
 
     public static final String DEFAULT_TESTSUITE_XML_NAME = "testsuite.xml";
     public static final String ONLY_TESTSUITE_XML_NAME = "only.xml";
+    public static final String DEFAULT_REPEADED_TESTSUITE_XML_NAME = "repeatedtestsuite.xml";
 
     private File tsRoot;
 

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index dbf53ac..6f4217e 100644
--- a/pom.xml
+++ b/pom.xml
@@ -24,12 +24,12 @@
     <packaging>pom</packaging>
 
     <licenses>
-      <license>
-        <name>Apache License, Version 2.0</name>
-        <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
-        <distribution>repo</distribution>
-        <comments>A business-friendly OSS license</comments>
-      </license>
+        <license>
+            <name>Apache License, Version 2.0</name>
+            <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
+            <distribution>repo</distribution>
+            <comments>A business-friendly OSS license</comments>
+        </license>
     </licenses>
 
     <properties>
@@ -41,9 +41,10 @@
         <optimizer.tests>**/optimizer/**/*Test.java</optimizer.tests>
         <metadata.tests>**/metadata/*Test.java</metadata.tests>
         <execution.tests>**/ExecutionTest.java</execution.tests>
+        <repeated.tests>**/ExecutionTest.java</repeated.tests>
         <invalid.tests>**/DmlTest.java</invalid.tests>
         <global.test.includes>**/*TestSuite.java,**/*Test.java,${execution.tests}</global.test.includes>
-        <global.test.excludes>${optimizer.tests},${metadata.tests},${invalid.tests}</global.test.excludes>
+        <global.test.excludes>${optimizer.tests},${metadata.tests},${invalid.tests},${repeated.tests}</global.test.excludes>
     <!-- Versions under dependencymanagement or used in many projects via properties -->
         <algebricks.version>0.2.16-SNAPSHOT</algebricks.version>
         <hyracks.version>0.2.16-SNAPSHOT</hyracks.version>
@@ -89,59 +90,60 @@
                     </excludes>
                 </configuration>
             </plugin>
-          <plugin>
-            <groupId>org.apache.rat</groupId>
-            <artifactId>apache-rat-plugin</artifactId>
-            <version>0.11</version>
-            <executions>
-                <execution>
-                    <phase>verify</phase>
-                    <goals>
-                        <goal>check</goal>
-                    </goals>
-                </execution>
-            </executions>
-            <configuration>
-              <excludeSubProjects>true</excludeSubProjects>
-              <licenses>
-                <license implementation="org.apache.rat.analysis.license.SimplePatternBasedLicense">
-                  <licenseFamilyCategory>MIT</licenseFamilyCategory>
-                  <licenseFamilyName>The MIT License</licenseFamilyName>
-                  <notes>For JQuery MIT/GPL2 Dual License</notes>
-                  <patterns>
-                    <pattern>Dual licensed under the MIT or GPL Version 2 licenses.</pattern>
-                    <pattern>Dual licensed under the MIT and GPL2 licenses.</pattern>
-                    <pattern>http://jquery.org/license</pattern>
-                    <pattern>Dual licensed under the MIT</pattern>
-                    <pattern>Released under the MIT license by IOLA, December 2007.</pattern>
-                  </patterns>
-                </license>
-              </licenses>
-              <licenseFamilies>
-                <licenseFamily implementation="org.apache.rat.license.SimpleLicenseFamily">
-                  <familyName>The MIT License</familyName>
-                </licenseFamily>
-                <licenseFamily implementation="org.apache.rat.license.SimpleLicenseFamily">
-                  <familyName>Apache License Version 2.0</familyName>
-                </licenseFamily>
-              </licenseFamilies>
-              <excludes>
-                <exclude>**/*.txt</exclude>
-                <exclude>**/*.tbl</exclude>
-                <exclude>**/*.tsv</exclude>
-                <exclude>**/*.ddl</exclude>
-                <exclude>**/*.aql</exclude>
-                <exclude>**/*.adm</exclude>
-                <exclude>**/*.csv</exclude>
-                <exclude>**/*.out</exclude>
-                <exclude>**/*.iml</exclude>
-              </excludes>
-              <includes>
-                <include>**/asterix-*</include>
-                <include>**/*.java</include>
-              </includes>
-            </configuration>
-          </plugin>
+            <plugin>
+                <groupId>org.apache.rat</groupId>
+                <artifactId>apache-rat-plugin</artifactId>
+                <version>0.11</version>
+                <executions>
+                    <execution>
+                        <phase>verify</phase>
+                        <goals>
+                            <goal>check</goal>
+                        </goals>
+                    </execution>
+                </executions>
+                <configuration>
+                    <excludeSubProjects>true</excludeSubProjects>
+                    <licenses>
+                        <license implementation="org.apache.rat.analysis.license.SimplePatternBasedLicense">
+                            <licenseFamilyCategory>MIT</licenseFamilyCategory>
+                            <licenseFamilyName>The MIT License</licenseFamilyName>
+                            <notes>For JQuery MIT/GPL2 Dual License</notes>
+                            <patterns>
+                                <pattern>Dual licensed under the MIT or GPL Version 2 licenses.</pattern>
+                                <pattern>Dual licensed under the MIT and GPL2 licenses.</pattern>
+                                <pattern>http://jquery.org/license</pattern>
+                                <pattern>Dual licensed under the MIT</pattern>
+                                <pattern>Released under the MIT license by IOLA, December 2007.</pattern>
+                            </patterns>
+                        </license>
+                    </licenses>
+                    <licenseFamilies>
+                        <licenseFamily implementation="org.apache.rat.license.SimpleLicenseFamily">
+                            <familyName>The MIT License</familyName>
+                        </licenseFamily>
+                        <licenseFamily implementation="org.apache.rat.license.SimpleLicenseFamily">
+                            <familyName>Apache License Version 2.0</familyName>
+                        </licenseFamily>
+                    </licenseFamilies>
+                    <excludes>
+                        <exclude>**/*.adm</exclude>
+                        <exclude>**/*.aql</exclude>
+                        <exclude>**/*.csv</exclude>
+                        <exclude>**/*.ddl</exclude>
+                        <exclude>**/*.iml</exclude>
+                        <exclude>**/*.out</exclude>
+                        <exclude>**/*.tbl</exclude>
+                        <exclude>**/*.tsv</exclude>
+                        <exclude>**/*.txt</exclude>
+                        <exclude>**/*.xsd</exclude>
+                    </excludes>
+                    <includes>
+                        <include>**/asterix-*</include>
+                        <include>**/*.java</include>
+                    </includes>
+                </configuration>
+            </plugin>
 
         </plugins>
     </build>
@@ -380,9 +382,7 @@
             </dependency>
             <dependency>
                 <groupId>edu.uci.ics.hyracks</groupId>
-                <artifactId>
-    				hyracks-storage-am-invertedindex
-    			</artifactId>
+                <artifactId>hyracks-storage-am-invertedindex</artifactId>
                 <version>${hyracks.version}</version>
             </dependency>
             <dependency>


[3/9] incubator-asterixdb git commit: Adding introspection for getting record details.

Posted by im...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-om/src/main/java/edu/uci/ics/asterix/om/pointables/printer/ARecordPrinter.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/om/pointables/printer/ARecordPrinter.java b/asterix-om/src/main/java/edu/uci/ics/asterix/om/pointables/printer/ARecordPrinter.java
index 1dd75c3..d48a395 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/om/pointables/printer/ARecordPrinter.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/om/pointables/printer/ARecordPrinter.java
@@ -20,7 +20,7 @@ import java.io.PrintStream;
 import java.util.List;
 
 import edu.uci.ics.asterix.common.exceptions.AsterixException;
-import edu.uci.ics.asterix.om.pointables.ARecordPointable;
+import edu.uci.ics.asterix.om.pointables.ARecordVisitablePointable;
 import edu.uci.ics.asterix.om.pointables.base.IVisitablePointable;
 import edu.uci.ics.asterix.om.types.ATypeTag;
 import edu.uci.ics.asterix.om.types.EnumDeserializer;
@@ -43,7 +43,7 @@ class ARecordPrinter {
 
     }
 
-    public void printRecord(ARecordPointable recordAccessor, PrintStream ps, APrintVisitor visitor) throws IOException,
+    public void printRecord(ARecordVisitablePointable recordAccessor, PrintStream ps, APrintVisitor visitor) throws IOException,
             AsterixException {
         List<IVisitablePointable> fieldNames = recordAccessor.getFieldNames();
         List<IVisitablePointable> fieldTags = recordAccessor.getFieldTypeTags();

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-om/src/main/java/edu/uci/ics/asterix/om/pointables/printer/csv/APrintVisitor.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/om/pointables/printer/csv/APrintVisitor.java b/asterix-om/src/main/java/edu/uci/ics/asterix/om/pointables/printer/csv/APrintVisitor.java
index 8461cc4..549be5f 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/om/pointables/printer/csv/APrintVisitor.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/om/pointables/printer/csv/APrintVisitor.java
@@ -44,8 +44,8 @@ import edu.uci.ics.asterix.dataflow.data.nontagged.printers.csv.AStringPrinter;
 import edu.uci.ics.asterix.dataflow.data.nontagged.printers.csv.ATimePrinter;
 import edu.uci.ics.asterix.dataflow.data.nontagged.printers.csv.AYearMonthDurationPrinter;
 import edu.uci.ics.asterix.om.pointables.AFlatValuePointable;
-import edu.uci.ics.asterix.om.pointables.AListPointable;
-import edu.uci.ics.asterix.om.pointables.ARecordPointable;
+import edu.uci.ics.asterix.om.pointables.AListVisitablePointable;
+import edu.uci.ics.asterix.om.pointables.ARecordVisitablePointable;
 import edu.uci.ics.asterix.om.pointables.base.IVisitablePointable;
 import edu.uci.ics.asterix.om.pointables.visitor.IVisitablePointableVisitor;
 import edu.uci.ics.asterix.om.types.ATypeTag;
@@ -64,12 +64,12 @@ public class APrintVisitor implements IVisitablePointableVisitor<Void, Pair<Prin
     private int level = 0;
 
     @Override
-    public Void visit(AListPointable accessor, Pair<PrintStream, ATypeTag> arg) throws AsterixException {
+    public Void visit(AListVisitablePointable accessor, Pair<PrintStream, ATypeTag> arg) throws AsterixException {
         throw new AsterixException("'List' type unsupported for CSV output");
     }
 
     @Override
-    public Void visit(ARecordPointable accessor, Pair<PrintStream, ATypeTag> arg) throws AsterixException {
+    public Void visit(ARecordVisitablePointable accessor, Pair<PrintStream, ATypeTag> arg) throws AsterixException {
         ARecordPrinter printer = raccessorToPrinter.get(accessor);
         if (printer == null) {
             printer = new ARecordPrinter();

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-om/src/main/java/edu/uci/ics/asterix/om/pointables/printer/csv/ARecordPrinter.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/om/pointables/printer/csv/ARecordPrinter.java b/asterix-om/src/main/java/edu/uci/ics/asterix/om/pointables/printer/csv/ARecordPrinter.java
index fbb6d9b..8e2b6ac 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/om/pointables/printer/csv/ARecordPrinter.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/om/pointables/printer/csv/ARecordPrinter.java
@@ -20,7 +20,7 @@ import java.io.PrintStream;
 import java.util.List;
 
 import edu.uci.ics.asterix.common.exceptions.AsterixException;
-import edu.uci.ics.asterix.om.pointables.ARecordPointable;
+import edu.uci.ics.asterix.om.pointables.ARecordVisitablePointable;
 import edu.uci.ics.asterix.om.pointables.base.IVisitablePointable;
 import edu.uci.ics.asterix.om.types.ATypeTag;
 import edu.uci.ics.asterix.om.types.EnumDeserializer;
@@ -41,7 +41,7 @@ class ARecordPrinter {
 
     }
 
-    public void printRecord(ARecordPointable recordAccessor, PrintStream ps, APrintVisitor visitor) throws IOException,
+    public void printRecord(ARecordVisitablePointable recordAccessor, PrintStream ps, APrintVisitor visitor) throws IOException,
             AsterixException {
         List<IVisitablePointable> fieldNames = recordAccessor.getFieldNames();
         List<IVisitablePointable> fieldTags = recordAccessor.getFieldTypeTags();

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-om/src/main/java/edu/uci/ics/asterix/om/pointables/printer/json/AListPrinter.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/om/pointables/printer/json/AListPrinter.java b/asterix-om/src/main/java/edu/uci/ics/asterix/om/pointables/printer/json/AListPrinter.java
index 3328d7f..8b91a06 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/om/pointables/printer/json/AListPrinter.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/om/pointables/printer/json/AListPrinter.java
@@ -20,7 +20,7 @@ import java.io.PrintStream;
 import java.util.List;
 
 import edu.uci.ics.asterix.common.exceptions.AsterixException;
-import edu.uci.ics.asterix.om.pointables.AListPointable;
+import edu.uci.ics.asterix.om.pointables.AListVisitablePointable;
 import edu.uci.ics.asterix.om.pointables.base.IVisitablePointable;
 import edu.uci.ics.asterix.om.types.ATypeTag;
 import edu.uci.ics.asterix.om.types.EnumDeserializer;
@@ -45,7 +45,7 @@ class AListPrinter {
         }
     }
 
-    public void printList(AListPointable listAccessor, PrintStream ps, APrintVisitor visitor) throws IOException,
+    public void printList(AListVisitablePointable listAccessor, PrintStream ps, APrintVisitor visitor) throws IOException,
             AsterixException {
         List<IVisitablePointable> itemTags = listAccessor.getItemTags();
         List<IVisitablePointable> items = listAccessor.getItems();

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-om/src/main/java/edu/uci/ics/asterix/om/pointables/printer/json/APrintVisitor.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/om/pointables/printer/json/APrintVisitor.java b/asterix-om/src/main/java/edu/uci/ics/asterix/om/pointables/printer/json/APrintVisitor.java
index e284621..0997791 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/om/pointables/printer/json/APrintVisitor.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/om/pointables/printer/json/APrintVisitor.java
@@ -45,8 +45,8 @@ import edu.uci.ics.asterix.dataflow.data.nontagged.printers.json.AStringPrinter;
 import edu.uci.ics.asterix.dataflow.data.nontagged.printers.json.ATimePrinter;
 import edu.uci.ics.asterix.dataflow.data.nontagged.printers.json.AYearMonthDurationPrinter;
 import edu.uci.ics.asterix.om.pointables.AFlatValuePointable;
-import edu.uci.ics.asterix.om.pointables.AListPointable;
-import edu.uci.ics.asterix.om.pointables.ARecordPointable;
+import edu.uci.ics.asterix.om.pointables.AListVisitablePointable;
+import edu.uci.ics.asterix.om.pointables.ARecordVisitablePointable;
 import edu.uci.ics.asterix.om.pointables.base.IVisitablePointable;
 import edu.uci.ics.asterix.om.pointables.visitor.IVisitablePointableVisitor;
 import edu.uci.ics.asterix.om.types.ATypeTag;
@@ -64,7 +64,7 @@ public class APrintVisitor implements IVisitablePointableVisitor<Void, Pair<Prin
     private final Map<IVisitablePointable, AListPrinter> laccessorToPrinter = new HashMap<IVisitablePointable, AListPrinter>();
 
     @Override
-    public Void visit(AListPointable accessor, Pair<PrintStream, ATypeTag> arg) throws AsterixException {
+    public Void visit(AListVisitablePointable accessor, Pair<PrintStream, ATypeTag> arg) throws AsterixException {
         AListPrinter printer = laccessorToPrinter.get(accessor);
         if (printer == null) {
             printer = new AListPrinter(accessor.ordered());
@@ -79,7 +79,7 @@ public class APrintVisitor implements IVisitablePointableVisitor<Void, Pair<Prin
     }
 
     @Override
-    public Void visit(ARecordPointable accessor, Pair<PrintStream, ATypeTag> arg) throws AsterixException {
+    public Void visit(ARecordVisitablePointable accessor, Pair<PrintStream, ATypeTag> arg) throws AsterixException {
         ARecordPrinter printer = raccessorToPrinter.get(accessor);
         if (printer == null) {
             printer = new ARecordPrinter();

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-om/src/main/java/edu/uci/ics/asterix/om/pointables/printer/json/ARecordPrinter.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/om/pointables/printer/json/ARecordPrinter.java b/asterix-om/src/main/java/edu/uci/ics/asterix/om/pointables/printer/json/ARecordPrinter.java
index c7a5654..1fde70f 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/om/pointables/printer/json/ARecordPrinter.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/om/pointables/printer/json/ARecordPrinter.java
@@ -20,7 +20,7 @@ import java.io.PrintStream;
 import java.util.List;
 
 import edu.uci.ics.asterix.common.exceptions.AsterixException;
-import edu.uci.ics.asterix.om.pointables.ARecordPointable;
+import edu.uci.ics.asterix.om.pointables.ARecordVisitablePointable;
 import edu.uci.ics.asterix.om.pointables.base.IVisitablePointable;
 import edu.uci.ics.asterix.om.types.ATypeTag;
 import edu.uci.ics.asterix.om.types.EnumDeserializer;
@@ -43,7 +43,7 @@ class ARecordPrinter {
 
     }
 
-    public void printRecord(ARecordPointable recordAccessor, PrintStream ps, APrintVisitor visitor) throws IOException,
+    public void printRecord(ARecordVisitablePointable recordAccessor, PrintStream ps, APrintVisitor visitor) throws IOException,
             AsterixException {
         List<IVisitablePointable> fieldNames = recordAccessor.getFieldNames();
         List<IVisitablePointable> fieldTags = recordAccessor.getFieldTypeTags();

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-om/src/main/java/edu/uci/ics/asterix/om/pointables/visitor/IVisitablePointableVisitor.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/om/pointables/visitor/IVisitablePointableVisitor.java b/asterix-om/src/main/java/edu/uci/ics/asterix/om/pointables/visitor/IVisitablePointableVisitor.java
index af7e7d2..ec6d2f4 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/om/pointables/visitor/IVisitablePointableVisitor.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/om/pointables/visitor/IVisitablePointableVisitor.java
@@ -17,8 +17,8 @@ package edu.uci.ics.asterix.om.pointables.visitor;
 
 import edu.uci.ics.asterix.common.exceptions.AsterixException;
 import edu.uci.ics.asterix.om.pointables.AFlatValuePointable;
-import edu.uci.ics.asterix.om.pointables.AListPointable;
-import edu.uci.ics.asterix.om.pointables.ARecordPointable;
+import edu.uci.ics.asterix.om.pointables.AListVisitablePointable;
+import edu.uci.ics.asterix.om.pointables.ARecordVisitablePointable;
 
 /**
  * This interface is a visitor for all the three different IVisitablePointable
@@ -27,9 +27,9 @@ import edu.uci.ics.asterix.om.pointables.ARecordPointable;
  */
 public interface IVisitablePointableVisitor<R, T> {
 
-    public R visit(AListPointable accessor, T arg) throws AsterixException;
+    public R visit(AListVisitablePointable accessor, T arg) throws AsterixException;
 
-    public R visit(ARecordPointable accessor, T arg) throws AsterixException;
+    public R visit(ARecordVisitablePointable accessor, T arg) throws AsterixException;
 
     public R visit(AFlatValuePointable accessor, T arg) throws AsterixException;
 }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/AnyTypeComputer.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/AnyTypeComputer.java b/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/AnyTypeComputer.java
new file mode 100644
index 0000000..94d3e1d
--- /dev/null
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/AnyTypeComputer.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2009-2013 by The Regents of the University of California
+ * Licensed 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 from
+ * 
+ *     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.
+ */
+package edu.uci.ics.asterix.om.typecomputer.impl;
+
+import edu.uci.ics.asterix.om.typecomputer.base.IResultTypeComputer;
+import edu.uci.ics.asterix.om.types.BuiltinType;
+import edu.uci.ics.asterix.om.types.IAType;
+import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
+import edu.uci.ics.hyracks.algebricks.core.algebra.base.ILogicalExpression;
+import edu.uci.ics.hyracks.algebricks.core.algebra.expressions.IVariableTypeEnvironment;
+import edu.uci.ics.hyracks.algebricks.core.algebra.metadata.IMetadataProvider;
+
+public class AnyTypeComputer implements IResultTypeComputer {
+
+    public static final AnyTypeComputer INSTANCE = new AnyTypeComputer();
+
+    private AnyTypeComputer() {
+    }
+
+    @Override
+    public IAType computeType(ILogicalExpression expression, IVariableTypeEnvironment env,
+            IMetadataProvider<?, ?> metadataProvider) throws AlgebricksException {
+        return BuiltinType.ANY;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/FieldAccessNestedResultType.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/FieldAccessNestedResultType.java b/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/FieldAccessNestedResultType.java
index 2aef736..fbc2ca8 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/FieldAccessNestedResultType.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/FieldAccessNestedResultType.java
@@ -36,7 +36,7 @@ import edu.uci.ics.hyracks.algebricks.core.algebra.expressions.IVariableTypeEnvi
 import edu.uci.ics.hyracks.algebricks.core.algebra.metadata.IMetadataProvider;
 
 public class FieldAccessNestedResultType implements IResultTypeComputer {
-
+    private static final long serialVersionUID = 1L;
     public static final FieldAccessNestedResultType INSTANCE = new FieldAccessNestedResultType();
 
     private FieldAccessNestedResultType() {
@@ -65,15 +65,24 @@ public class FieldAccessNestedResultType implements IResultTypeComputer {
             throw new AlgebricksException("Typing error: expecting a constant value, found " + ce + " instead.");
         }
         IAObject v = ((AsterixConstantValue) ce.getValue()).getObject();
-        if (v.getType().getTypeTag() != ATypeTag.ORDEREDLIST) {
-            throw new AlgebricksException("Typing error: expecting a String, found " + ce + " instead.");
-        }
         List<String> fieldPath = new ArrayList<String>();
-        for (int i = 0; i < ((AOrderedList)v).size(); i++){
-            fieldPath.add(((AString)((AOrderedList) v).getItem(i)).getStringValue());
+        if (v.getType().getTypeTag() == ATypeTag.ORDEREDLIST) {
+            for (int i = 0; i < ((AOrderedList) v).size(); i++) {
+                fieldPath.add(((AString) ((AOrderedList) v).getItem(i)).getStringValue());
+            }
+        } else if (v.getType().getTypeTag() == ATypeTag.STRING) {
+            fieldPath.add(((AString) v).getStringValue());
+        } else {
+            throw new AlgebricksException("Typing error: expecting a String, found " + ce + " instead.");
         }
         try {
-            return t0.getSubFieldType(fieldPath);
+            IAType subType = t0.getSubFieldType(fieldPath);
+            if (subType != null) {
+                return subType;
+            } else {
+                // Open field. Type can only be determined at runtime.
+                return BuiltinType.ANY;
+            }
         } catch (IOException e) {
             throw new AlgebricksException("FieldPath was invalid.");
         }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/SubsetCollectionTypeComputer.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/SubsetCollectionTypeComputer.java b/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/SubsetCollectionTypeComputer.java
new file mode 100644
index 0000000..b2b829b
--- /dev/null
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/SubsetCollectionTypeComputer.java
@@ -0,0 +1,71 @@
+/*
+ * Copyright 2009-2013 by The Regents of the University of California
+ * Licensed 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 from
+ * 
+ *     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.
+ */
+package edu.uci.ics.asterix.om.typecomputer.impl;
+
+import edu.uci.ics.asterix.om.typecomputer.base.IResultTypeComputer;
+import edu.uci.ics.asterix.om.types.AOrderedListType;
+import edu.uci.ics.asterix.om.types.ATypeTag;
+import edu.uci.ics.asterix.om.types.AUnionType;
+import edu.uci.ics.asterix.om.types.AbstractCollectionType;
+import edu.uci.ics.asterix.om.types.BuiltinType;
+import edu.uci.ics.asterix.om.types.IAType;
+import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
+import edu.uci.ics.hyracks.algebricks.core.algebra.base.ILogicalExpression;
+import edu.uci.ics.hyracks.algebricks.core.algebra.expressions.AbstractFunctionCallExpression;
+import edu.uci.ics.hyracks.algebricks.core.algebra.expressions.IVariableTypeEnvironment;
+import edu.uci.ics.hyracks.algebricks.core.algebra.metadata.IMetadataProvider;
+
+public class SubsetCollectionTypeComputer implements IResultTypeComputer {
+
+    public static final SubsetCollectionTypeComputer INSTANCE = new SubsetCollectionTypeComputer();
+
+    private SubsetCollectionTypeComputer() {
+    }
+
+    @Override
+    public IAType computeType(ILogicalExpression expression, IVariableTypeEnvironment env, IMetadataProvider<?, ?> mp)
+            throws AlgebricksException {
+        AbstractFunctionCallExpression fun = (AbstractFunctionCallExpression) expression;
+        IAType t;
+        try {
+            t = (IAType) env.getType(fun.getArguments().get(0).getValue());
+        } catch (AlgebricksException e) {
+            throw new AlgebricksException(e);
+        }
+        switch (t.getTypeTag()) {
+            case UNORDEREDLIST:
+            case ORDEREDLIST: {
+                AbstractCollectionType act = (AbstractCollectionType) t;
+                return act.getItemType();
+            }
+            case UNION: {
+                AUnionType ut = (AUnionType) t;
+                if (!ut.isNullableType()) {
+                    throw new AlgebricksException("Expecting collection type. Found " + t);
+                }
+                IAType t2 = ut.getUnionList().get(1);
+                ATypeTag tag2 = t2.getTypeTag();
+                if (tag2 == ATypeTag.UNORDEREDLIST || tag2 == ATypeTag.ORDEREDLIST) {
+                    AbstractCollectionType act = (AbstractCollectionType) t2;
+                    return act.getItemType();
+                }
+                throw new AlgebricksException("Expecting collection type. Found " + t);
+            }
+            default: {
+                throw new AlgebricksException("Expecting collection type. Found " + t);
+            }
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-om/src/main/java/edu/uci/ics/asterix/om/util/NonTaggedFormatUtil.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/om/util/NonTaggedFormatUtil.java b/asterix-om/src/main/java/edu/uci/ics/asterix/om/util/NonTaggedFormatUtil.java
index e141660..db83bf3 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/om/util/NonTaggedFormatUtil.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/om/util/NonTaggedFormatUtil.java
@@ -47,6 +47,7 @@ public final class NonTaggedFormatUtil {
             case RECORD:
             case ORDEREDLIST:
             case UNORDEREDLIST:
+            case POLYGON:
             case ANY:
                 return false;
             case UNION:

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/common/FieldAccessByIndexEvalFactory.java
----------------------------------------------------------------------
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/common/FieldAccessByIndexEvalFactory.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/common/FieldAccessByIndexEvalFactory.java
deleted file mode 100644
index 3303364..0000000
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/common/FieldAccessByIndexEvalFactory.java
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
- * Copyright 2009-2013 by The Regents of the University of California
- * Licensed 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 from
- *
- *     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.
- */
-package edu.uci.ics.asterix.runtime.evaluators.common;
-
-import java.io.DataOutput;
-import java.io.IOException;
-
-import edu.uci.ics.asterix.common.exceptions.AsterixException;
-import edu.uci.ics.asterix.dataflow.data.nontagged.serde.ARecordSerializerDeserializer;
-import edu.uci.ics.asterix.formats.nontagged.AqlSerializerDeserializerProvider;
-import edu.uci.ics.asterix.om.base.ANull;
-import edu.uci.ics.asterix.om.types.ARecordType;
-import edu.uci.ics.asterix.om.types.ATypeTag;
-import edu.uci.ics.asterix.om.types.AUnionType;
-import edu.uci.ics.asterix.om.types.BuiltinType;
-import edu.uci.ics.asterix.om.types.EnumDeserializer;
-import edu.uci.ics.asterix.om.types.IAType;
-import edu.uci.ics.asterix.om.util.NonTaggedFormatUtil;
-import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
-import edu.uci.ics.hyracks.algebricks.common.exceptions.NotImplementedException;
-import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
-import edu.uci.ics.hyracks.api.dataflow.value.ISerializerDeserializer;
-import edu.uci.ics.hyracks.data.std.api.IDataOutputProvider;
-import edu.uci.ics.hyracks.data.std.primitive.IntegerPointable;
-import edu.uci.ics.hyracks.data.std.util.ArrayBackedValueStorage;
-import edu.uci.ics.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
-
-public class FieldAccessByIndexEvalFactory implements ICopyEvaluatorFactory {
-
-    private static final long serialVersionUID = 1L;
-
-    private ICopyEvaluatorFactory recordEvalFactory;
-    private ICopyEvaluatorFactory fieldIndexEvalFactory;
-    private int nullBitmapSize;
-    private ARecordType recordType;
-    private final static byte SER_NULL_TYPE_TAG = ATypeTag.NULL.serialize();
-    private final static byte SER_RECORD_TYPE_TAG = ATypeTag.RECORD.serialize();
-
-    public FieldAccessByIndexEvalFactory(ICopyEvaluatorFactory recordEvalFactory,
-            ICopyEvaluatorFactory fieldIndexEvalFactory, ARecordType recordType) {
-        this.recordEvalFactory = recordEvalFactory;
-        this.fieldIndexEvalFactory = fieldIndexEvalFactory;
-        this.recordType = recordType;
-        this.nullBitmapSize = ARecordType.computeNullBitmapSize(recordType);
-
-    }
-
-    @Override
-    public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
-        return new ICopyEvaluator() {
-
-            private DataOutput out = output.getDataOutput();
-
-            private ArrayBackedValueStorage outInput0 = new ArrayBackedValueStorage();
-            private ArrayBackedValueStorage outInput1 = new ArrayBackedValueStorage();
-            private ICopyEvaluator eval0 = recordEvalFactory.createEvaluator(outInput0);
-            private ICopyEvaluator eval1 = fieldIndexEvalFactory.createEvaluator(outInput1);
-            @SuppressWarnings("unchecked")
-            private ISerializerDeserializer<ANull> nullSerde = AqlSerializerDeserializerProvider.INSTANCE
-                    .getSerializerDeserializer(BuiltinType.ANULL);
-            private int fieldIndex;
-            private int fieldValueOffset;
-            private int fieldValueLength;
-            private IAType fieldValueType;
-            private ATypeTag fieldValueTypeTag = ATypeTag.NULL;
-
-            @Override
-            public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
-                try {
-                    outInput0.reset();
-                    eval0.evaluate(tuple);
-                    outInput1.reset();
-                    eval1.evaluate(tuple);
-                    byte[] serRecord = outInput0.getByteArray();
-
-                    if (serRecord[0] == SER_NULL_TYPE_TAG) {
-                        nullSerde.serialize(ANull.NULL, out);
-                        return;
-                    }
-
-                    if (serRecord[0] != SER_RECORD_TYPE_TAG) {
-                        throw new AlgebricksException("Field accessor is not defined for values of type "
-                                + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(serRecord[0]));
-                    }
-
-                    fieldIndex = IntegerPointable.getInteger(outInput1.getByteArray(), 1);
-                    fieldValueOffset = ARecordSerializerDeserializer.getFieldOffsetById(serRecord, fieldIndex,
-                            nullBitmapSize, recordType.isOpen());
-
-                    if (fieldValueOffset == 0) {
-                        // the field is null, we checked the null bit map
-                        out.writeByte(SER_NULL_TYPE_TAG);
-                        return;
-                    }
-
-                    fieldValueType = recordType.getFieldTypes()[fieldIndex];
-                    if (fieldValueType.getTypeTag().equals(ATypeTag.UNION)) {
-                        if (NonTaggedFormatUtil.isOptionalField((AUnionType) fieldValueType)) {
-                            fieldValueTypeTag = ((AUnionType) fieldValueType).getUnionList()
-                                    .get(AUnionType.OPTIONAL_TYPE_INDEX_IN_UNION_LIST).getTypeTag();
-                            fieldValueLength = NonTaggedFormatUtil.getFieldValueLength(serRecord, fieldValueOffset,
-                                    fieldValueTypeTag, false);
-                            out.writeByte(fieldValueTypeTag.serialize());
-                        } else {
-                            // union .. the general case
-                            throw new NotImplementedException();
-                        }
-                    } else {
-                        fieldValueTypeTag = fieldValueType.getTypeTag();
-                        fieldValueLength = NonTaggedFormatUtil.getFieldValueLength(serRecord, fieldValueOffset,
-                                fieldValueTypeTag, false);
-                        out.writeByte(fieldValueTypeTag.serialize());
-                    }
-                    out.write(serRecord, fieldValueOffset, fieldValueLength);
-
-                } catch (IOException e) {
-                    throw new AlgebricksException(e);
-                } catch (AsterixException e) {
-                    throw new AlgebricksException(e);
-                }
-            }
-        };
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/common/FieldAccessNestedEvalFactory.java
----------------------------------------------------------------------
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/common/FieldAccessNestedEvalFactory.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/common/FieldAccessNestedEvalFactory.java
deleted file mode 100644
index bb98253..0000000
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/common/FieldAccessNestedEvalFactory.java
+++ /dev/null
@@ -1,231 +0,0 @@
-/*
- * Copyright 2009-2013 by The Regents of the University of California
- * Licensed 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 from
- *
- *     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.
- */
-
-package edu.uci.ics.asterix.runtime.evaluators.common;
-
-import java.io.DataOutput;
-import java.io.IOException;
-import java.util.Arrays;
-import java.util.List;
-
-import edu.uci.ics.asterix.common.exceptions.AsterixException;
-import edu.uci.ics.asterix.dataflow.data.nontagged.serde.ARecordSerializerDeserializer;
-import edu.uci.ics.asterix.formats.nontagged.AqlSerializerDeserializerProvider;
-import edu.uci.ics.asterix.om.base.ANull;
-import edu.uci.ics.asterix.om.base.AString;
-import edu.uci.ics.asterix.om.types.ARecordType;
-import edu.uci.ics.asterix.om.types.ATypeTag;
-import edu.uci.ics.asterix.om.types.AUnionType;
-import edu.uci.ics.asterix.om.types.BuiltinType;
-import edu.uci.ics.asterix.om.types.EnumDeserializer;
-import edu.uci.ics.asterix.om.types.IAType;
-import edu.uci.ics.asterix.om.util.NonTaggedFormatUtil;
-import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
-import edu.uci.ics.hyracks.algebricks.common.exceptions.NotImplementedException;
-import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
-import edu.uci.ics.hyracks.api.dataflow.value.ISerializerDeserializer;
-import edu.uci.ics.hyracks.api.exceptions.HyracksDataException;
-import edu.uci.ics.hyracks.data.std.api.IDataOutputProvider;
-import edu.uci.ics.hyracks.data.std.util.ArrayBackedValueStorage;
-import edu.uci.ics.hyracks.data.std.util.ByteArrayAccessibleOutputStream;
-import edu.uci.ics.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
-
-public class FieldAccessNestedEvalFactory implements ICopyEvaluatorFactory {
-
-    private static final long serialVersionUID = 1L;
-
-    private ICopyEvaluatorFactory recordEvalFactory;
-    private ICopyEvaluatorFactory fldNameEvalFactory;
-    private ARecordType recordType;
-    private List<String> fieldPath;
-
-    private final static byte SER_NULL_TYPE_TAG = ATypeTag.NULL.serialize();
-    private final static byte SER_RECORD_TYPE_TAG = ATypeTag.RECORD.serialize();
-
-    public FieldAccessNestedEvalFactory(ICopyEvaluatorFactory recordEvalFactory,
-            ICopyEvaluatorFactory fldNameEvalFactory, ARecordType recordType, List<String> fldName) {
-        this.recordEvalFactory = recordEvalFactory;
-        this.fldNameEvalFactory = fldNameEvalFactory;
-        this.recordType = recordType;
-        this.fieldPath = fldName;
-
-    }
-
-    @Override
-    public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
-        return new ICopyEvaluator() {
-
-            private DataOutput out = output.getDataOutput();
-
-            private ArrayBackedValueStorage outInput0 = new ArrayBackedValueStorage();
-            private ArrayBackedValueStorage outInput1 = new ArrayBackedValueStorage();
-            private ByteArrayAccessibleOutputStream subRecordTmpStream = new ByteArrayAccessibleOutputStream();
-            private ICopyEvaluator eval0 = recordEvalFactory.createEvaluator(outInput0);
-            private ICopyEvaluator eval1 = fldNameEvalFactory.createEvaluator(outInput1);
-            @SuppressWarnings("unchecked")
-            private ISerializerDeserializer<ANull> nullSerde = AqlSerializerDeserializerProvider.INSTANCE
-                    .getSerializerDeserializer(BuiltinType.ANULL);
-            private ArrayBackedValueStorage[] abvs = new ArrayBackedValueStorage[fieldPath.size()];
-            private DataOutput[] dos = new DataOutput[fieldPath.size()];
-            private AString[] as = new AString[fieldPath.size()];
-
-            {
-                for (int i = 0; i < fieldPath.size(); i++) {
-                    abvs[i] = new ArrayBackedValueStorage();
-                    dos[i] = abvs[i].getDataOutput();
-                    as[i] = new AString(fieldPath.get(i));
-                    try {
-                        AqlSerializerDeserializerProvider.INSTANCE.getSerializerDeserializer(as[i].getType())
-                                .serialize(as[i], dos[i]);
-                    } catch (HyracksDataException e) {
-                        throw new AlgebricksException(e);
-                    }
-                }
-                recordType = recordType.deepCopy(recordType);
-
-            }
-
-            public int checkType(byte[] serRecord) throws AlgebricksException {
-                if (serRecord[0] == SER_NULL_TYPE_TAG) {
-                    try {
-                        nullSerde.serialize(ANull.NULL, out);
-                    } catch (HyracksDataException e) {
-                        throw new AlgebricksException(e);
-                    }
-                    return -1;
-                }
-
-                if (serRecord[0] != SER_RECORD_TYPE_TAG) {
-                    throw new AlgebricksException("Field accessor is not defined for values of type "
-                            + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(serRecord[0]));
-                }
-                return 0;
-            }
-
-            @Override
-            public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
-
-                try {
-                    outInput0.reset();
-                    eval0.evaluate(tuple);
-                    outInput1.reset();
-                    eval1.evaluate(tuple);
-
-                    int subFieldIndex = -1;
-                    int subFieldOffset = -1;
-                    int subFieldLength = -1;
-                    int nullBitmapSize = -1;
-                    IAType subType = recordType;
-                    ATypeTag subTypeTag = ATypeTag.NULL;
-                    byte[] subRecord = outInput0.getByteArray();
-                    boolean openField = false;
-                    int i = 0;
-
-                    if (checkType(subRecord) == -1) {
-                        return;
-                    }
-
-                    //Moving through closed fields
-                    for (; i < fieldPath.size(); i++) {
-                        if (subType.getTypeTag().equals(ATypeTag.UNION)) {
-                            //enforced SubType
-                            subType = ((AUnionType) subType).getUnionList().get(
-                                    AUnionType.OPTIONAL_TYPE_INDEX_IN_UNION_LIST);
-                            if (subType.getTypeTag().serialize() != SER_RECORD_TYPE_TAG) {
-                                throw new AlgebricksException("Field accessor is not defined for values of type "
-                                        + subTypeTag);
-                            }
-
-                        }
-                        subFieldIndex = ((ARecordType) subType).findFieldPosition(fieldPath.get(i));
-                        if (subFieldIndex == -1) {
-                            break;
-                        }
-                        nullBitmapSize = ARecordType.computeNullBitmapSize((ARecordType) subType);
-                        subFieldOffset = ARecordSerializerDeserializer.getFieldOffsetById(subRecord, subFieldIndex,
-                                nullBitmapSize, ((ARecordType) subType).isOpen());
-                        if (subFieldOffset == 0) {
-                            // the field is null, we checked the null bit map
-                            out.writeByte(SER_NULL_TYPE_TAG);
-                            return;
-                        }
-                        subType = ((ARecordType) subType).getFieldTypes()[subFieldIndex];
-                        if (subType.getTypeTag().equals(ATypeTag.UNION)) {
-                            if (NonTaggedFormatUtil.isOptionalField((AUnionType) subType)) {
-                                subTypeTag = ((AUnionType) subType).getUnionList()
-                                        .get(AUnionType.OPTIONAL_TYPE_INDEX_IN_UNION_LIST).getTypeTag();
-                                subFieldLength = NonTaggedFormatUtil.getFieldValueLength(subRecord, subFieldOffset,
-                                        subTypeTag, false);
-                            } else {
-                                // union .. the general case
-                                throw new NotImplementedException();
-                            }
-                        } else {
-                            subTypeTag = subType.getTypeTag();
-                            subFieldLength = NonTaggedFormatUtil.getFieldValueLength(subRecord, subFieldOffset,
-                                    subTypeTag, false);
-                        }
-
-                        if (i < fieldPath.size() - 1) {
-                            //setup next iteration
-                            subRecordTmpStream.reset();
-                            subRecordTmpStream.write(subTypeTag.serialize());
-                            subRecordTmpStream.write(subRecord, subFieldOffset, subFieldLength);
-                            subRecord = subRecordTmpStream.getByteArray();
-
-                            if (checkType(subRecord) == -1) {
-                                return;
-                            }
-                        }
-                    }
-
-                    //Moving through open fields
-                    for (; i < fieldPath.size(); i++) {
-                        openField = true;
-                        subFieldOffset = ARecordSerializerDeserializer.getFieldOffsetByName(subRecord,
-                                abvs[i].getByteArray());
-                        if (subFieldOffset < 0) {
-                            out.writeByte(SER_NULL_TYPE_TAG);
-                            return;
-                        }
-
-                        subTypeTag = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(subRecord[subFieldOffset]);
-                        subFieldLength = NonTaggedFormatUtil.getFieldValueLength(subRecord, subFieldOffset, subTypeTag,
-                                true) + 1;
-
-                        if (i < fieldPath.size() - 1) {
-                            //setup next iteration
-                            subRecord = Arrays.copyOfRange(subRecord, subFieldOffset, subFieldOffset + subFieldLength);
-
-                            if (checkType(subRecord) == -1) {
-                                return;
-                            }
-                        }
-                    }
-                    if (!openField) {
-                        out.writeByte(subTypeTag.serialize());
-                    }
-                    out.write(subRecord, subFieldOffset, subFieldLength);
-
-                } catch (IOException e) {
-                    throw new AlgebricksException(e);
-                } catch (AsterixException e) {
-                    throw new AlgebricksException(e);
-                }
-            }
-        };
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/constructors/ClosedRecordConstructorDescriptor.java
----------------------------------------------------------------------
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/constructors/ClosedRecordConstructorDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/constructors/ClosedRecordConstructorDescriptor.java
new file mode 100644
index 0000000..dceb12a
--- /dev/null
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/constructors/ClosedRecordConstructorDescriptor.java
@@ -0,0 +1,52 @@
+/*
+ * Copyright 2009-2013 by The Regents of the University of California
+ * Licensed 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 from
+ *
+ *     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.
+ */
+package edu.uci.ics.asterix.runtime.evaluators.constructors;
+
+import edu.uci.ics.asterix.om.functions.AsterixBuiltinFunctions;
+import edu.uci.ics.asterix.om.functions.IFunctionDescriptor;
+import edu.uci.ics.asterix.om.functions.IFunctionDescriptorFactory;
+import edu.uci.ics.asterix.om.types.ARecordType;
+import edu.uci.ics.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
+import edu.uci.ics.asterix.runtime.evaluators.common.ClosedRecordConstructorEvalFactory;
+import edu.uci.ics.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+
+public class ClosedRecordConstructorDescriptor extends AbstractScalarFunctionDynamicDescriptor {
+
+    public static final IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() {
+        public IFunctionDescriptor createFunctionDescriptor() {
+            return new ClosedRecordConstructorDescriptor();
+        }
+    };
+
+    private static final long serialVersionUID = 1L;
+
+    private ARecordType recType;
+
+    public void reset(ARecordType recType) {
+        this.recType = recType;
+    }
+
+    @Override
+    public FunctionIdentifier getIdentifier() {
+        return AsterixBuiltinFunctions.CLOSED_RECORD_CONSTRUCTOR;
+    }
+
+    @Override
+    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) {
+        return new ClosedRecordConstructorEvalFactory(args, recType);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/constructors/OpenRecordConstructorDescriptor.java
----------------------------------------------------------------------
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/constructors/OpenRecordConstructorDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/constructors/OpenRecordConstructorDescriptor.java
new file mode 100644
index 0000000..2f5ca11
--- /dev/null
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/constructors/OpenRecordConstructorDescriptor.java
@@ -0,0 +1,113 @@
+/*
+ * Copyright 2009-2013 by The Regents of the University of California
+ * Licensed 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 from
+ *
+ *     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.
+ */
+
+package edu.uci.ics.asterix.runtime.evaluators.constructors;
+
+import java.io.DataOutput;
+import java.io.IOException;
+
+import edu.uci.ics.asterix.builders.RecordBuilder;
+import edu.uci.ics.asterix.common.exceptions.AsterixException;
+import edu.uci.ics.asterix.om.functions.AsterixBuiltinFunctions;
+import edu.uci.ics.asterix.om.functions.IFunctionDescriptor;
+import edu.uci.ics.asterix.om.functions.IFunctionDescriptorFactory;
+import edu.uci.ics.asterix.om.types.ARecordType;
+import edu.uci.ics.asterix.om.types.ATypeTag;
+import edu.uci.ics.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
+import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
+import edu.uci.ics.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluator;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import edu.uci.ics.hyracks.data.std.api.IDataOutputProvider;
+import edu.uci.ics.hyracks.data.std.util.ArrayBackedValueStorage;
+import edu.uci.ics.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
+
+public class OpenRecordConstructorDescriptor extends AbstractScalarFunctionDynamicDescriptor {
+
+    public static final IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() {
+        public IFunctionDescriptor createFunctionDescriptor() {
+            return new OpenRecordConstructorDescriptor();
+        }
+    };
+
+    private static final long serialVersionUID = 1L;
+    private ARecordType recType;
+    private boolean[] openFields;
+
+    public void reset(ARecordType recType, boolean[] openFields) {
+        this.recType = recType;
+        this.openFields = openFields;
+    }
+
+    @Override
+    public FunctionIdentifier getIdentifier() {
+        return AsterixBuiltinFunctions.OPEN_RECORD_CONSTRUCTOR;
+    }
+
+    @Override
+    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) {
+        return new ICopyEvaluatorFactory() {
+            private static final long serialVersionUID = 1L;
+
+            @Override
+            public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
+                int n = args.length / 2;
+                final ICopyEvaluator[] evalNames = new ICopyEvaluator[n];
+                final ICopyEvaluator[] evalFields = new ICopyEvaluator[n];
+                final ArrayBackedValueStorage fieldNameBuffer = new ArrayBackedValueStorage();
+                final ArrayBackedValueStorage fieldValueBuffer = new ArrayBackedValueStorage();
+                for (int i = 0; i < n; i++) {
+                    evalNames[i] = args[2 * i].createEvaluator(fieldNameBuffer);
+                    evalFields[i] = args[2 * i + 1].createEvaluator(fieldValueBuffer);
+                }
+                final DataOutput out = output.getDataOutput();
+                return new ICopyEvaluator() {
+                    private RecordBuilder recBuilder = new RecordBuilder();
+                    private int closedFieldId;
+                    private boolean first = true;
+
+                    @Override
+                    public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
+                        try {
+                            closedFieldId = 0;
+                            if (first) {
+                                first = false;
+                                recBuilder.reset(recType);
+                            }
+                            recBuilder.init();
+                            for (int i = 0; i < evalFields.length; i++) {
+                                fieldValueBuffer.reset();
+                                evalFields[i].evaluate(tuple);
+                                if (openFields[i]) {
+                                    fieldNameBuffer.reset();
+                                    evalNames[i].evaluate(tuple);
+                                    recBuilder.addField(fieldNameBuffer, fieldValueBuffer);
+                                } else {
+                                    if (fieldValueBuffer.getByteArray()[0] != ATypeTag.NULL.serialize()) {
+                                        recBuilder.addField(closedFieldId, fieldValueBuffer);
+                                    }
+                                    closedFieldId++;
+                                }
+                            }
+                            recBuilder.write(out, true);
+                        } catch (IOException | AsterixException e) {
+                            throw new AlgebricksException(e);
+                        }
+                    }
+                };
+            }
+        };
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/ClosedRecordConstructorDescriptor.java
----------------------------------------------------------------------
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/ClosedRecordConstructorDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/ClosedRecordConstructorDescriptor.java
deleted file mode 100644
index 383b7a3..0000000
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/ClosedRecordConstructorDescriptor.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright 2009-2013 by The Regents of the University of California
- * Licensed 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 from
- *
- *     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.
- */
-package edu.uci.ics.asterix.runtime.evaluators.functions;
-
-import edu.uci.ics.asterix.om.functions.AsterixBuiltinFunctions;
-import edu.uci.ics.asterix.om.functions.IFunctionDescriptor;
-import edu.uci.ics.asterix.om.functions.IFunctionDescriptorFactory;
-import edu.uci.ics.asterix.om.types.ARecordType;
-import edu.uci.ics.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
-import edu.uci.ics.asterix.runtime.evaluators.common.ClosedRecordConstructorEvalFactory;
-import edu.uci.ics.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
-
-public class ClosedRecordConstructorDescriptor extends AbstractScalarFunctionDynamicDescriptor {
-
-    public static final IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() {
-        public IFunctionDescriptor createFunctionDescriptor() {
-            return new ClosedRecordConstructorDescriptor();
-        }
-    };
-
-    private static final long serialVersionUID = 1L;
-
-    private ARecordType recType;
-
-    public void reset(ARecordType recType) {
-        this.recType = recType;
-    }
-
-    @Override
-    public FunctionIdentifier getIdentifier() {
-        return AsterixBuiltinFunctions.CLOSED_RECORD_CONSTRUCTOR;
-    }
-
-    @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) {
-        return new ClosedRecordConstructorEvalFactory(args, recType);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/FieldAccessByIndexDescriptor.java
----------------------------------------------------------------------
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/FieldAccessByIndexDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/FieldAccessByIndexDescriptor.java
deleted file mode 100644
index 9a2c19b..0000000
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/FieldAccessByIndexDescriptor.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright 2009-2013 by The Regents of the University of California
- * Licensed 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 from
- *
- *     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.
- */
-package edu.uci.ics.asterix.runtime.evaluators.functions;
-
-import edu.uci.ics.asterix.om.functions.AsterixBuiltinFunctions;
-import edu.uci.ics.asterix.om.functions.IFunctionDescriptor;
-import edu.uci.ics.asterix.om.functions.IFunctionDescriptorFactory;
-import edu.uci.ics.asterix.om.types.ARecordType;
-import edu.uci.ics.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
-import edu.uci.ics.asterix.runtime.evaluators.common.FieldAccessByIndexEvalFactory;
-import edu.uci.ics.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
-
-public class FieldAccessByIndexDescriptor extends AbstractScalarFunctionDynamicDescriptor {
-
-    private static final long serialVersionUID = 1L;
-    public static final IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() {
-        public IFunctionDescriptor createFunctionDescriptor() {
-            return new FieldAccessByIndexDescriptor();
-        }
-    };
-
-    private ARecordType recType;
-
-    public void reset(ARecordType recType) {
-        this.recType = recType;
-    }
-
-    @Override
-    public FunctionIdentifier getIdentifier() {
-        return AsterixBuiltinFunctions.FIELD_ACCESS_BY_INDEX;
-    }
-
-    @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(ICopyEvaluatorFactory[] args) {
-        return new FieldAccessByIndexEvalFactory(args[0], args[1], recType);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/FieldAccessByNameDescriptor.java
----------------------------------------------------------------------
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/FieldAccessByNameDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/FieldAccessByNameDescriptor.java
deleted file mode 100644
index 3b7e545..0000000
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/FieldAccessByNameDescriptor.java
+++ /dev/null
@@ -1,137 +0,0 @@
-/*
- * Copyright 2009-2013 by The Regents of the University of California
- * Licensed 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 from
- *
- *     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.
- */
-package edu.uci.ics.asterix.runtime.evaluators.functions;
-
-import java.io.DataOutput;
-import java.io.IOException;
-
-import edu.uci.ics.asterix.common.exceptions.AsterixException;
-import edu.uci.ics.asterix.dataflow.data.nontagged.serde.ARecordSerializerDeserializer;
-import edu.uci.ics.asterix.formats.nontagged.AqlSerializerDeserializerProvider;
-import edu.uci.ics.asterix.om.base.ANull;
-import edu.uci.ics.asterix.om.functions.AsterixBuiltinFunctions;
-import edu.uci.ics.asterix.om.functions.IFunctionDescriptor;
-import edu.uci.ics.asterix.om.functions.IFunctionDescriptorFactory;
-import edu.uci.ics.asterix.om.types.ATypeTag;
-import edu.uci.ics.asterix.om.types.BuiltinType;
-import edu.uci.ics.asterix.om.types.EnumDeserializer;
-import edu.uci.ics.asterix.om.util.NonTaggedFormatUtil;
-import edu.uci.ics.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
-import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
-import edu.uci.ics.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
-import edu.uci.ics.hyracks.api.dataflow.value.ISerializerDeserializer;
-import edu.uci.ics.hyracks.data.std.api.IDataOutputProvider;
-import edu.uci.ics.hyracks.data.std.util.ArrayBackedValueStorage;
-import edu.uci.ics.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
-
-public class FieldAccessByNameDescriptor extends AbstractScalarFunctionDynamicDescriptor {
-
-    private static final long serialVersionUID = 1L;
-    public static final IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() {
-        public IFunctionDescriptor createFunctionDescriptor() {
-            return new FieldAccessByNameDescriptor();
-        }
-    };
-
-    @Override
-    public FunctionIdentifier getIdentifier() {
-        return AsterixBuiltinFunctions.FIELD_ACCESS_BY_NAME;
-    }
-
-    @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(ICopyEvaluatorFactory[] args) {
-        return new FieldAccessByNameEvalFactory(args[0], args[1]);
-    }
-
-    private static class FieldAccessByNameEvalFactory implements ICopyEvaluatorFactory {
-
-        private static final long serialVersionUID = 1L;
-
-        private ICopyEvaluatorFactory recordEvalFactory;
-        private ICopyEvaluatorFactory fldNameEvalFactory;
-
-        private final static byte SER_NULL_TYPE_TAG = ATypeTag.NULL.serialize();
-        private final static byte SER_RECORD_TYPE_TAG = ATypeTag.RECORD.serialize();
-
-        public FieldAccessByNameEvalFactory(ICopyEvaluatorFactory recordEvalFactory,
-                ICopyEvaluatorFactory fldNameEvalFactory) {
-            this.recordEvalFactory = recordEvalFactory;
-            this.fldNameEvalFactory = fldNameEvalFactory;
-        }
-
-        @Override
-        public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
-            return new ICopyEvaluator() {
-
-                private DataOutput out = output.getDataOutput();
-
-                private ArrayBackedValueStorage outInput0 = new ArrayBackedValueStorage();
-                private ArrayBackedValueStorage outInput1 = new ArrayBackedValueStorage();
-                private ICopyEvaluator eval0 = recordEvalFactory.createEvaluator(outInput0);
-                private ICopyEvaluator eval1 = fldNameEvalFactory.createEvaluator(outInput1);
-                @SuppressWarnings("unchecked")
-                private ISerializerDeserializer<ANull> nullSerde = AqlSerializerDeserializerProvider.INSTANCE
-                        .getSerializerDeserializer(BuiltinType.ANULL);
-                private int fieldValueOffset;
-                private int fieldValueLength;
-                private ATypeTag fieldValueTypeTag = ATypeTag.NULL;
-
-                @Override
-                public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
-
-                    try {
-                        outInput0.reset();
-                        eval0.evaluate(tuple);
-                        outInput1.reset();
-                        eval1.evaluate(tuple);
-                        byte[] serRecord = outInput0.getByteArray();
-
-                        if (serRecord[0] == SER_NULL_TYPE_TAG) {
-                            nullSerde.serialize(ANull.NULL, out);
-                            return;
-                        }
-
-                        if (serRecord[0] != SER_RECORD_TYPE_TAG) {
-                            throw new AlgebricksException(AsterixBuiltinFunctions.FIELD_ACCESS_BY_NAME.getName()
-                                    + ": expects input type NULL or RECORD, but got "
-                                    + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(serRecord[0]));
-                        }
-
-                        byte[] serFldName = outInput1.getByteArray();
-                        fieldValueOffset = ARecordSerializerDeserializer.getFieldOffsetByName(serRecord, serFldName);
-                        if (fieldValueOffset < 0) {
-                            out.writeByte(ATypeTag.NULL.serialize());
-                            return;
-                        }
-
-                        fieldValueTypeTag = EnumDeserializer.ATYPETAGDESERIALIZER
-                                .deserialize(serRecord[fieldValueOffset]);
-                        fieldValueLength = NonTaggedFormatUtil.getFieldValueLength(serRecord, fieldValueOffset,
-                                fieldValueTypeTag, true) + 1;
-                        out.write(serRecord, fieldValueOffset, fieldValueLength);
-
-                    } catch (IOException e) {
-                        throw new AlgebricksException(e);
-                    } catch (AsterixException e) {
-                        throw new AlgebricksException(e);
-                    }
-                }
-            };
-        }
-
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/FieldAccessNestedDescriptor.java
----------------------------------------------------------------------
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/FieldAccessNestedDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/FieldAccessNestedDescriptor.java
deleted file mode 100644
index be2b043..0000000
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/FieldAccessNestedDescriptor.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Copyright 2009-2013 by The Regents of the University of California
- * Licensed 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 from
- *
- *     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.
- */
-package edu.uci.ics.asterix.runtime.evaluators.functions;
-
-import java.util.List;
-
-import edu.uci.ics.asterix.om.functions.AsterixBuiltinFunctions;
-import edu.uci.ics.asterix.om.functions.IFunctionDescriptor;
-import edu.uci.ics.asterix.om.functions.IFunctionDescriptorFactory;
-import edu.uci.ics.asterix.om.types.ARecordType;
-import edu.uci.ics.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
-import edu.uci.ics.asterix.runtime.evaluators.common.FieldAccessNestedEvalFactory;
-import edu.uci.ics.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
-
-public class FieldAccessNestedDescriptor extends AbstractScalarFunctionDynamicDescriptor {
-
-    private static final long serialVersionUID = 1L;
-    public static final IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() {
-        public IFunctionDescriptor createFunctionDescriptor() {
-            return new FieldAccessNestedDescriptor();
-        }
-    };
-
-    private ARecordType recType;
-    private List<String> fldName;
-
-    public void reset(ARecordType recType, List<String> fldName) {
-        this.recType = recType;
-        this.fldName = fldName;
-    }
-
-    @Override
-    public FunctionIdentifier getIdentifier() {
-        return AsterixBuiltinFunctions.FIELD_ACCESS_NESTED;
-    }
-
-    @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(ICopyEvaluatorFactory[] args) {
-        return new FieldAccessNestedEvalFactory(args[0], args[1], recType, fldName);
-    }
-
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/OpenRecordConstructorDescriptor.java
----------------------------------------------------------------------
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/OpenRecordConstructorDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/OpenRecordConstructorDescriptor.java
deleted file mode 100644
index 1babb47..0000000
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/OpenRecordConstructorDescriptor.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * Copyright 2009-2013 by The Regents of the University of California
- * Licensed 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 from
- *
- *     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.
- */
-
-package edu.uci.ics.asterix.runtime.evaluators.functions;
-
-import java.io.DataOutput;
-import java.io.IOException;
-
-import edu.uci.ics.asterix.builders.RecordBuilder;
-import edu.uci.ics.asterix.common.exceptions.AsterixException;
-import edu.uci.ics.asterix.om.functions.AsterixBuiltinFunctions;
-import edu.uci.ics.asterix.om.functions.IFunctionDescriptor;
-import edu.uci.ics.asterix.om.functions.IFunctionDescriptorFactory;
-import edu.uci.ics.asterix.om.types.ARecordType;
-import edu.uci.ics.asterix.om.types.ATypeTag;
-import edu.uci.ics.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
-import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
-import edu.uci.ics.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
-import edu.uci.ics.hyracks.data.std.api.IDataOutputProvider;
-import edu.uci.ics.hyracks.data.std.util.ArrayBackedValueStorage;
-import edu.uci.ics.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
-
-public class OpenRecordConstructorDescriptor extends AbstractScalarFunctionDynamicDescriptor {
-
-    public static final IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() {
-        public IFunctionDescriptor createFunctionDescriptor() {
-            return new OpenRecordConstructorDescriptor();
-        }
-    };
-
-    private static final long serialVersionUID = 1L;
-    private ARecordType recType;
-    private boolean[] openFields;
-
-    public void reset(ARecordType recType, boolean[] openFields) {
-        this.recType = recType;
-        this.openFields = openFields;
-    }
-
-    @Override
-    public FunctionIdentifier getIdentifier() {
-        return AsterixBuiltinFunctions.OPEN_RECORD_CONSTRUCTOR;
-    }
-
-    @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) {
-        return new ICopyEvaluatorFactory() {
-            private static final long serialVersionUID = 1L;
-
-            @Override
-            public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
-                int n = args.length / 2;
-                final ICopyEvaluator[] evalNames = new ICopyEvaluator[n];
-                final ICopyEvaluator[] evalFields = new ICopyEvaluator[n];
-                final ArrayBackedValueStorage fieldNameBuffer = new ArrayBackedValueStorage();
-                final ArrayBackedValueStorage fieldValueBuffer = new ArrayBackedValueStorage();
-                for (int i = 0; i < n; i++) {
-                    evalNames[i] = args[2 * i].createEvaluator(fieldNameBuffer);
-                    evalFields[i] = args[2 * i + 1].createEvaluator(fieldValueBuffer);
-                }
-                final DataOutput out = output.getDataOutput();
-                return new ICopyEvaluator() {
-                    private RecordBuilder recBuilder = new RecordBuilder();
-                    private int closedFieldId;
-                    private boolean first = true;
-
-                    @Override
-                    public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
-                        try {
-                            closedFieldId = 0;
-                            if (first) {
-                                first = false;
-                                recBuilder.reset(recType);
-                            }
-                            recBuilder.init();
-                            for (int i = 0; i < evalFields.length; i++) {
-                                fieldValueBuffer.reset();
-                                evalFields[i].evaluate(tuple);
-                                if (openFields[i]) {
-                                    fieldNameBuffer.reset();
-                                    evalNames[i].evaluate(tuple);
-                                    recBuilder.addField(fieldNameBuffer, fieldValueBuffer);
-                                } else {
-                                    if (fieldValueBuffer.getByteArray()[0] != ATypeTag.NULL.serialize()) {
-                                        recBuilder.addField(closedFieldId, fieldValueBuffer);
-                                    }
-                                    closedFieldId++;
-                                }
-                            }
-                            recBuilder.write(out, true);
-                        } catch (IOException | AsterixException e) {
-                            throw new AlgebricksException(e);
-                        }
-                    }
-                };
-            }
-        };
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/RecordMergeDescriptor.java
----------------------------------------------------------------------
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/RecordMergeDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/RecordMergeDescriptor.java
deleted file mode 100644
index bc09690..0000000
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/RecordMergeDescriptor.java
+++ /dev/null
@@ -1,262 +0,0 @@
-/*
- * Copyright 2009-2013 by The Regents of the University of California
- * Licensed 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 from
- *
- *     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.
- */
-package edu.uci.ics.asterix.runtime.evaluators.functions;
-
-import java.io.ByteArrayInputStream;
-import java.io.DataInputStream;
-import java.io.IOException;
-import java.util.Stack;
-
-import edu.uci.ics.asterix.builders.RecordBuilder;
-import edu.uci.ics.asterix.common.exceptions.AsterixException;
-import edu.uci.ics.asterix.dataflow.data.nontagged.serde.AStringSerializerDeserializer;
-import edu.uci.ics.asterix.formats.nontagged.AqlSerializerDeserializerProvider;
-import edu.uci.ics.asterix.om.base.ANull;
-import edu.uci.ics.asterix.om.functions.AsterixBuiltinFunctions;
-import edu.uci.ics.asterix.om.functions.IFunctionDescriptor;
-import edu.uci.ics.asterix.om.functions.IFunctionDescriptorFactory;
-import edu.uci.ics.asterix.om.pointables.ARecordPointable;
-import edu.uci.ics.asterix.om.pointables.PointableAllocator;
-import edu.uci.ics.asterix.om.pointables.base.IVisitablePointable;
-import edu.uci.ics.asterix.om.typecomputer.impl.RecordMergeTypeComputer;
-import edu.uci.ics.asterix.om.types.ARecordType;
-import edu.uci.ics.asterix.om.types.ATypeTag;
-import edu.uci.ics.asterix.om.types.BuiltinType;
-import edu.uci.ics.asterix.om.types.IAType;
-import edu.uci.ics.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
-import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
-import edu.uci.ics.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
-import edu.uci.ics.hyracks.api.dataflow.value.ISerializerDeserializer;
-import edu.uci.ics.hyracks.api.exceptions.HyracksDataException;
-import edu.uci.ics.hyracks.data.std.api.IDataOutputProvider;
-import edu.uci.ics.hyracks.data.std.util.ArrayBackedValueStorage;
-import edu.uci.ics.hyracks.data.std.util.ByteArrayAccessibleOutputStream;
-import edu.uci.ics.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
-
-//The record merge evaluator is used to combine two records with no matching fieldnames
-//If both records have the same fieldname for a non-record field anywhere in the schema, the merge will fail
-//This function is performed on a recursive level, meaning that nested records can be combined
-//for instance if both records have a nested field called "metadata"
-//where metadata from A is {"comments":"this rocks"}
-//and metadata from B is {"index":7, "priority":5}
-//Records A and B can be combined yielding a nested record called "metadata"
-//That will have all three fields
-public class RecordMergeDescriptor extends AbstractScalarFunctionDynamicDescriptor {
-
-    private static final long serialVersionUID = 1L;
-
-    private static final byte SER_NULL_TYPE_TAG = ATypeTag.NULL.serialize();
-
-    public static final IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() {
-        public IFunctionDescriptor createFunctionDescriptor() {
-            return new RecordMergeDescriptor();
-        }
-    };
-
-    private ARecordType outRecType;
-    private ARecordType inRecType0;
-    private ARecordType inRecType1;
-
-    public void reset(IAType outType, IAType inType0, IAType inType1) {
-        outRecType = RecordMergeTypeComputer.extractRecordType(outType);
-        inRecType0 = RecordMergeTypeComputer.extractRecordType(inType0);
-        inRecType1 = RecordMergeTypeComputer.extractRecordType(inType1);
-    }
-
-    @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
-        return new ICopyEvaluatorFactory() {
-
-            private static final long serialVersionUID = 1L;
-
-            @SuppressWarnings("unchecked")
-            private final ISerializerDeserializer<ANull> nullSerDe = AqlSerializerDeserializerProvider.INSTANCE
-                    .getSerializerDeserializer(BuiltinType.ANULL);
-
-            @Override
-            public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
-                final ARecordType recType;
-                try {
-                    recType = new ARecordType(outRecType.getTypeName(), outRecType.getFieldNames(),
-                            outRecType.getFieldTypes(), outRecType.isOpen());
-                } catch (AsterixException | HyracksDataException e) {
-                    throw new IllegalStateException();
-                }
-
-                final PointableAllocator pa = new PointableAllocator();
-                final IVisitablePointable vp0 = pa.allocateRecordValue(inRecType0);
-                final IVisitablePointable vp1 = pa.allocateRecordValue(inRecType1);
-
-                final ArrayBackedValueStorage abvs0 = new ArrayBackedValueStorage();
-                final ArrayBackedValueStorage abvs1 = new ArrayBackedValueStorage();
-
-                final ICopyEvaluator eval0 = args[0].createEvaluator(abvs0);
-                final ICopyEvaluator eval1 = args[1].createEvaluator(abvs1);
-
-                final Stack<RecordBuilder> rbStack = new Stack<RecordBuilder>();
-
-                final ArrayBackedValueStorage tabvs = new ArrayBackedValueStorage();
-
-                final ByteArrayAccessibleOutputStream nameOutputStream = new ByteArrayAccessibleOutputStream();
-                final ByteArrayInputStream namebais = new ByteArrayInputStream(nameOutputStream.getByteArray());
-                final DataInputStream namedis = new DataInputStream(namebais);
-
-                return new ICopyEvaluator() {
-
-                    @Override
-                    public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
-                        abvs0.reset();
-                        abvs1.reset();
-
-                        eval0.evaluate(tuple);
-                        eval1.evaluate(tuple);
-
-                        if (abvs0.getByteArray()[0] == SER_NULL_TYPE_TAG
-                                || abvs1.getByteArray()[0] == SER_NULL_TYPE_TAG) {
-                            try {
-                                nullSerDe.serialize(ANull.NULL, output.getDataOutput());
-                            } catch (HyracksDataException e) {
-                                throw new AlgebricksException(e);
-                            }
-                            return;
-                        }
-
-                        vp0.set(abvs0);
-                        vp1.set(abvs1);
-
-                        ARecordPointable rp0 = (ARecordPointable) vp0;
-                        ARecordPointable rp1 = (ARecordPointable) vp1;
-
-                        try {
-                            mergeFields(recType, rp0, rp1, true, 0);
-
-                            rbStack.get(0).write(output.getDataOutput(), true);
-                        } catch (IOException | AsterixException e) {
-                            throw new AlgebricksException(e);
-                        }
-                    }
-
-                    private void mergeFields(ARecordType combinedType, ARecordPointable leftRecord,
-                            ARecordPointable rightRecord, boolean openFromParent, int nestedLevel) throws IOException,
-                            AsterixException, AlgebricksException {
-                        if (rbStack.size() < (nestedLevel + 1)) {
-                            rbStack.push(new RecordBuilder());
-                        }
-
-                        rbStack.get(nestedLevel).reset(combinedType);
-                        rbStack.get(nestedLevel).init();
-                        //Add all fields from left record
-                        for (int i = 0; i < leftRecord.getFieldNames().size(); i++) {
-                            IVisitablePointable leftName = leftRecord.getFieldNames().get(i);
-                            IVisitablePointable leftValue = leftRecord.getFieldValues().get(i);
-                            boolean foundMatch = false;
-                            for (int j = 0; j < rightRecord.getFieldNames().size(); j++) {
-                                IVisitablePointable rightName = rightRecord.getFieldNames().get(j);
-                                IVisitablePointable rightValue = rightRecord.getFieldValues().get(j);
-                                if (rightName.equals(leftName)) {
-                                    //Field was found on the right. Merge Sub Records
-                                    if (rightValue.getByteArray()[0] != ATypeTag.RECORD.serialize()
-                                            || leftValue.getByteArray()[0] != ATypeTag.RECORD.serialize()) {
-                                        //The fields need to be records in order to merge
-                                        throw new AlgebricksException("Duplicate field found");
-                                    } else {
-                                        //We are merging two sub records
-                                        addFieldToSubRecord(combinedType, leftName, leftValue, rightValue,
-                                                openFromParent, nestedLevel);
-                                    }
-                                    foundMatch = true;
-                                }
-                            }
-                            if (!foundMatch) {
-
-                                addFieldToSubRecord(combinedType, leftName, leftValue, null, openFromParent,
-                                        nestedLevel);
-                            }
-
-                        }
-                        //Repeat for right side (ignoring duplicates this time)
-                        for (int j = 0; j < rightRecord.getFieldNames().size(); j++) {
-                            IVisitablePointable rightName = rightRecord.getFieldNames().get(j);
-                            IVisitablePointable rightValue = rightRecord.getFieldValues().get(j);
-                            boolean foundMatch = false;
-                            for (int i = 0; i < leftRecord.getFieldNames().size(); i++) {
-                                IVisitablePointable leftName = leftRecord.getFieldNames().get(i);
-                                if (rightName.equals(leftName)) {
-                                    foundMatch = true;
-                                }
-                            }
-                            if (!foundMatch) {
-                                addFieldToSubRecord(combinedType, rightName, rightValue, null, openFromParent,
-                                        nestedLevel);
-                            }
-
-                        }
-
-                    }
-
-                    //Takes in a record type, field name, and the field values (which are record) from two records
-                    //Merges them into one record of combinedType
-                    //And adds that record as a field to the Record in subrb
-                    //the second value can be null, indicated that you just add the value of left as a field to subrb
-                    private void addFieldToSubRecord(ARecordType combinedType, IVisitablePointable fieldNamePointable,
-                            IVisitablePointable leftValue, IVisitablePointable rightValue, boolean openFromParent,
-                            int nestedLevel) throws IOException, AsterixException, AlgebricksException {
-
-                        nameOutputStream.reset();
-                        nameOutputStream.write(fieldNamePointable.getByteArray(),
-                                fieldNamePointable.getStartOffset() + 1, fieldNamePointable.getLength());
-                        namedis.reset();
-                        String fieldName = AStringSerializerDeserializer.INSTANCE.deserialize(namedis).getStringValue();
-
-                        //Add the merged field
-                        if (combinedType.isClosedField(fieldName)) {
-                            int pos = combinedType.findFieldPosition(fieldName);
-                            if (rightValue == null) {
-                                rbStack.get(nestedLevel).addField(pos, leftValue);
-                            } else {
-                                mergeFields((ARecordType) combinedType.getFieldType(fieldName),
-                                        (ARecordPointable) leftValue, (ARecordPointable) rightValue, false,
-                                        nestedLevel + 1);
-
-                                tabvs.reset();
-                                rbStack.get(nestedLevel + 1).write(tabvs.getDataOutput(), true);
-                                rbStack.get(nestedLevel).addField(pos, tabvs);
-                            }
-                        } else {
-                            if (rightValue == null) {
-                                rbStack.get(nestedLevel).addField(fieldNamePointable, leftValue);
-                            } else {
-                                mergeFields((ARecordType) combinedType.getFieldType(fieldName),
-                                        (ARecordPointable) leftValue, (ARecordPointable) rightValue, false,
-                                        nestedLevel + 1);
-                                tabvs.reset();
-                                rbStack.get(nestedLevel + 1).write(tabvs.getDataOutput(), true);
-                                rbStack.get(nestedLevel).addField(fieldNamePointable, tabvs);
-                            }
-                        }
-                    }
-
-                };
-            }
-        };
-    }
-
-    @Override
-    public FunctionIdentifier getIdentifier() {
-        return AsterixBuiltinFunctions.RECORD_MERGE;
-    }
-}



[6/9] incubator-asterixdb git commit: Adding introspection for getting record details.

Posted by im...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-app/src/test/resources/runtimets/results/records/get-record-fields/tiny-social-example-no-complex-types/tiny-social-example-no-complex-types.6.adm
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/results/records/get-record-fields/tiny-social-example-no-complex-types/tiny-social-example-no-complex-types.6.adm b/asterix-app/src/test/resources/runtimets/results/records/get-record-fields/tiny-social-example-no-complex-types/tiny-social-example-no-complex-types.6.adm
new file mode 100644
index 0000000..8fdd58c
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/records/get-record-fields/tiny-social-example-no-complex-types/tiny-social-example-no-complex-types.6.adm
@@ -0,0 +1,16 @@
+[ [ { "field-name": "message-id", "field-type": "INT64", "is-open": false }, { "field-name": "author-id", "field-type": "INT64", "is-open": false }, { "field-name": "in-response-to", "field-type": "INT64", "is-open": false }, { "field-name": "sender-location", "field-type": "POINT", "is-open": false }, { "field-name": "message", "field-type": "STRING", "is-open": false } ]
+, [ { "field-name": "message-id", "field-type": "INT64", "is-open": false }, { "field-name": "author-id", "field-type": "INT64", "is-open": false }, { "field-name": "in-response-to", "field-type": "INT64", "is-open": false }, { "field-name": "sender-location", "field-type": "POINT", "is-open": false }, { "field-name": "message", "field-type": "STRING", "is-open": false } ]
+, [ { "field-name": "message-id", "field-type": "INT64", "is-open": false }, { "field-name": "author-id", "field-type": "INT64", "is-open": false }, { "field-name": "in-response-to", "field-type": "INT64", "is-open": false }, { "field-name": "sender-location", "field-type": "POINT", "is-open": false }, { "field-name": "message", "field-type": "STRING", "is-open": false } ]
+, [ { "field-name": "message-id", "field-type": "INT64", "is-open": false }, { "field-name": "author-id", "field-type": "INT64", "is-open": false }, { "field-name": "in-response-to", "field-type": "INT64", "is-open": false }, { "field-name": "sender-location", "field-type": "POINT", "is-open": false }, { "field-name": "message", "field-type": "STRING", "is-open": false } ]
+, [ { "field-name": "message-id", "field-type": "INT64", "is-open": false }, { "field-name": "author-id", "field-type": "INT64", "is-open": false }, { "field-name": "in-response-to", "field-type": "INT64", "is-open": false }, { "field-name": "sender-location", "field-type": "POINT", "is-open": false }, { "field-name": "message", "field-type": "STRING", "is-open": false } ]
+, [ { "field-name": "message-id", "field-type": "INT64", "is-open": false }, { "field-name": "author-id", "field-type": "INT64", "is-open": false }, { "field-name": "in-response-to", "field-type": "INT64", "is-open": false }, { "field-name": "sender-location", "field-type": "POINT", "is-open": false }, { "field-name": "message", "field-type": "STRING", "is-open": false } ]
+, [ { "field-name": "message-id", "field-type": "INT64", "is-open": false }, { "field-name": "author-id", "field-type": "INT64", "is-open": false }, { "field-name": "in-response-to", "field-type": "INT64", "is-open": false }, { "field-name": "sender-location", "field-type": "POINT", "is-open": false }, { "field-name": "message", "field-type": "STRING", "is-open": false } ]
+, [ { "field-name": "message-id", "field-type": "INT64", "is-open": false }, { "field-name": "author-id", "field-type": "INT64", "is-open": false }, { "field-name": "in-response-to", "field-type": "INT64", "is-open": false }, { "field-name": "sender-location", "field-type": "POINT", "is-open": false }, { "field-name": "message", "field-type": "STRING", "is-open": false } ]
+, [ { "field-name": "message-id", "field-type": "INT64", "is-open": false }, { "field-name": "author-id", "field-type": "INT64", "is-open": false }, { "field-name": "in-response-to", "field-type": "INT64", "is-open": false }, { "field-name": "sender-location", "field-type": "POINT", "is-open": false }, { "field-name": "message", "field-type": "STRING", "is-open": false } ]
+, [ { "field-name": "message-id", "field-type": "INT64", "is-open": false }, { "field-name": "author-id", "field-type": "INT64", "is-open": false }, { "field-name": "in-response-to", "field-type": "INT64", "is-open": false }, { "field-name": "sender-location", "field-type": "POINT", "is-open": false }, { "field-name": "message", "field-type": "STRING", "is-open": false } ]
+, [ { "field-name": "message-id", "field-type": "INT64", "is-open": false }, { "field-name": "author-id", "field-type": "INT64", "is-open": false }, { "field-name": "in-response-to", "field-type": "INT64", "is-open": false }, { "field-name": "sender-location", "field-type": "POINT", "is-open": false }, { "field-name": "message", "field-type": "STRING", "is-open": false } ]
+, [ { "field-name": "message-id", "field-type": "INT64", "is-open": false }, { "field-name": "author-id", "field-type": "INT64", "is-open": false }, { "field-name": "in-response-to", "field-type": "INT64", "is-open": false }, { "field-name": "sender-location", "field-type": "POINT", "is-open": false }, { "field-name": "message", "field-type": "STRING", "is-open": false } ]
+, [ { "field-name": "message-id", "field-type": "INT64", "is-open": false }, { "field-name": "author-id", "field-type": "INT64", "is-open": false }, { "field-name": "in-response-to", "field-type": "INT64", "is-open": false }, { "field-name": "sender-location", "field-type": "POINT", "is-open": false }, { "field-name": "message", "field-type": "STRING", "is-open": false } ]
+, [ { "field-name": "message-id", "field-type": "INT64", "is-open": false }, { "field-name": "author-id", "field-type": "INT64", "is-open": false }, { "field-name": "in-response-to", "field-type": "INT64", "is-open": false }, { "field-name": "sender-location", "field-type": "POINT", "is-open": false }, { "field-name": "message", "field-type": "STRING", "is-open": false } ]
+, [ { "field-name": "message-id", "field-type": "INT64", "is-open": false }, { "field-name": "author-id", "field-type": "INT64", "is-open": false }, { "field-name": "in-response-to", "field-type": "INT64", "is-open": false }, { "field-name": "sender-location", "field-type": "POINT", "is-open": false }, { "field-name": "message", "field-type": "STRING", "is-open": false } ]
+ ]
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-app/src/test/resources/runtimets/results/records/get-record-fields/tiny-social-example-no-complex-types/tiny-social-example-no-complex-types.7.adm
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/results/records/get-record-fields/tiny-social-example-no-complex-types/tiny-social-example-no-complex-types.7.adm b/asterix-app/src/test/resources/runtimets/results/records/get-record-fields/tiny-social-example-no-complex-types/tiny-social-example-no-complex-types.7.adm
new file mode 100644
index 0000000..c2e6792
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/records/get-record-fields/tiny-social-example-no-complex-types/tiny-social-example-no-complex-types.7.adm
@@ -0,0 +1,5 @@
+[ [ { "field-name": "screen-name", "field-type": "STRING", "is-open": false }, { "field-name": "lang", "field-type": "STRING", "is-open": false }, { "field-name": "friends_count", "field-type": "INT64", "is-open": false }, { "field-name": "statuses_count", "field-type": "INT64", "is-open": false } ]
+, [ { "field-name": "screen-name", "field-type": "STRING", "is-open": false }, { "field-name": "lang", "field-type": "STRING", "is-open": false }, { "field-name": "friends_count", "field-type": "INT64", "is-open": false }, { "field-name": "statuses_count", "field-type": "INT64", "is-open": false } ]
+, [ { "field-name": "screen-name", "field-type": "STRING", "is-open": false }, { "field-name": "lang", "field-type": "STRING", "is-open": false }, { "field-name": "friends_count", "field-type": "INT64", "is-open": false }, { "field-name": "statuses_count", "field-type": "INT64", "is-open": false } ]
+, [ { "field-name": "screen-name", "field-type": "STRING", "is-open": false }, { "field-name": "lang", "field-type": "STRING", "is-open": false }, { "field-name": "friends_count", "field-type": "INT64", "is-open": false }, { "field-name": "statuses_count", "field-type": "INT64", "is-open": false } ]
+ ]
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-app/src/test/resources/runtimets/results/records/get-record-fields/tiny-social-example-no-complex-types/tiny-social-example-no-complex-types.8.adm
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/results/records/get-record-fields/tiny-social-example-no-complex-types/tiny-social-example-no-complex-types.8.adm b/asterix-app/src/test/resources/runtimets/results/records/get-record-fields/tiny-social-example-no-complex-types/tiny-social-example-no-complex-types.8.adm
new file mode 100644
index 0000000..66a276d
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/records/get-record-fields/tiny-social-example-no-complex-types/tiny-social-example-no-complex-types.8.adm
@@ -0,0 +1,13 @@
+[ [ { "field-name": "tweetid", "field-type": "STRING", "is-open": false }, { "field-name": "sender-location", "field-type": "POINT", "is-open": false }, { "field-name": "send-time", "field-type": "DATETIME", "is-open": false }, { "field-name": "message-text", "field-type": "STRING", "is-open": false } ]
+, [ { "field-name": "tweetid", "field-type": "STRING", "is-open": false }, { "field-name": "sender-location", "field-type": "POINT", "is-open": false }, { "field-name": "send-time", "field-type": "DATETIME", "is-open": false }, { "field-name": "message-text", "field-type": "STRING", "is-open": false } ]
+, [ { "field-name": "tweetid", "field-type": "STRING", "is-open": false }, { "field-name": "sender-location", "field-type": "POINT", "is-open": false }, { "field-name": "send-time", "field-type": "DATETIME", "is-open": false }, { "field-name": "message-text", "field-type": "STRING", "is-open": false } ]
+, [ { "field-name": "tweetid", "field-type": "STRING", "is-open": false }, { "field-name": "sender-location", "field-type": "POINT", "is-open": false }, { "field-name": "send-time", "field-type": "DATETIME", "is-open": false }, { "field-name": "message-text", "field-type": "STRING", "is-open": false } ]
+, [ { "field-name": "tweetid", "field-type": "STRING", "is-open": false }, { "field-name": "sender-location", "field-type": "POINT", "is-open": false }, { "field-name": "send-time", "field-type": "DATETIME", "is-open": false }, { "field-name": "message-text", "field-type": "STRING", "is-open": false } ]
+, [ { "field-name": "tweetid", "field-type": "STRING", "is-open": false }, { "field-name": "sender-location", "field-type": "POINT", "is-open": false }, { "field-name": "send-time", "field-type": "DATETIME", "is-open": false }, { "field-name": "message-text", "field-type": "STRING", "is-open": false } ]
+, [ { "field-name": "tweetid", "field-type": "STRING", "is-open": false }, { "field-name": "sender-location", "field-type": "POINT", "is-open": false }, { "field-name": "send-time", "field-type": "DATETIME", "is-open": false }, { "field-name": "message-text", "field-type": "STRING", "is-open": false } ]
+, [ { "field-name": "tweetid", "field-type": "STRING", "is-open": false }, { "field-name": "sender-location", "field-type": "POINT", "is-open": false }, { "field-name": "send-time", "field-type": "DATETIME", "is-open": false }, { "field-name": "message-text", "field-type": "STRING", "is-open": false } ]
+, [ { "field-name": "tweetid", "field-type": "STRING", "is-open": false }, { "field-name": "sender-location", "field-type": "POINT", "is-open": false }, { "field-name": "send-time", "field-type": "DATETIME", "is-open": false }, { "field-name": "message-text", "field-type": "STRING", "is-open": false } ]
+, [ { "field-name": "tweetid", "field-type": "STRING", "is-open": false }, { "field-name": "sender-location", "field-type": "POINT", "is-open": false }, { "field-name": "send-time", "field-type": "DATETIME", "is-open": false }, { "field-name": "message-text", "field-type": "STRING", "is-open": false } ]
+, [ { "field-name": "tweetid", "field-type": "STRING", "is-open": false }, { "field-name": "sender-location", "field-type": "POINT", "is-open": false }, { "field-name": "send-time", "field-type": "DATETIME", "is-open": false }, { "field-name": "message-text", "field-type": "STRING", "is-open": false } ]
+, [ { "field-name": "tweetid", "field-type": "STRING", "is-open": false }, { "field-name": "sender-location", "field-type": "POINT", "is-open": false }, { "field-name": "send-time", "field-type": "DATETIME", "is-open": false }, { "field-name": "message-text", "field-type": "STRING", "is-open": false } ]
+ ]
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-app/src/test/resources/runtimets/results/records/get-record-fields/tiny-social-example-no-complex-types/tiny-social-example-no-complex-types.9.adm
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/results/records/get-record-fields/tiny-social-example-no-complex-types/tiny-social-example-no-complex-types.9.adm b/asterix-app/src/test/resources/runtimets/results/records/get-record-fields/tiny-social-example-no-complex-types/tiny-social-example-no-complex-types.9.adm
new file mode 100644
index 0000000..d5d7282
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/records/get-record-fields/tiny-social-example-no-complex-types/tiny-social-example-no-complex-types.9.adm
@@ -0,0 +1,5 @@
+[ { "count": 12, "field-name": "message-text", "field-type": "STRING" }
+, { "count": 12, "field-name": "send-time", "field-type": "DATETIME" }
+, { "count": 12, "field-name": "sender-location", "field-type": "POINT" }
+, { "count": 12, "field-name": "tweetid", "field-type": "STRING" }
+ ]
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-app/src/test/resources/runtimets/results/records/get-record-fields/tiny-social-example-only-lists/tiny-social-example-only-lists.4.adm
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/results/records/get-record-fields/tiny-social-example-only-lists/tiny-social-example-only-lists.4.adm b/asterix-app/src/test/resources/runtimets/results/records/get-record-fields/tiny-social-example-only-lists/tiny-social-example-only-lists.4.adm
new file mode 100644
index 0000000..9a34a4f
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/records/get-record-fields/tiny-social-example-only-lists/tiny-social-example-only-lists.4.adm
@@ -0,0 +1,2 @@
+[ [ { "field-name": "id", "field-type": "INT64", "is-open": false }, { "field-name": "alias", "field-type": "STRING", "is-open": false }, { "field-name": "name", "field-type": "STRING", "is-open": false }, { "field-name": "friend-ids", "field-type": "UNORDEREDLIST", "is-open": false, "list": [ { "field-type": "INT64" } ] }, { "field-name": "user-since", "field-type": "DATETIME", "is-open": false } ]
+ ]
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-app/src/test/resources/runtimets/results/records/get-record-fields/tiny-social-example-only-lists/tiny-social-example-only-lists.5.adm
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/results/records/get-record-fields/tiny-social-example-only-lists/tiny-social-example-only-lists.5.adm b/asterix-app/src/test/resources/runtimets/results/records/get-record-fields/tiny-social-example-only-lists/tiny-social-example-only-lists.5.adm
new file mode 100644
index 0000000..32ffe1a
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/records/get-record-fields/tiny-social-example-only-lists/tiny-social-example-only-lists.5.adm
@@ -0,0 +1,11 @@
+[ [ { "field-name": "id", "field-type": "INT64", "is-open": false }, { "field-name": "alias", "field-type": "STRING", "is-open": false }, { "field-name": "name", "field-type": "STRING", "is-open": false }, { "field-name": "friend-ids", "field-type": "UNORDEREDLIST", "is-open": false, "list": [ { "field-type": "INT64" }, { "field-type": "INT64" }, { "field-type": "INT64" }, { "field-type": "INT64" } ] }, { "field-name": "user-since", "field-type": "DATETIME", "is-open": false } ]
+, [ { "field-name": "id", "field-type": "INT64", "is-open": false }, { "field-name": "alias", "field-type": "STRING", "is-open": false }, { "field-name": "name", "field-type": "STRING", "is-open": false }, { "field-name": "friend-ids", "field-type": "UNORDEREDLIST", "is-open": false, "list": [ { "field-type": "INT64" }, { "field-type": "INT64" } ] }, { "field-name": "user-since", "field-type": "DATETIME", "is-open": false } ]
+, [ { "field-name": "id", "field-type": "INT64", "is-open": false }, { "field-name": "alias", "field-type": "STRING", "is-open": false }, { "field-name": "name", "field-type": "STRING", "is-open": false }, { "field-name": "friend-ids", "field-type": "UNORDEREDLIST", "is-open": false, "list": [ { "field-type": "INT64" }, { "field-type": "INT64" }, { "field-type": "INT64" }, { "field-type": "INT64" } ] }, { "field-name": "user-since", "field-type": "DATETIME", "is-open": false } ]
+, [ { "field-name": "id", "field-type": "INT64", "is-open": false }, { "field-name": "alias", "field-type": "STRING", "is-open": false }, { "field-name": "name", "field-type": "STRING", "is-open": false }, { "field-name": "friend-ids", "field-type": "UNORDEREDLIST", "is-open": false, "list": [ { "field-type": "INT64" } ] }, { "field-name": "user-since", "field-type": "DATETIME", "is-open": false } ]
+, [ { "field-name": "id", "field-type": "INT64", "is-open": false }, { "field-name": "alias", "field-type": "STRING", "is-open": false }, { "field-name": "name", "field-type": "STRING", "is-open": false }, { "field-name": "friend-ids", "field-type": "UNORDEREDLIST", "is-open": false, "list": [ { "field-type": "INT64" }, { "field-type": "INT64" }, { "field-type": "INT64" } ] }, { "field-name": "user-since", "field-type": "DATETIME", "is-open": false } ]
+, [ { "field-name": "id", "field-type": "INT64", "is-open": false }, { "field-name": "alias", "field-type": "STRING", "is-open": false }, { "field-name": "name", "field-type": "STRING", "is-open": false }, { "field-name": "friend-ids", "field-type": "UNORDEREDLIST", "is-open": false, "list": [ { "field-type": "INT64" }, { "field-type": "INT64" }, { "field-type": "INT64" } ] }, { "field-name": "user-since", "field-type": "DATETIME", "is-open": false } ]
+, [ { "field-name": "id", "field-type": "INT64", "is-open": false }, { "field-name": "alias", "field-type": "STRING", "is-open": false }, { "field-name": "name", "field-type": "STRING", "is-open": false }, { "field-name": "friend-ids", "field-type": "UNORDEREDLIST", "is-open": false, "list": [ { "field-type": "INT64" } ] }, { "field-name": "user-since", "field-type": "DATETIME", "is-open": false } ]
+, [ { "field-name": "id", "field-type": "INT64", "is-open": false }, { "field-name": "alias", "field-type": "STRING", "is-open": false }, { "field-name": "name", "field-type": "STRING", "is-open": false }, { "field-name": "friend-ids", "field-type": "UNORDEREDLIST", "is-open": false, "list": [ { "field-type": "INT64" } ] }, { "field-name": "user-since", "field-type": "DATETIME", "is-open": false } ]
+, [ { "field-name": "id", "field-type": "INT64", "is-open": false }, { "field-name": "alias", "field-type": "STRING", "is-open": false }, { "field-name": "name", "field-type": "STRING", "is-open": false }, { "field-name": "friend-ids", "field-type": "UNORDEREDLIST", "is-open": false, "list": [ { "field-type": "INT64" }, { "field-type": "INT64" } ] }, { "field-name": "user-since", "field-type": "DATETIME", "is-open": false } ]
+, [ { "field-name": "id", "field-type": "INT64", "is-open": false }, { "field-name": "alias", "field-type": "STRING", "is-open": false }, { "field-name": "name", "field-type": "STRING", "is-open": false }, { "field-name": "friend-ids", "field-type": "UNORDEREDLIST", "is-open": false, "list": [ { "field-type": "INT64" }, { "field-type": "INT64" }, { "field-type": "INT64" } ] }, { "field-name": "user-since", "field-type": "DATETIME", "is-open": false } ]
+ ]
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-app/src/test/resources/runtimets/results/records/get-record-fields/tiny-social-example-only-lists/tiny-social-example-only-lists.6.adm
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/results/records/get-record-fields/tiny-social-example-only-lists/tiny-social-example-only-lists.6.adm b/asterix-app/src/test/resources/runtimets/results/records/get-record-fields/tiny-social-example-only-lists/tiny-social-example-only-lists.6.adm
new file mode 100644
index 0000000..8fdd58c
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/records/get-record-fields/tiny-social-example-only-lists/tiny-social-example-only-lists.6.adm
@@ -0,0 +1,16 @@
+[ [ { "field-name": "message-id", "field-type": "INT64", "is-open": false }, { "field-name": "author-id", "field-type": "INT64", "is-open": false }, { "field-name": "in-response-to", "field-type": "INT64", "is-open": false }, { "field-name": "sender-location", "field-type": "POINT", "is-open": false }, { "field-name": "message", "field-type": "STRING", "is-open": false } ]
+, [ { "field-name": "message-id", "field-type": "INT64", "is-open": false }, { "field-name": "author-id", "field-type": "INT64", "is-open": false }, { "field-name": "in-response-to", "field-type": "INT64", "is-open": false }, { "field-name": "sender-location", "field-type": "POINT", "is-open": false }, { "field-name": "message", "field-type": "STRING", "is-open": false } ]
+, [ { "field-name": "message-id", "field-type": "INT64", "is-open": false }, { "field-name": "author-id", "field-type": "INT64", "is-open": false }, { "field-name": "in-response-to", "field-type": "INT64", "is-open": false }, { "field-name": "sender-location", "field-type": "POINT", "is-open": false }, { "field-name": "message", "field-type": "STRING", "is-open": false } ]
+, [ { "field-name": "message-id", "field-type": "INT64", "is-open": false }, { "field-name": "author-id", "field-type": "INT64", "is-open": false }, { "field-name": "in-response-to", "field-type": "INT64", "is-open": false }, { "field-name": "sender-location", "field-type": "POINT", "is-open": false }, { "field-name": "message", "field-type": "STRING", "is-open": false } ]
+, [ { "field-name": "message-id", "field-type": "INT64", "is-open": false }, { "field-name": "author-id", "field-type": "INT64", "is-open": false }, { "field-name": "in-response-to", "field-type": "INT64", "is-open": false }, { "field-name": "sender-location", "field-type": "POINT", "is-open": false }, { "field-name": "message", "field-type": "STRING", "is-open": false } ]
+, [ { "field-name": "message-id", "field-type": "INT64", "is-open": false }, { "field-name": "author-id", "field-type": "INT64", "is-open": false }, { "field-name": "in-response-to", "field-type": "INT64", "is-open": false }, { "field-name": "sender-location", "field-type": "POINT", "is-open": false }, { "field-name": "message", "field-type": "STRING", "is-open": false } ]
+, [ { "field-name": "message-id", "field-type": "INT64", "is-open": false }, { "field-name": "author-id", "field-type": "INT64", "is-open": false }, { "field-name": "in-response-to", "field-type": "INT64", "is-open": false }, { "field-name": "sender-location", "field-type": "POINT", "is-open": false }, { "field-name": "message", "field-type": "STRING", "is-open": false } ]
+, [ { "field-name": "message-id", "field-type": "INT64", "is-open": false }, { "field-name": "author-id", "field-type": "INT64", "is-open": false }, { "field-name": "in-response-to", "field-type": "INT64", "is-open": false }, { "field-name": "sender-location", "field-type": "POINT", "is-open": false }, { "field-name": "message", "field-type": "STRING", "is-open": false } ]
+, [ { "field-name": "message-id", "field-type": "INT64", "is-open": false }, { "field-name": "author-id", "field-type": "INT64", "is-open": false }, { "field-name": "in-response-to", "field-type": "INT64", "is-open": false }, { "field-name": "sender-location", "field-type": "POINT", "is-open": false }, { "field-name": "message", "field-type": "STRING", "is-open": false } ]
+, [ { "field-name": "message-id", "field-type": "INT64", "is-open": false }, { "field-name": "author-id", "field-type": "INT64", "is-open": false }, { "field-name": "in-response-to", "field-type": "INT64", "is-open": false }, { "field-name": "sender-location", "field-type": "POINT", "is-open": false }, { "field-name": "message", "field-type": "STRING", "is-open": false } ]
+, [ { "field-name": "message-id", "field-type": "INT64", "is-open": false }, { "field-name": "author-id", "field-type": "INT64", "is-open": false }, { "field-name": "in-response-to", "field-type": "INT64", "is-open": false }, { "field-name": "sender-location", "field-type": "POINT", "is-open": false }, { "field-name": "message", "field-type": "STRING", "is-open": false } ]
+, [ { "field-name": "message-id", "field-type": "INT64", "is-open": false }, { "field-name": "author-id", "field-type": "INT64", "is-open": false }, { "field-name": "in-response-to", "field-type": "INT64", "is-open": false }, { "field-name": "sender-location", "field-type": "POINT", "is-open": false }, { "field-name": "message", "field-type": "STRING", "is-open": false } ]
+, [ { "field-name": "message-id", "field-type": "INT64", "is-open": false }, { "field-name": "author-id", "field-type": "INT64", "is-open": false }, { "field-name": "in-response-to", "field-type": "INT64", "is-open": false }, { "field-name": "sender-location", "field-type": "POINT", "is-open": false }, { "field-name": "message", "field-type": "STRING", "is-open": false } ]
+, [ { "field-name": "message-id", "field-type": "INT64", "is-open": false }, { "field-name": "author-id", "field-type": "INT64", "is-open": false }, { "field-name": "in-response-to", "field-type": "INT64", "is-open": false }, { "field-name": "sender-location", "field-type": "POINT", "is-open": false }, { "field-name": "message", "field-type": "STRING", "is-open": false } ]
+, [ { "field-name": "message-id", "field-type": "INT64", "is-open": false }, { "field-name": "author-id", "field-type": "INT64", "is-open": false }, { "field-name": "in-response-to", "field-type": "INT64", "is-open": false }, { "field-name": "sender-location", "field-type": "POINT", "is-open": false }, { "field-name": "message", "field-type": "STRING", "is-open": false } ]
+ ]
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-app/src/test/resources/runtimets/results/records/get-record-fields/tiny-social-example-only-lists/tiny-social-example-only-lists.7.adm
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/results/records/get-record-fields/tiny-social-example-only-lists/tiny-social-example-only-lists.7.adm b/asterix-app/src/test/resources/runtimets/results/records/get-record-fields/tiny-social-example-only-lists/tiny-social-example-only-lists.7.adm
new file mode 100644
index 0000000..c2e6792
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/records/get-record-fields/tiny-social-example-only-lists/tiny-social-example-only-lists.7.adm
@@ -0,0 +1,5 @@
+[ [ { "field-name": "screen-name", "field-type": "STRING", "is-open": false }, { "field-name": "lang", "field-type": "STRING", "is-open": false }, { "field-name": "friends_count", "field-type": "INT64", "is-open": false }, { "field-name": "statuses_count", "field-type": "INT64", "is-open": false } ]
+, [ { "field-name": "screen-name", "field-type": "STRING", "is-open": false }, { "field-name": "lang", "field-type": "STRING", "is-open": false }, { "field-name": "friends_count", "field-type": "INT64", "is-open": false }, { "field-name": "statuses_count", "field-type": "INT64", "is-open": false } ]
+, [ { "field-name": "screen-name", "field-type": "STRING", "is-open": false }, { "field-name": "lang", "field-type": "STRING", "is-open": false }, { "field-name": "friends_count", "field-type": "INT64", "is-open": false }, { "field-name": "statuses_count", "field-type": "INT64", "is-open": false } ]
+, [ { "field-name": "screen-name", "field-type": "STRING", "is-open": false }, { "field-name": "lang", "field-type": "STRING", "is-open": false }, { "field-name": "friends_count", "field-type": "INT64", "is-open": false }, { "field-name": "statuses_count", "field-type": "INT64", "is-open": false } ]
+ ]
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-app/src/test/resources/runtimets/results/records/get-record-fields/tiny-social-example-only-lists/tiny-social-example-only-lists.8.adm
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/results/records/get-record-fields/tiny-social-example-only-lists/tiny-social-example-only-lists.8.adm b/asterix-app/src/test/resources/runtimets/results/records/get-record-fields/tiny-social-example-only-lists/tiny-social-example-only-lists.8.adm
new file mode 100644
index 0000000..52770b2
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/records/get-record-fields/tiny-social-example-only-lists/tiny-social-example-only-lists.8.adm
@@ -0,0 +1,13 @@
+[ [ { "field-name": "tweetid", "field-type": "STRING", "is-open": false }, { "field-name": "sender-location", "field-type": "POINT", "is-open": false }, { "field-name": "send-time", "field-type": "DATETIME", "is-open": false }, { "field-name": "referred-topics", "field-type": "UNORDEREDLIST", "is-open": false, "list": [ { "field-type": "STRING" }, { "field-type": "STRING" } ] }, { "field-name": "message-text", "field-type": "STRING", "is-open": false } ]
+, [ { "field-name": "tweetid", "field-type": "STRING", "is-open": false }, { "field-name": "sender-location", "field-type": "POINT", "is-open": false }, { "field-name": "send-time", "field-type": "DATETIME", "is-open": false }, { "field-name": "referred-topics", "field-type": "UNORDEREDLIST", "is-open": false, "list": [ { "field-type": "STRING" }, { "field-type": "STRING" } ] }, { "field-name": "message-text", "field-type": "STRING", "is-open": false } ]
+, [ { "field-name": "tweetid", "field-type": "STRING", "is-open": false }, { "field-name": "sender-location", "field-type": "POINT", "is-open": false }, { "field-name": "send-time", "field-type": "DATETIME", "is-open": false }, { "field-name": "referred-topics", "field-type": "UNORDEREDLIST", "is-open": false, "list": [ { "field-type": "STRING" }, { "field-type": "STRING" } ] }, { "field-name": "message-text", "field-type": "STRING", "is-open": false } ]
+, [ { "field-name": "tweetid", "field-type": "STRING", "is-open": false }, { "field-name": "sender-location", "field-type": "POINT", "is-open": false }, { "field-name": "send-time", "field-type": "DATETIME", "is-open": false }, { "field-name": "referred-topics", "field-type": "UNORDEREDLIST", "is-open": false, "list": [ { "field-type": "STRING" }, { "field-type": "STRING" } ] }, { "field-name": "message-text", "field-type": "STRING", "is-open": false } ]
+, [ { "field-name": "tweetid", "field-type": "STRING", "is-open": false }, { "field-name": "sender-location", "field-type": "POINT", "is-open": false }, { "field-name": "send-time", "field-type": "DATETIME", "is-open": false }, { "field-name": "referred-topics", "field-type": "UNORDEREDLIST", "is-open": false, "list": [ { "field-type": "STRING" }, { "field-type": "STRING" } ] }, { "field-name": "message-text", "field-type": "STRING", "is-open": false } ]
+, [ { "field-name": "tweetid", "field-type": "STRING", "is-open": false }, { "field-name": "sender-location", "field-type": "POINT", "is-open": false }, { "field-name": "send-time", "field-type": "DATETIME", "is-open": false }, { "field-name": "referred-topics", "field-type": "UNORDEREDLIST", "is-open": false, "list": [ { "field-type": "STRING" }, { "field-type": "STRING" } ] }, { "field-name": "message-text", "field-type": "STRING", "is-open": false } ]
+, [ { "field-name": "tweetid", "field-type": "STRING", "is-open": false }, { "field-name": "sender-location", "field-type": "POINT", "is-open": false }, { "field-name": "send-time", "field-type": "DATETIME", "is-open": false }, { "field-name": "referred-topics", "field-type": "UNORDEREDLIST", "is-open": false, "list": [ { "field-type": "STRING" }, { "field-type": "STRING" } ] }, { "field-name": "message-text", "field-type": "STRING", "is-open": false } ]
+, [ { "field-name": "tweetid", "field-type": "STRING", "is-open": false }, { "field-name": "sender-location", "field-type": "POINT", "is-open": false }, { "field-name": "send-time", "field-type": "DATETIME", "is-open": false }, { "field-name": "referred-topics", "field-type": "UNORDEREDLIST", "is-open": false, "list": [ { "field-type": "STRING" }, { "field-type": "STRING" } ] }, { "field-name": "message-text", "field-type": "STRING", "is-open": false } ]
+, [ { "field-name": "tweetid", "field-type": "STRING", "is-open": false }, { "field-name": "sender-location", "field-type": "POINT", "is-open": false }, { "field-name": "send-time", "field-type": "DATETIME", "is-open": false }, { "field-name": "referred-topics", "field-type": "UNORDEREDLIST", "is-open": false, "list": [ { "field-type": "STRING" }, { "field-type": "STRING" } ] }, { "field-name": "message-text", "field-type": "STRING", "is-open": false } ]
+, [ { "field-name": "tweetid", "field-type": "STRING", "is-open": false }, { "field-name": "sender-location", "field-type": "POINT", "is-open": false }, { "field-name": "send-time", "field-type": "DATETIME", "is-open": false }, { "field-name": "referred-topics", "field-type": "UNORDEREDLIST", "is-open": false, "list": [ { "field-type": "STRING" }, { "field-type": "STRING" } ] }, { "field-name": "message-text", "field-type": "STRING", "is-open": false } ]
+, [ { "field-name": "tweetid", "field-type": "STRING", "is-open": false }, { "field-name": "sender-location", "field-type": "POINT", "is-open": false }, { "field-name": "send-time", "field-type": "DATETIME", "is-open": false }, { "field-name": "referred-topics", "field-type": "UNORDEREDLIST", "is-open": false, "list": [ { "field-type": "STRING" }, { "field-type": "STRING" } ] }, { "field-name": "message-text", "field-type": "STRING", "is-open": false } ]
+, [ { "field-name": "tweetid", "field-type": "STRING", "is-open": false }, { "field-name": "sender-location", "field-type": "POINT", "is-open": false }, { "field-name": "send-time", "field-type": "DATETIME", "is-open": false }, { "field-name": "referred-topics", "field-type": "UNORDEREDLIST", "is-open": false, "list": [ { "field-type": "STRING" }, { "field-type": "STRING" } ] }, { "field-name": "message-text", "field-type": "STRING", "is-open": false } ]
+ ]

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-app/src/test/resources/runtimets/results/records/get-record-fields/tiny-social-example-only-lists/tiny-social-example-only-lists.9.adm
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/results/records/get-record-fields/tiny-social-example-only-lists/tiny-social-example-only-lists.9.adm b/asterix-app/src/test/resources/runtimets/results/records/get-record-fields/tiny-social-example-only-lists/tiny-social-example-only-lists.9.adm
new file mode 100644
index 0000000..237f229
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/records/get-record-fields/tiny-social-example-only-lists/tiny-social-example-only-lists.9.adm
@@ -0,0 +1,6 @@
+[ { "count": 12, "field-name": "message-text", "field-type": "STRING" }
+, { "count": 12, "field-name": "referred-topics", "field-type": "UNORDEREDLIST" }
+, { "count": 12, "field-name": "send-time", "field-type": "DATETIME" }
+, { "count": 12, "field-name": "sender-location", "field-type": "POINT" }
+, { "count": 12, "field-name": "tweetid", "field-type": "STRING" }
+ ]
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-app/src/test/resources/runtimets/results/records/get-record-fields/tiny-social-example-only-records/tiny-social-example-only-records.4.adm
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/results/records/get-record-fields/tiny-social-example-only-records/tiny-social-example-only-records.4.adm b/asterix-app/src/test/resources/runtimets/results/records/get-record-fields/tiny-social-example-only-records/tiny-social-example-only-records.4.adm
new file mode 100644
index 0000000..bea13da
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/records/get-record-fields/tiny-social-example-only-records/tiny-social-example-only-records.4.adm
@@ -0,0 +1,2 @@
+[ [ { "field-name": "id", "field-type": "INT64", "is-open": false }, { "field-name": "alias", "field-type": "STRING", "is-open": false }, { "field-name": "name", "field-type": "STRING", "is-open": false }, { "field-name": "user-since", "field-type": "DATETIME", "is-open": false }, { "field-name": "employment", "field-type": "RECORD", "is-open": false, "nested": [ { "field-name": "organization-name", "field-type": "STRING", "is-open": false }, { "field-name": "start-date", "field-type": "DATE", "is-open": false }, { "field-name": "end-date", "field-type": "DATE", "is-open": false } ] } ]
+ ]
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-app/src/test/resources/runtimets/results/records/get-record-fields/tiny-social-example-only-records/tiny-social-example-only-records.5.adm
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/results/records/get-record-fields/tiny-social-example-only-records/tiny-social-example-only-records.5.adm b/asterix-app/src/test/resources/runtimets/results/records/get-record-fields/tiny-social-example-only-records/tiny-social-example-only-records.5.adm
new file mode 100644
index 0000000..304abae
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/records/get-record-fields/tiny-social-example-only-records/tiny-social-example-only-records.5.adm
@@ -0,0 +1,11 @@
+[ [ { "field-name": "id", "field-type": "INT64", "is-open": false }, { "field-name": "alias", "field-type": "STRING", "is-open": false }, { "field-name": "name", "field-type": "STRING", "is-open": false }, { "field-name": "user-since", "field-type": "DATETIME", "is-open": false }, { "field-name": "employment", "field-type": "RECORD", "is-open": false, "nested": [ { "field-name": "organization-name", "field-type": "STRING", "is-open": false }, { "field-name": "start-date", "field-type": "DATE", "is-open": false }, { "field-name": "end-date", "field-type": "DATE", "is-open": false } ] } ]
+, [ { "field-name": "id", "field-type": "INT64", "is-open": false }, { "field-name": "alias", "field-type": "STRING", "is-open": false }, { "field-name": "name", "field-type": "STRING", "is-open": false }, { "field-name": "user-since", "field-type": "DATETIME", "is-open": false }, { "field-name": "employment", "field-type": "RECORD", "is-open": false, "nested": [ { "field-name": "organization-name", "field-type": "STRING", "is-open": false }, { "field-name": "start-date", "field-type": "DATE", "is-open": false }, { "field-name": "end-date", "field-type": "DATE", "is-open": false } ] } ]
+, [ { "field-name": "id", "field-type": "INT64", "is-open": false }, { "field-name": "alias", "field-type": "STRING", "is-open": false }, { "field-name": "name", "field-type": "STRING", "is-open": false }, { "field-name": "user-since", "field-type": "DATETIME", "is-open": false }, { "field-name": "employment", "field-type": "RECORD", "is-open": false, "nested": [ { "field-name": "organization-name", "field-type": "STRING", "is-open": false }, { "field-name": "start-date", "field-type": "DATE", "is-open": false }, { "field-name": "end-date", "field-type": "DATE", "is-open": false } ] } ]
+, [ { "field-name": "id", "field-type": "INT64", "is-open": false }, { "field-name": "alias", "field-type": "STRING", "is-open": false }, { "field-name": "name", "field-type": "STRING", "is-open": false }, { "field-name": "user-since", "field-type": "DATETIME", "is-open": false }, { "field-name": "employment", "field-type": "RECORD", "is-open": false, "nested": [ { "field-name": "organization-name", "field-type": "STRING", "is-open": false }, { "field-name": "start-date", "field-type": "DATE", "is-open": false }, { "field-name": "end-date", "field-type": "DATE", "is-open": false } ] } ]
+, [ { "field-name": "id", "field-type": "INT64", "is-open": false }, { "field-name": "alias", "field-type": "STRING", "is-open": false }, { "field-name": "name", "field-type": "STRING", "is-open": false }, { "field-name": "user-since", "field-type": "DATETIME", "is-open": false }, { "field-name": "employment", "field-type": "RECORD", "is-open": false, "nested": [ { "field-name": "organization-name", "field-type": "STRING", "is-open": false }, { "field-name": "start-date", "field-type": "DATE", "is-open": false }, { "field-name": "end-date", "field-type": "DATE", "is-open": false } ] } ]
+, [ { "field-name": "id", "field-type": "INT64", "is-open": false }, { "field-name": "alias", "field-type": "STRING", "is-open": false }, { "field-name": "name", "field-type": "STRING", "is-open": false }, { "field-name": "user-since", "field-type": "DATETIME", "is-open": false }, { "field-name": "employment", "field-type": "RECORD", "is-open": false, "nested": [ { "field-name": "organization-name", "field-type": "STRING", "is-open": false }, { "field-name": "start-date", "field-type": "DATE", "is-open": false }, { "field-name": "end-date", "field-type": "DATE", "is-open": false } ] } ]
+, [ { "field-name": "id", "field-type": "INT64", "is-open": false }, { "field-name": "alias", "field-type": "STRING", "is-open": false }, { "field-name": "name", "field-type": "STRING", "is-open": false }, { "field-name": "user-since", "field-type": "DATETIME", "is-open": false }, { "field-name": "employment", "field-type": "RECORD", "is-open": false, "nested": [ { "field-name": "organization-name", "field-type": "STRING", "is-open": false }, { "field-name": "start-date", "field-type": "DATE", "is-open": false }, { "field-name": "end-date", "field-type": "DATE", "is-open": false } ] } ]
+, [ { "field-name": "id", "field-type": "INT64", "is-open": false }, { "field-name": "alias", "field-type": "STRING", "is-open": false }, { "field-name": "name", "field-type": "STRING", "is-open": false }, { "field-name": "user-since", "field-type": "DATETIME", "is-open": false }, { "field-name": "employment", "field-type": "RECORD", "is-open": false, "nested": [ { "field-name": "organization-name", "field-type": "STRING", "is-open": false }, { "field-name": "start-date", "field-type": "DATE", "is-open": false }, { "field-name": "end-date", "field-type": "DATE", "is-open": false } ] } ]
+, [ { "field-name": "id", "field-type": "INT64", "is-open": false }, { "field-name": "alias", "field-type": "STRING", "is-open": false }, { "field-name": "name", "field-type": "STRING", "is-open": false }, { "field-name": "user-since", "field-type": "DATETIME", "is-open": false }, { "field-name": "employment", "field-type": "RECORD", "is-open": false, "nested": [ { "field-name": "organization-name", "field-type": "STRING", "is-open": false }, { "field-name": "start-date", "field-type": "DATE", "is-open": false }, { "field-name": "end-date", "field-type": "DATE", "is-open": false } ] } ]
+, [ { "field-name": "id", "field-type": "INT64", "is-open": false }, { "field-name": "alias", "field-type": "STRING", "is-open": false }, { "field-name": "name", "field-type": "STRING", "is-open": false }, { "field-name": "user-since", "field-type": "DATETIME", "is-open": false }, { "field-name": "employment", "field-type": "RECORD", "is-open": false, "nested": [ { "field-name": "organization-name", "field-type": "STRING", "is-open": false }, { "field-name": "start-date", "field-type": "DATE", "is-open": false }, { "field-name": "end-date", "field-type": "DATE", "is-open": false } ] } ]
+ ]
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-app/src/test/resources/runtimets/results/records/get-record-fields/tiny-social-example-only-records/tiny-social-example-only-records.6.adm
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/results/records/get-record-fields/tiny-social-example-only-records/tiny-social-example-only-records.6.adm b/asterix-app/src/test/resources/runtimets/results/records/get-record-fields/tiny-social-example-only-records/tiny-social-example-only-records.6.adm
new file mode 100644
index 0000000..8fdd58c
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/records/get-record-fields/tiny-social-example-only-records/tiny-social-example-only-records.6.adm
@@ -0,0 +1,16 @@
+[ [ { "field-name": "message-id", "field-type": "INT64", "is-open": false }, { "field-name": "author-id", "field-type": "INT64", "is-open": false }, { "field-name": "in-response-to", "field-type": "INT64", "is-open": false }, { "field-name": "sender-location", "field-type": "POINT", "is-open": false }, { "field-name": "message", "field-type": "STRING", "is-open": false } ]
+, [ { "field-name": "message-id", "field-type": "INT64", "is-open": false }, { "field-name": "author-id", "field-type": "INT64", "is-open": false }, { "field-name": "in-response-to", "field-type": "INT64", "is-open": false }, { "field-name": "sender-location", "field-type": "POINT", "is-open": false }, { "field-name": "message", "field-type": "STRING", "is-open": false } ]
+, [ { "field-name": "message-id", "field-type": "INT64", "is-open": false }, { "field-name": "author-id", "field-type": "INT64", "is-open": false }, { "field-name": "in-response-to", "field-type": "INT64", "is-open": false }, { "field-name": "sender-location", "field-type": "POINT", "is-open": false }, { "field-name": "message", "field-type": "STRING", "is-open": false } ]
+, [ { "field-name": "message-id", "field-type": "INT64", "is-open": false }, { "field-name": "author-id", "field-type": "INT64", "is-open": false }, { "field-name": "in-response-to", "field-type": "INT64", "is-open": false }, { "field-name": "sender-location", "field-type": "POINT", "is-open": false }, { "field-name": "message", "field-type": "STRING", "is-open": false } ]
+, [ { "field-name": "message-id", "field-type": "INT64", "is-open": false }, { "field-name": "author-id", "field-type": "INT64", "is-open": false }, { "field-name": "in-response-to", "field-type": "INT64", "is-open": false }, { "field-name": "sender-location", "field-type": "POINT", "is-open": false }, { "field-name": "message", "field-type": "STRING", "is-open": false } ]
+, [ { "field-name": "message-id", "field-type": "INT64", "is-open": false }, { "field-name": "author-id", "field-type": "INT64", "is-open": false }, { "field-name": "in-response-to", "field-type": "INT64", "is-open": false }, { "field-name": "sender-location", "field-type": "POINT", "is-open": false }, { "field-name": "message", "field-type": "STRING", "is-open": false } ]
+, [ { "field-name": "message-id", "field-type": "INT64", "is-open": false }, { "field-name": "author-id", "field-type": "INT64", "is-open": false }, { "field-name": "in-response-to", "field-type": "INT64", "is-open": false }, { "field-name": "sender-location", "field-type": "POINT", "is-open": false }, { "field-name": "message", "field-type": "STRING", "is-open": false } ]
+, [ { "field-name": "message-id", "field-type": "INT64", "is-open": false }, { "field-name": "author-id", "field-type": "INT64", "is-open": false }, { "field-name": "in-response-to", "field-type": "INT64", "is-open": false }, { "field-name": "sender-location", "field-type": "POINT", "is-open": false }, { "field-name": "message", "field-type": "STRING", "is-open": false } ]
+, [ { "field-name": "message-id", "field-type": "INT64", "is-open": false }, { "field-name": "author-id", "field-type": "INT64", "is-open": false }, { "field-name": "in-response-to", "field-type": "INT64", "is-open": false }, { "field-name": "sender-location", "field-type": "POINT", "is-open": false }, { "field-name": "message", "field-type": "STRING", "is-open": false } ]
+, [ { "field-name": "message-id", "field-type": "INT64", "is-open": false }, { "field-name": "author-id", "field-type": "INT64", "is-open": false }, { "field-name": "in-response-to", "field-type": "INT64", "is-open": false }, { "field-name": "sender-location", "field-type": "POINT", "is-open": false }, { "field-name": "message", "field-type": "STRING", "is-open": false } ]
+, [ { "field-name": "message-id", "field-type": "INT64", "is-open": false }, { "field-name": "author-id", "field-type": "INT64", "is-open": false }, { "field-name": "in-response-to", "field-type": "INT64", "is-open": false }, { "field-name": "sender-location", "field-type": "POINT", "is-open": false }, { "field-name": "message", "field-type": "STRING", "is-open": false } ]
+, [ { "field-name": "message-id", "field-type": "INT64", "is-open": false }, { "field-name": "author-id", "field-type": "INT64", "is-open": false }, { "field-name": "in-response-to", "field-type": "INT64", "is-open": false }, { "field-name": "sender-location", "field-type": "POINT", "is-open": false }, { "field-name": "message", "field-type": "STRING", "is-open": false } ]
+, [ { "field-name": "message-id", "field-type": "INT64", "is-open": false }, { "field-name": "author-id", "field-type": "INT64", "is-open": false }, { "field-name": "in-response-to", "field-type": "INT64", "is-open": false }, { "field-name": "sender-location", "field-type": "POINT", "is-open": false }, { "field-name": "message", "field-type": "STRING", "is-open": false } ]
+, [ { "field-name": "message-id", "field-type": "INT64", "is-open": false }, { "field-name": "author-id", "field-type": "INT64", "is-open": false }, { "field-name": "in-response-to", "field-type": "INT64", "is-open": false }, { "field-name": "sender-location", "field-type": "POINT", "is-open": false }, { "field-name": "message", "field-type": "STRING", "is-open": false } ]
+, [ { "field-name": "message-id", "field-type": "INT64", "is-open": false }, { "field-name": "author-id", "field-type": "INT64", "is-open": false }, { "field-name": "in-response-to", "field-type": "INT64", "is-open": false }, { "field-name": "sender-location", "field-type": "POINT", "is-open": false }, { "field-name": "message", "field-type": "STRING", "is-open": false } ]
+ ]
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-app/src/test/resources/runtimets/results/records/get-record-fields/tiny-social-example-only-records/tiny-social-example-only-records.7.adm
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/results/records/get-record-fields/tiny-social-example-only-records/tiny-social-example-only-records.7.adm b/asterix-app/src/test/resources/runtimets/results/records/get-record-fields/tiny-social-example-only-records/tiny-social-example-only-records.7.adm
new file mode 100644
index 0000000..c2e6792
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/records/get-record-fields/tiny-social-example-only-records/tiny-social-example-only-records.7.adm
@@ -0,0 +1,5 @@
+[ [ { "field-name": "screen-name", "field-type": "STRING", "is-open": false }, { "field-name": "lang", "field-type": "STRING", "is-open": false }, { "field-name": "friends_count", "field-type": "INT64", "is-open": false }, { "field-name": "statuses_count", "field-type": "INT64", "is-open": false } ]
+, [ { "field-name": "screen-name", "field-type": "STRING", "is-open": false }, { "field-name": "lang", "field-type": "STRING", "is-open": false }, { "field-name": "friends_count", "field-type": "INT64", "is-open": false }, { "field-name": "statuses_count", "field-type": "INT64", "is-open": false } ]
+, [ { "field-name": "screen-name", "field-type": "STRING", "is-open": false }, { "field-name": "lang", "field-type": "STRING", "is-open": false }, { "field-name": "friends_count", "field-type": "INT64", "is-open": false }, { "field-name": "statuses_count", "field-type": "INT64", "is-open": false } ]
+, [ { "field-name": "screen-name", "field-type": "STRING", "is-open": false }, { "field-name": "lang", "field-type": "STRING", "is-open": false }, { "field-name": "friends_count", "field-type": "INT64", "is-open": false }, { "field-name": "statuses_count", "field-type": "INT64", "is-open": false } ]
+ ]
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-app/src/test/resources/runtimets/results/records/get-record-fields/tiny-social-example-only-records/tiny-social-example-only-records.8.adm
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/results/records/get-record-fields/tiny-social-example-only-records/tiny-social-example-only-records.8.adm b/asterix-app/src/test/resources/runtimets/results/records/get-record-fields/tiny-social-example-only-records/tiny-social-example-only-records.8.adm
new file mode 100644
index 0000000..bf9b501
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/records/get-record-fields/tiny-social-example-only-records/tiny-social-example-only-records.8.adm
@@ -0,0 +1,13 @@
+[ [ { "field-name": "tweetid", "field-type": "STRING", "is-open": false }, { "field-name": "user", "field-type": "RECORD", "is-open": false, "nested": [ { "field-name": "screen-name", "field-type": "STRING", "is-open": false }, { "field-name": "lang", "field-type": "STRING", "is-open": false }, { "field-name": "friends_count", "field-type": "INT64", "is-open": false }, { "field-name": "statuses_count", "field-type": "INT64", "is-open": false }, { "field-name": "name", "field-type": "STRING", "is-open": true }, { "field-name": "followers_count", "field-type": "INT64", "is-open": true } ] }, { "field-name": "sender-location", "field-type": "POINT", "is-open": false }, { "field-name": "send-time", "field-type": "DATETIME", "is-open": false }, { "field-name": "message-text", "field-type": "STRING", "is-open": false } ]
+, [ { "field-name": "tweetid", "field-type": "STRING", "is-open": false }, { "field-name": "user", "field-type": "RECORD", "is-open": false, "nested": [ { "field-name": "screen-name", "field-type": "STRING", "is-open": false }, { "field-name": "lang", "field-type": "STRING", "is-open": false }, { "field-name": "friends_count", "field-type": "INT64", "is-open": false }, { "field-name": "statuses_count", "field-type": "INT64", "is-open": false }, { "field-name": "name", "field-type": "STRING", "is-open": true }, { "field-name": "followers_count", "field-type": "INT64", "is-open": true } ] }, { "field-name": "sender-location", "field-type": "POINT", "is-open": false }, { "field-name": "send-time", "field-type": "DATETIME", "is-open": false }, { "field-name": "message-text", "field-type": "STRING", "is-open": false } ]
+, [ { "field-name": "tweetid", "field-type": "STRING", "is-open": false }, { "field-name": "user", "field-type": "RECORD", "is-open": false, "nested": [ { "field-name": "screen-name", "field-type": "STRING", "is-open": false }, { "field-name": "lang", "field-type": "STRING", "is-open": false }, { "field-name": "friends_count", "field-type": "INT64", "is-open": false }, { "field-name": "statuses_count", "field-type": "INT64", "is-open": false }, { "field-name": "name", "field-type": "STRING", "is-open": true }, { "field-name": "followers_count", "field-type": "INT64", "is-open": true } ] }, { "field-name": "sender-location", "field-type": "POINT", "is-open": false }, { "field-name": "send-time", "field-type": "DATETIME", "is-open": false }, { "field-name": "message-text", "field-type": "STRING", "is-open": false } ]
+, [ { "field-name": "tweetid", "field-type": "STRING", "is-open": false }, { "field-name": "user", "field-type": "RECORD", "is-open": false, "nested": [ { "field-name": "screen-name", "field-type": "STRING", "is-open": false }, { "field-name": "lang", "field-type": "STRING", "is-open": false }, { "field-name": "friends_count", "field-type": "INT64", "is-open": false }, { "field-name": "statuses_count", "field-type": "INT64", "is-open": false }, { "field-name": "name", "field-type": "STRING", "is-open": true }, { "field-name": "followers_count", "field-type": "INT64", "is-open": true } ] }, { "field-name": "sender-location", "field-type": "POINT", "is-open": false }, { "field-name": "send-time", "field-type": "DATETIME", "is-open": false }, { "field-name": "message-text", "field-type": "STRING", "is-open": false } ]
+, [ { "field-name": "tweetid", "field-type": "STRING", "is-open": false }, { "field-name": "user", "field-type": "RECORD", "is-open": false, "nested": [ { "field-name": "screen-name", "field-type": "STRING", "is-open": false }, { "field-name": "lang", "field-type": "STRING", "is-open": false }, { "field-name": "friends_count", "field-type": "INT64", "is-open": false }, { "field-name": "statuses_count", "field-type": "INT64", "is-open": false }, { "field-name": "name", "field-type": "STRING", "is-open": true }, { "field-name": "followers_count", "field-type": "INT64", "is-open": true } ] }, { "field-name": "sender-location", "field-type": "POINT", "is-open": false }, { "field-name": "send-time", "field-type": "DATETIME", "is-open": false }, { "field-name": "message-text", "field-type": "STRING", "is-open": false } ]
+, [ { "field-name": "tweetid", "field-type": "STRING", "is-open": false }, { "field-name": "user", "field-type": "RECORD", "is-open": false, "nested": [ { "field-name": "screen-name", "field-type": "STRING", "is-open": false }, { "field-name": "lang", "field-type": "STRING", "is-open": false }, { "field-name": "friends_count", "field-type": "INT64", "is-open": false }, { "field-name": "statuses_count", "field-type": "INT64", "is-open": false }, { "field-name": "name", "field-type": "STRING", "is-open": true }, { "field-name": "followers_count", "field-type": "INT64", "is-open": true } ] }, { "field-name": "sender-location", "field-type": "POINT", "is-open": false }, { "field-name": "send-time", "field-type": "DATETIME", "is-open": false }, { "field-name": "message-text", "field-type": "STRING", "is-open": false } ]
+, [ { "field-name": "tweetid", "field-type": "STRING", "is-open": false }, { "field-name": "user", "field-type": "RECORD", "is-open": false, "nested": [ { "field-name": "screen-name", "field-type": "STRING", "is-open": false }, { "field-name": "lang", "field-type": "STRING", "is-open": false }, { "field-name": "friends_count", "field-type": "INT64", "is-open": false }, { "field-name": "statuses_count", "field-type": "INT64", "is-open": false }, { "field-name": "name", "field-type": "STRING", "is-open": true }, { "field-name": "followers_count", "field-type": "INT64", "is-open": true } ] }, { "field-name": "sender-location", "field-type": "POINT", "is-open": false }, { "field-name": "send-time", "field-type": "DATETIME", "is-open": false }, { "field-name": "message-text", "field-type": "STRING", "is-open": false } ]
+, [ { "field-name": "tweetid", "field-type": "STRING", "is-open": false }, { "field-name": "user", "field-type": "RECORD", "is-open": false, "nested": [ { "field-name": "screen-name", "field-type": "STRING", "is-open": false }, { "field-name": "lang", "field-type": "STRING", "is-open": false }, { "field-name": "friends_count", "field-type": "INT64", "is-open": false }, { "field-name": "statuses_count", "field-type": "INT64", "is-open": false }, { "field-name": "name", "field-type": "STRING", "is-open": true }, { "field-name": "followers_count", "field-type": "INT64", "is-open": true } ] }, { "field-name": "sender-location", "field-type": "POINT", "is-open": false }, { "field-name": "send-time", "field-type": "DATETIME", "is-open": false }, { "field-name": "message-text", "field-type": "STRING", "is-open": false } ]
+, [ { "field-name": "tweetid", "field-type": "STRING", "is-open": false }, { "field-name": "user", "field-type": "RECORD", "is-open": false, "nested": [ { "field-name": "screen-name", "field-type": "STRING", "is-open": false }, { "field-name": "lang", "field-type": "STRING", "is-open": false }, { "field-name": "friends_count", "field-type": "INT64", "is-open": false }, { "field-name": "statuses_count", "field-type": "INT64", "is-open": false }, { "field-name": "name", "field-type": "STRING", "is-open": true }, { "field-name": "followers_count", "field-type": "INT64", "is-open": true } ] }, { "field-name": "sender-location", "field-type": "POINT", "is-open": false }, { "field-name": "send-time", "field-type": "DATETIME", "is-open": false }, { "field-name": "message-text", "field-type": "STRING", "is-open": false } ]
+, [ { "field-name": "tweetid", "field-type": "STRING", "is-open": false }, { "field-name": "user", "field-type": "RECORD", "is-open": false, "nested": [ { "field-name": "screen-name", "field-type": "STRING", "is-open": false }, { "field-name": "lang", "field-type": "STRING", "is-open": false }, { "field-name": "friends_count", "field-type": "INT64", "is-open": false }, { "field-name": "statuses_count", "field-type": "INT64", "is-open": false }, { "field-name": "name", "field-type": "STRING", "is-open": true }, { "field-name": "followers_count", "field-type": "INT64", "is-open": true } ] }, { "field-name": "sender-location", "field-type": "POINT", "is-open": false }, { "field-name": "send-time", "field-type": "DATETIME", "is-open": false }, { "field-name": "message-text", "field-type": "STRING", "is-open": false } ]
+, [ { "field-name": "tweetid", "field-type": "STRING", "is-open": false }, { "field-name": "user", "field-type": "RECORD", "is-open": false, "nested": [ { "field-name": "screen-name", "field-type": "STRING", "is-open": false }, { "field-name": "lang", "field-type": "STRING", "is-open": false }, { "field-name": "friends_count", "field-type": "INT64", "is-open": false }, { "field-name": "statuses_count", "field-type": "INT64", "is-open": false }, { "field-name": "name", "field-type": "STRING", "is-open": true }, { "field-name": "followers_count", "field-type": "INT64", "is-open": true } ] }, { "field-name": "sender-location", "field-type": "POINT", "is-open": false }, { "field-name": "send-time", "field-type": "DATETIME", "is-open": false }, { "field-name": "message-text", "field-type": "STRING", "is-open": false } ]
+, [ { "field-name": "tweetid", "field-type": "STRING", "is-open": false }, { "field-name": "user", "field-type": "RECORD", "is-open": false, "nested": [ { "field-name": "screen-name", "field-type": "STRING", "is-open": false }, { "field-name": "lang", "field-type": "STRING", "is-open": false }, { "field-name": "friends_count", "field-type": "INT64", "is-open": false }, { "field-name": "statuses_count", "field-type": "INT64", "is-open": false }, { "field-name": "name", "field-type": "STRING", "is-open": true }, { "field-name": "followers_count", "field-type": "INT64", "is-open": true } ] }, { "field-name": "sender-location", "field-type": "POINT", "is-open": false }, { "field-name": "send-time", "field-type": "DATETIME", "is-open": false }, { "field-name": "message-text", "field-type": "STRING", "is-open": false } ]
+ ]
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-app/src/test/resources/runtimets/results/records/get-record-fields/tiny-social-example-only-records/tiny-social-example-only-records.9.adm
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/results/records/get-record-fields/tiny-social-example-only-records/tiny-social-example-only-records.9.adm b/asterix-app/src/test/resources/runtimets/results/records/get-record-fields/tiny-social-example-only-records/tiny-social-example-only-records.9.adm
new file mode 100644
index 0000000..d831c10
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/records/get-record-fields/tiny-social-example-only-records/tiny-social-example-only-records.9.adm
@@ -0,0 +1,6 @@
+[ { "count": 12, "field-name": "message-text", "field-type": "STRING" }
+, { "count": 12, "field-name": "send-time", "field-type": "DATETIME" }
+, { "count": 12, "field-name": "sender-location", "field-type": "POINT" }
+, { "count": 12, "field-name": "tweetid", "field-type": "STRING" }
+, { "count": 12, "field-name": "user", "field-type": "RECORD" }
+ ]
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-app/src/test/resources/runtimets/results/records/get-record-fields/tiny-social-example/tiny-social-example.4.adm
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/results/records/get-record-fields/tiny-social-example/tiny-social-example.4.adm b/asterix-app/src/test/resources/runtimets/results/records/get-record-fields/tiny-social-example/tiny-social-example.4.adm
new file mode 100644
index 0000000..3822ce7
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/records/get-record-fields/tiny-social-example/tiny-social-example.4.adm
@@ -0,0 +1,2 @@
+[ [ { "field-name": "id", "field-type": "INT64", "is-open": false }, { "field-name": "alias", "field-type": "STRING", "is-open": false }, { "field-name": "name", "field-type": "STRING", "is-open": false }, { "field-name": "user-since", "field-type": "DATETIME", "is-open": false }, { "field-name": "friend-ids", "field-type": "UNORDEREDLIST", "is-open": false, "list": [ { "field-type": "INT64" } ] }, { "field-name": "employment", "field-type": "ORDEREDLIST", "is-open": false, "list": [ { "field-type": "RECORD", "nested": [ { "field-name": "organization-name", "field-type": "STRING", "is-open": false }, { "field-name": "start-date", "field-type": "DATE", "is-open": false }, { "field-name": "end-date", "field-type": "DATE", "is-open": false } ] } ] } ]
+ ]
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-app/src/test/resources/runtimets/results/records/get-record-fields/tiny-social-example/tiny-social-example.5.adm
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/results/records/get-record-fields/tiny-social-example/tiny-social-example.5.adm b/asterix-app/src/test/resources/runtimets/results/records/get-record-fields/tiny-social-example/tiny-social-example.5.adm
new file mode 100644
index 0000000..d5a41d3
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/records/get-record-fields/tiny-social-example/tiny-social-example.5.adm
@@ -0,0 +1,11 @@
+[ [ { "field-name": "id", "field-type": "INT64", "is-open": false }, { "field-name": "alias", "field-type": "STRING", "is-open": false }, { "field-name": "name", "field-type": "STRING", "is-open": false }, { "field-name": "user-since", "field-type": "DATETIME", "is-open": false }, { "field-name": "friend-ids", "field-type": "UNORDEREDLIST", "is-open": false, "list": [ { "field-type": "INT64" }, { "field-type": "INT64" }, { "field-type": "INT64" }, { "field-type": "INT64" } ] }, { "field-name": "employment", "field-type": "ORDEREDLIST", "is-open": false, "list": [ { "field-type": "RECORD", "nested": [ { "field-name": "organization-name", "field-type": "STRING", "is-open": false }, { "field-name": "start-date", "field-type": "DATE", "is-open": false }, { "field-name": "end-date", "field-type": "DATE", "is-open": false } ] } ] } ]
+, [ { "field-name": "id", "field-type": "INT64", "is-open": false }, { "field-name": "alias", "field-type": "STRING", "is-open": false }, { "field-name": "name", "field-type": "STRING", "is-open": false }, { "field-name": "user-since", "field-type": "DATETIME", "is-open": false }, { "field-name": "friend-ids", "field-type": "UNORDEREDLIST", "is-open": false, "list": [ { "field-type": "INT64" }, { "field-type": "INT64" } ] }, { "field-name": "employment", "field-type": "ORDEREDLIST", "is-open": false, "list": [ { "field-type": "RECORD", "nested": [ { "field-name": "organization-name", "field-type": "STRING", "is-open": false }, { "field-name": "start-date", "field-type": "DATE", "is-open": false }, { "field-name": "end-date", "field-type": "DATE", "is-open": false } ] } ] } ]
+, [ { "field-name": "id", "field-type": "INT64", "is-open": false }, { "field-name": "alias", "field-type": "STRING", "is-open": false }, { "field-name": "name", "field-type": "STRING", "is-open": false }, { "field-name": "user-since", "field-type": "DATETIME", "is-open": false }, { "field-name": "friend-ids", "field-type": "UNORDEREDLIST", "is-open": false, "list": [ { "field-type": "INT64" }, { "field-type": "INT64" }, { "field-type": "INT64" }, { "field-type": "INT64" } ] }, { "field-name": "employment", "field-type": "ORDEREDLIST", "is-open": false, "list": [ { "field-type": "RECORD", "nested": [ { "field-name": "organization-name", "field-type": "STRING", "is-open": false }, { "field-name": "start-date", "field-type": "DATE", "is-open": false }, { "field-name": "end-date", "field-type": "DATE", "is-open": false } ] } ] } ]
+, [ { "field-name": "id", "field-type": "INT64", "is-open": false }, { "field-name": "alias", "field-type": "STRING", "is-open": false }, { "field-name": "name", "field-type": "STRING", "is-open": false }, { "field-name": "user-since", "field-type": "DATETIME", "is-open": false }, { "field-name": "friend-ids", "field-type": "UNORDEREDLIST", "is-open": false, "list": [ { "field-type": "INT64" } ] }, { "field-name": "employment", "field-type": "ORDEREDLIST", "is-open": false, "list": [ { "field-type": "RECORD", "nested": [ { "field-name": "organization-name", "field-type": "STRING", "is-open": false }, { "field-name": "start-date", "field-type": "DATE", "is-open": false }, { "field-name": "end-date", "field-type": "DATE", "is-open": false } ] } ] } ]
+, [ { "field-name": "id", "field-type": "INT64", "is-open": false }, { "field-name": "alias", "field-type": "STRING", "is-open": false }, { "field-name": "name", "field-type": "STRING", "is-open": false }, { "field-name": "user-since", "field-type": "DATETIME", "is-open": false }, { "field-name": "friend-ids", "field-type": "UNORDEREDLIST", "is-open": false, "list": [ { "field-type": "INT64" }, { "field-type": "INT64" }, { "field-type": "INT64" } ] }, { "field-name": "employment", "field-type": "ORDEREDLIST", "is-open": false, "list": [ { "field-type": "RECORD", "nested": [ { "field-name": "organization-name", "field-type": "STRING", "is-open": false }, { "field-name": "start-date", "field-type": "DATE", "is-open": false }, { "field-name": "end-date", "field-type": "DATE", "is-open": false } ] } ] } ]
+, [ { "field-name": "id", "field-type": "INT64", "is-open": false }, { "field-name": "alias", "field-type": "STRING", "is-open": false }, { "field-name": "name", "field-type": "STRING", "is-open": false }, { "field-name": "user-since", "field-type": "DATETIME", "is-open": false }, { "field-name": "friend-ids", "field-type": "UNORDEREDLIST", "is-open": false, "list": [ { "field-type": "INT64" }, { "field-type": "INT64" }, { "field-type": "INT64" } ] }, { "field-name": "employment", "field-type": "ORDEREDLIST", "is-open": false, "list": [ { "field-type": "RECORD", "nested": [ { "field-name": "organization-name", "field-type": "STRING", "is-open": false }, { "field-name": "start-date", "field-type": "DATE", "is-open": false }, { "field-name": "end-date", "field-type": "DATE", "is-open": false } ] } ] } ]
+, [ { "field-name": "id", "field-type": "INT64", "is-open": false }, { "field-name": "alias", "field-type": "STRING", "is-open": false }, { "field-name": "name", "field-type": "STRING", "is-open": false }, { "field-name": "user-since", "field-type": "DATETIME", "is-open": false }, { "field-name": "friend-ids", "field-type": "UNORDEREDLIST", "is-open": false, "list": [ { "field-type": "INT64" } ] }, { "field-name": "employment", "field-type": "ORDEREDLIST", "is-open": false, "list": [ { "field-type": "RECORD", "nested": [ { "field-name": "organization-name", "field-type": "STRING", "is-open": false }, { "field-name": "start-date", "field-type": "DATE", "is-open": false }, { "field-name": "end-date", "field-type": "DATE", "is-open": false } ] } ] } ]
+, [ { "field-name": "id", "field-type": "INT64", "is-open": false }, { "field-name": "alias", "field-type": "STRING", "is-open": false }, { "field-name": "name", "field-type": "STRING", "is-open": false }, { "field-name": "user-since", "field-type": "DATETIME", "is-open": false }, { "field-name": "friend-ids", "field-type": "UNORDEREDLIST", "is-open": false, "list": [ { "field-type": "INT64" } ] }, { "field-name": "employment", "field-type": "ORDEREDLIST", "is-open": false, "list": [ { "field-type": "RECORD", "nested": [ { "field-name": "organization-name", "field-type": "STRING", "is-open": false }, { "field-name": "start-date", "field-type": "DATE", "is-open": false }, { "field-name": "end-date", "field-type": "DATE", "is-open": false } ] } ] } ]
+, [ { "field-name": "id", "field-type": "INT64", "is-open": false }, { "field-name": "alias", "field-type": "STRING", "is-open": false }, { "field-name": "name", "field-type": "STRING", "is-open": false }, { "field-name": "user-since", "field-type": "DATETIME", "is-open": false }, { "field-name": "friend-ids", "field-type": "UNORDEREDLIST", "is-open": false, "list": [ { "field-type": "INT64" }, { "field-type": "INT64" } ] }, { "field-name": "employment", "field-type": "ORDEREDLIST", "is-open": false, "list": [ { "field-type": "RECORD", "nested": [ { "field-name": "organization-name", "field-type": "STRING", "is-open": false }, { "field-name": "start-date", "field-type": "DATE", "is-open": false }, { "field-name": "end-date", "field-type": "DATE", "is-open": false } ] } ] } ]
+, [ { "field-name": "id", "field-type": "INT64", "is-open": false }, { "field-name": "alias", "field-type": "STRING", "is-open": false }, { "field-name": "name", "field-type": "STRING", "is-open": false }, { "field-name": "user-since", "field-type": "DATETIME", "is-open": false }, { "field-name": "friend-ids", "field-type": "UNORDEREDLIST", "is-open": false, "list": [ { "field-type": "INT64" }, { "field-type": "INT64" }, { "field-type": "INT64" } ] }, { "field-name": "employment", "field-type": "ORDEREDLIST", "is-open": false, "list": [ { "field-type": "RECORD", "nested": [ { "field-name": "organization-name", "field-type": "STRING", "is-open": false }, { "field-name": "start-date", "field-type": "DATE", "is-open": false }, { "field-name": "end-date", "field-type": "DATE", "is-open": false } ] } ] } ]
+ ]
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-app/src/test/resources/runtimets/results/records/get-record-fields/tiny-social-example/tiny-social-example.6.adm
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/results/records/get-record-fields/tiny-social-example/tiny-social-example.6.adm b/asterix-app/src/test/resources/runtimets/results/records/get-record-fields/tiny-social-example/tiny-social-example.6.adm
new file mode 100644
index 0000000..8fdd58c
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/records/get-record-fields/tiny-social-example/tiny-social-example.6.adm
@@ -0,0 +1,16 @@
+[ [ { "field-name": "message-id", "field-type": "INT64", "is-open": false }, { "field-name": "author-id", "field-type": "INT64", "is-open": false }, { "field-name": "in-response-to", "field-type": "INT64", "is-open": false }, { "field-name": "sender-location", "field-type": "POINT", "is-open": false }, { "field-name": "message", "field-type": "STRING", "is-open": false } ]
+, [ { "field-name": "message-id", "field-type": "INT64", "is-open": false }, { "field-name": "author-id", "field-type": "INT64", "is-open": false }, { "field-name": "in-response-to", "field-type": "INT64", "is-open": false }, { "field-name": "sender-location", "field-type": "POINT", "is-open": false }, { "field-name": "message", "field-type": "STRING", "is-open": false } ]
+, [ { "field-name": "message-id", "field-type": "INT64", "is-open": false }, { "field-name": "author-id", "field-type": "INT64", "is-open": false }, { "field-name": "in-response-to", "field-type": "INT64", "is-open": false }, { "field-name": "sender-location", "field-type": "POINT", "is-open": false }, { "field-name": "message", "field-type": "STRING", "is-open": false } ]
+, [ { "field-name": "message-id", "field-type": "INT64", "is-open": false }, { "field-name": "author-id", "field-type": "INT64", "is-open": false }, { "field-name": "in-response-to", "field-type": "INT64", "is-open": false }, { "field-name": "sender-location", "field-type": "POINT", "is-open": false }, { "field-name": "message", "field-type": "STRING", "is-open": false } ]
+, [ { "field-name": "message-id", "field-type": "INT64", "is-open": false }, { "field-name": "author-id", "field-type": "INT64", "is-open": false }, { "field-name": "in-response-to", "field-type": "INT64", "is-open": false }, { "field-name": "sender-location", "field-type": "POINT", "is-open": false }, { "field-name": "message", "field-type": "STRING", "is-open": false } ]
+, [ { "field-name": "message-id", "field-type": "INT64", "is-open": false }, { "field-name": "author-id", "field-type": "INT64", "is-open": false }, { "field-name": "in-response-to", "field-type": "INT64", "is-open": false }, { "field-name": "sender-location", "field-type": "POINT", "is-open": false }, { "field-name": "message", "field-type": "STRING", "is-open": false } ]
+, [ { "field-name": "message-id", "field-type": "INT64", "is-open": false }, { "field-name": "author-id", "field-type": "INT64", "is-open": false }, { "field-name": "in-response-to", "field-type": "INT64", "is-open": false }, { "field-name": "sender-location", "field-type": "POINT", "is-open": false }, { "field-name": "message", "field-type": "STRING", "is-open": false } ]
+, [ { "field-name": "message-id", "field-type": "INT64", "is-open": false }, { "field-name": "author-id", "field-type": "INT64", "is-open": false }, { "field-name": "in-response-to", "field-type": "INT64", "is-open": false }, { "field-name": "sender-location", "field-type": "POINT", "is-open": false }, { "field-name": "message", "field-type": "STRING", "is-open": false } ]
+, [ { "field-name": "message-id", "field-type": "INT64", "is-open": false }, { "field-name": "author-id", "field-type": "INT64", "is-open": false }, { "field-name": "in-response-to", "field-type": "INT64", "is-open": false }, { "field-name": "sender-location", "field-type": "POINT", "is-open": false }, { "field-name": "message", "field-type": "STRING", "is-open": false } ]
+, [ { "field-name": "message-id", "field-type": "INT64", "is-open": false }, { "field-name": "author-id", "field-type": "INT64", "is-open": false }, { "field-name": "in-response-to", "field-type": "INT64", "is-open": false }, { "field-name": "sender-location", "field-type": "POINT", "is-open": false }, { "field-name": "message", "field-type": "STRING", "is-open": false } ]
+, [ { "field-name": "message-id", "field-type": "INT64", "is-open": false }, { "field-name": "author-id", "field-type": "INT64", "is-open": false }, { "field-name": "in-response-to", "field-type": "INT64", "is-open": false }, { "field-name": "sender-location", "field-type": "POINT", "is-open": false }, { "field-name": "message", "field-type": "STRING", "is-open": false } ]
+, [ { "field-name": "message-id", "field-type": "INT64", "is-open": false }, { "field-name": "author-id", "field-type": "INT64", "is-open": false }, { "field-name": "in-response-to", "field-type": "INT64", "is-open": false }, { "field-name": "sender-location", "field-type": "POINT", "is-open": false }, { "field-name": "message", "field-type": "STRING", "is-open": false } ]
+, [ { "field-name": "message-id", "field-type": "INT64", "is-open": false }, { "field-name": "author-id", "field-type": "INT64", "is-open": false }, { "field-name": "in-response-to", "field-type": "INT64", "is-open": false }, { "field-name": "sender-location", "field-type": "POINT", "is-open": false }, { "field-name": "message", "field-type": "STRING", "is-open": false } ]
+, [ { "field-name": "message-id", "field-type": "INT64", "is-open": false }, { "field-name": "author-id", "field-type": "INT64", "is-open": false }, { "field-name": "in-response-to", "field-type": "INT64", "is-open": false }, { "field-name": "sender-location", "field-type": "POINT", "is-open": false }, { "field-name": "message", "field-type": "STRING", "is-open": false } ]
+, [ { "field-name": "message-id", "field-type": "INT64", "is-open": false }, { "field-name": "author-id", "field-type": "INT64", "is-open": false }, { "field-name": "in-response-to", "field-type": "INT64", "is-open": false }, { "field-name": "sender-location", "field-type": "POINT", "is-open": false }, { "field-name": "message", "field-type": "STRING", "is-open": false } ]
+ ]
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-app/src/test/resources/runtimets/results/records/get-record-fields/tiny-social-example/tiny-social-example.7.adm
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/results/records/get-record-fields/tiny-social-example/tiny-social-example.7.adm b/asterix-app/src/test/resources/runtimets/results/records/get-record-fields/tiny-social-example/tiny-social-example.7.adm
new file mode 100644
index 0000000..55daef6
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/records/get-record-fields/tiny-social-example/tiny-social-example.7.adm
@@ -0,0 +1,5 @@
+[ [ { "field-name": "screen-name", "field-type": "STRING", "is-open": false }, { "field-name": "lang", "field-type": "STRING", "is-open": false }, { "field-name": "friends_count", "field-type": "INT64", "is-open": false }, { "field-name": "statuses_count", "field-type": "INT64", "is-open": false }, { "field-name": "name", "field-type": "STRING", "is-open": true }, { "field-name": "followers_count", "field-type": "INT64", "is-open": true } ]
+, [ { "field-name": "screen-name", "field-type": "STRING", "is-open": false }, { "field-name": "lang", "field-type": "STRING", "is-open": false }, { "field-name": "friends_count", "field-type": "INT64", "is-open": false }, { "field-name": "statuses_count", "field-type": "INT64", "is-open": false }, { "field-name": "name", "field-type": "STRING", "is-open": true }, { "field-name": "followers_count", "field-type": "INT64", "is-open": true } ]
+, [ { "field-name": "screen-name", "field-type": "STRING", "is-open": false }, { "field-name": "lang", "field-type": "STRING", "is-open": false }, { "field-name": "friends_count", "field-type": "INT64", "is-open": false }, { "field-name": "statuses_count", "field-type": "INT64", "is-open": false }, { "field-name": "name", "field-type": "STRING", "is-open": true }, { "field-name": "followers_count", "field-type": "INT64", "is-open": true } ]
+, [ { "field-name": "screen-name", "field-type": "STRING", "is-open": false }, { "field-name": "lang", "field-type": "STRING", "is-open": false }, { "field-name": "friends_count", "field-type": "INT64", "is-open": false }, { "field-name": "statuses_count", "field-type": "INT64", "is-open": false }, { "field-name": "name", "field-type": "STRING", "is-open": true }, { "field-name": "followers_count", "field-type": "INT64", "is-open": true } ]
+ ]
\ No newline at end of file


[9/9] incubator-asterixdb git commit: Reconcile ASF and Gerrit master branches

Posted by im...@apache.org.
Reconcile ASF and Gerrit master branches

Both parents of this merge commit are the same content-wise, excepting the commit message.
We have to make this commit to get both repositories back to a common version of master.


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

Branch: refs/heads/master
Commit: 397f2361ce3f6785ac1806600daa594d147e5a68
Parents: c66d23a 900bf13
Author: Ian Maxon <im...@apache.org>
Authored: Tue Jul 14 20:08:47 2015 -0700
Committer: Ian Maxon <im...@apache.org>
Committed: Tue Jul 14 20:08:47 2015 -0700

----------------------------------------------------------------------

----------------------------------------------------------------------



[4/9] incubator-asterixdb git commit: Adding introspection for getting record details.

Posted by im...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-om/src/main/java/edu/uci/ics/asterix/om/functions/AsterixBuiltinFunctions.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/om/functions/AsterixBuiltinFunctions.java b/asterix-om/src/main/java/edu/uci/ics/asterix/om/functions/AsterixBuiltinFunctions.java
index fa99064..560156c 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/om/functions/AsterixBuiltinFunctions.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/om/functions/AsterixBuiltinFunctions.java
@@ -38,6 +38,7 @@ import edu.uci.ics.asterix.om.typecomputer.impl.ARectangleTypeComputer;
 import edu.uci.ics.asterix.om.typecomputer.impl.AStringTypeComputer;
 import edu.uci.ics.asterix.om.typecomputer.impl.ATimeTypeComputer;
 import edu.uci.ics.asterix.om.typecomputer.impl.AUUIDTypeComputer;
+import edu.uci.ics.asterix.om.typecomputer.impl.AnyTypeComputer;
 import edu.uci.ics.asterix.om.typecomputer.impl.BinaryBooleanOrNullFunctionTypeComputer;
 import edu.uci.ics.asterix.om.typecomputer.impl.BinaryStringBoolOrNullTypeComputer;
 import edu.uci.ics.asterix.om.typecomputer.impl.BinaryStringStringOrNullTypeComputer;
@@ -96,6 +97,7 @@ import edu.uci.ics.asterix.om.typecomputer.impl.OrderedListOfAnyTypeComputer;
 import edu.uci.ics.asterix.om.typecomputer.impl.QuadStringStringOrNullTypeComputer;
 import edu.uci.ics.asterix.om.typecomputer.impl.RecordMergeTypeComputer;
 import edu.uci.ics.asterix.om.typecomputer.impl.ScalarVersionOfAggregateResultType;
+import edu.uci.ics.asterix.om.typecomputer.impl.SubsetCollectionTypeComputer;
 import edu.uci.ics.asterix.om.typecomputer.impl.Substring2TypeComputer;
 import edu.uci.ics.asterix.om.typecomputer.impl.SubstringTypeComputer;
 import edu.uci.ics.asterix.om.typecomputer.impl.TripleStringBoolOrNullTypeComputer;
@@ -105,22 +107,12 @@ import edu.uci.ics.asterix.om.typecomputer.impl.UnaryBooleanOrNullFunctionTypeCo
 import edu.uci.ics.asterix.om.typecomputer.impl.UnaryStringInt64OrNullTypeComputer;
 import edu.uci.ics.asterix.om.typecomputer.impl.UnaryStringOrNullTypeComputer;
 import edu.uci.ics.asterix.om.typecomputer.impl.UnorderedListConstructorResultType;
-import edu.uci.ics.asterix.om.types.AOrderedListType;
-import edu.uci.ics.asterix.om.types.ATypeTag;
-import edu.uci.ics.asterix.om.types.AUnionType;
-import edu.uci.ics.asterix.om.types.AbstractCollectionType;
-import edu.uci.ics.asterix.om.types.BuiltinType;
-import edu.uci.ics.asterix.om.types.IAType;
 import edu.uci.ics.asterix.om.types.hierachy.ATypeHierarchy;
-import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
 import edu.uci.ics.hyracks.algebricks.core.algebra.base.ILogicalExpression;
-import edu.uci.ics.hyracks.algebricks.core.algebra.expressions.AbstractFunctionCallExpression;
 import edu.uci.ics.hyracks.algebricks.core.algebra.expressions.AggregateFunctionCallExpression;
-import edu.uci.ics.hyracks.algebricks.core.algebra.expressions.IVariableTypeEnvironment;
 import edu.uci.ics.hyracks.algebricks.core.algebra.functions.AlgebricksBuiltinFunctions;
 import edu.uci.ics.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
 import edu.uci.ics.hyracks.algebricks.core.algebra.functions.IFunctionInfo;
-import edu.uci.ics.hyracks.algebricks.core.algebra.metadata.IMetadataProvider;
 
 public class AsterixBuiltinFunctions {
 
@@ -191,10 +183,14 @@ public class AsterixBuiltinFunctions {
             "field-access-by-name", 2);
     public final static FunctionIdentifier FIELD_ACCESS_NESTED = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
             "field-access-nested", 2);
+    public final static FunctionIdentifier GET_RECORD_FIELDS = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
+            "get-record-fields", 1);
+    public final static FunctionIdentifier GET_RECORD_FIELD_VALUE = new FunctionIdentifier(
+            FunctionConstants.ASTERIX_NS, "get-record-field-value", 2);
 
+    // numeric
     public final static FunctionIdentifier NUMERIC_UNARY_MINUS = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
             "numeric-unary-minus", 1);
-
     public final static FunctionIdentifier NUMERIC_SUBTRACT = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
             "numeric-subtract", 2);
     public final static FunctionIdentifier NUMERIC_MULTIPLY = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
@@ -206,7 +202,6 @@ public class AsterixBuiltinFunctions {
     public final static FunctionIdentifier NUMERIC_IDIV = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
             "numeric-idiv", 2);
     public final static FunctionIdentifier CARET = new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "caret", 2);
-
     public final static FunctionIdentifier NUMERIC_ABS = new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "abs", 1);
     public final static FunctionIdentifier NUMERIC_CEILING = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
             "ceiling", 1);
@@ -754,8 +749,6 @@ public class AsterixBuiltinFunctions {
         addFunction(BOOLEAN_CONSTRUCTOR, UnaryBooleanOrNullFunctionTypeComputer.INSTANCE, true);
         addPrivateFunction(CARET, NonTaggedNumericAddSubMulDivTypeComputer.INSTANCE, true);
         addFunction(CIRCLE_CONSTRUCTOR, OptionalACircleTypeComputer.INSTANCE, true);
-        addPrivateFunction(RECORD_MERGE, RecordMergeTypeComputer.INSTANCE, true);
-        addPrivateFunction(CLOSED_RECORD_CONSTRUCTOR, ClosedRecordConstructorResultType.INSTANCE, true);
         addPrivateFunction(CONCAT_NON_NULL, ConcatNonNullTypeComputer.INSTANCE, true);
 
         addFunction(CONTAINS, ABooleanTypeComputer.INSTANCE, true);
@@ -780,19 +773,11 @@ public class AsterixBuiltinFunctions {
         addFunction(EDIT_DISTANCE_CHECK, OrderedListOfAnyTypeComputer.INSTANCE, true);
         addPrivateFunction(EDIT_DISTANCE_STRING_IS_FILTERABLE, ABooleanTypeComputer.INSTANCE, true);
         addPrivateFunction(EDIT_DISTANCE_LIST_IS_FILTERABLE, ABooleanTypeComputer.INSTANCE, true);
-        addPrivateFunction(EMBED_TYPE, new IResultTypeComputer() {
-            @Override
-            public IAType computeType(ILogicalExpression expression, IVariableTypeEnvironment env,
-                    IMetadataProvider<?, ?> mp) throws AlgebricksException {
-                return (IAType) BuiltinType.ANY;
-            }
-        }, true);
+        addPrivateFunction(EMBED_TYPE, AnyTypeComputer.INSTANCE, true);
         addPrivateFunction(EMPTY_STREAM, ABooleanTypeComputer.INSTANCE, true);
         addFunction(ENDS_WITH, ABooleanTypeComputer.INSTANCE, true);
         // add(FIELD_ACCESS, NonTaggedFieldAccessByNameResultType.INSTANCE);
-        addPrivateFunction(FIELD_ACCESS_BY_INDEX, FieldAccessByIndexResultType.INSTANCE, true);
-        addPrivateFunction(FIELD_ACCESS_NESTED, FieldAccessNestedResultType.INSTANCE, true);
-        addPrivateFunction(FIELD_ACCESS_BY_NAME, NonTaggedFieldAccessByNameResultType.INSTANCE, true);
+
         addFunction(FLOAT_CONSTRUCTOR, OptionalAFloatTypeComputer.INSTANCE, true);
         addPrivateFunction(FUZZY_EQ, BinaryBooleanOrNullFunctionTypeComputer.INSTANCE, true);
         addPrivateFunction(GET_HANDLE, null, true); // TODO
@@ -802,14 +787,7 @@ public class AsterixBuiltinFunctions {
         addPrivateFunction(GRAM_TOKENS, OrderedListOfAStringTypeComputer.INSTANCE, true);
         addPrivateFunction(HASHED_GRAM_TOKENS, OrderedListOfAInt32TypeComputer.INSTANCE, true);
         addPrivateFunction(HASHED_WORD_TOKENS, OrderedListOfAInt32TypeComputer.INSTANCE, true);
-        addPrivateFunction(INDEX_SEARCH, new IResultTypeComputer() {
-
-            @Override
-            public IAType computeType(ILogicalExpression expression, IVariableTypeEnvironment env,
-                    IMetadataProvider<?, ?> mp) throws AlgebricksException {
-                return BuiltinType.ANY; // TODO
-            }
-        }, true);
+        addPrivateFunction(INDEX_SEARCH, AnyTypeComputer.INSTANCE, true);
         addFunction(INT8_CONSTRUCTOR, OptionalAInt8TypeComputer.INSTANCE, true);
         addFunction(INT16_CONSTRUCTOR, OptionalAInt16TypeComputer.INSTANCE, true);
         addFunction(INT32_CONSTRUCTOR, OptionalAInt32TypeComputer.INSTANCE, true);
@@ -827,13 +805,13 @@ public class AsterixBuiltinFunctions {
         addPrivateFunction(LOCAL_MIN, NonTaggedMinMaxAggTypeComputer.INSTANCE, true);
         addPrivateFunction(NON_EMPTY_STREAM, ABooleanTypeComputer.INSTANCE, true);
         addFunction(NULL_CONSTRUCTOR, ANullTypeComputer.INSTANCE, true);
+
         addPrivateFunction(NUMERIC_UNARY_MINUS, NonTaggedUnaryMinusTypeComputer.INSTANCE, true);
         addPrivateFunction(NUMERIC_SUBTRACT, NonTaggedNumericAddSubMulDivTypeComputer.INSTANCE, true);
         addPrivateFunction(NUMERIC_MULTIPLY, NonTaggedNumericAddSubMulDivTypeComputer.INSTANCE, true);
         addPrivateFunction(NUMERIC_DIVIDE, NonTaggedNumericAddSubMulDivTypeComputer.INSTANCE, true);
         addPrivateFunction(NUMERIC_MOD, NonTaggedNumericAddSubMulDivTypeComputer.INSTANCE, true);
         addPrivateFunction(NUMERIC_IDIV, AInt64TypeComputer.INSTANCE, true);
-
         addFunction(NUMERIC_ABS, NonTaggedNumericUnaryFunctionTypeComputer.INSTANCE, true);
         addFunction(NUMERIC_CEILING, NonTaggedNumericUnaryFunctionTypeComputer.INSTANCE, true);
         addFunction(NUMERIC_FLOOR, NonTaggedNumericUnaryFunctionTypeComputer.INSTANCE, true);
@@ -868,7 +846,6 @@ public class AsterixBuiltinFunctions {
         addPrivateFunction(STRING_EQUAL, BinaryStringBoolOrNullTypeComputer.INSTANCE, true);
         addFunction(STRING_JOIN, AStringTypeComputer.INSTANCE, true);
 
-        addPrivateFunction(OPEN_RECORD_CONSTRUCTOR, OpenRecordConstructorResultType.INSTANCE, true);
         addPrivateFunction(ORDERED_LIST_CONSTRUCTOR, OrderedListConstructorResultType.INSTANCE, true);
         addFunction(POINT_CONSTRUCTOR, OptionalAPointTypeComputer.INSTANCE, true);
         addFunction(POINT3D_CONSTRUCTOR, OptionalAPoint3DTypeComputer.INSTANCE, true);
@@ -940,45 +917,7 @@ public class AsterixBuiltinFunctions {
         addFunction(BINARY_HEX_CONSTRUCTOR, OptionalABinaryTypeComputer.INSTANCE, true);
         addFunction(BINARY_BASE64_CONSTRUCTOR, OptionalABinaryTypeComputer.INSTANCE, true);
 
-        addPrivateFunction(UNION, UnorderedListConstructorResultType.INSTANCE, true);
-
-        addPrivateFunction(SUBSET_COLLECTION, new IResultTypeComputer() {
-
-            @Override
-            public IAType computeType(ILogicalExpression expression, IVariableTypeEnvironment env,
-                    IMetadataProvider<?, ?> mp) throws AlgebricksException {
-                AbstractFunctionCallExpression fun = (AbstractFunctionCallExpression) expression;
-                IAType t;
-                try {
-                    t = (IAType) env.getType(fun.getArguments().get(0).getValue());
-                } catch (AlgebricksException e) {
-                    throw new AlgebricksException(e);
-                }
-                switch (t.getTypeTag()) {
-                    case UNORDEREDLIST:
-                    case ORDEREDLIST: {
-                        AbstractCollectionType act = (AbstractCollectionType) t;
-                        return act.getItemType();
-                    }
-                    case UNION: {
-                        AUnionType ut = (AUnionType) t;
-                        if (!ut.isNullableType()) {
-                            throw new AlgebricksException("Expecting collection type. Found " + t);
-                        }
-                        IAType t2 = ut.getUnionList().get(1);
-                        ATypeTag tag2 = t2.getTypeTag();
-                        if (tag2 == ATypeTag.UNORDEREDLIST || tag2 == ATypeTag.ORDEREDLIST) {
-                            AbstractCollectionType act = (AbstractCollectionType) t2;
-                            return act.getItemType();
-                        }
-                        throw new AlgebricksException("Expecting collection type. Found " + t);
-                    }
-                    default: {
-                        throw new AlgebricksException("Expecting collection type. Found " + t);
-                    }
-                }
-            }
-        }, true);
+        addPrivateFunction(SUBSET_COLLECTION, SubsetCollectionTypeComputer.INSTANCE, true);
         addFunction(SUBSTRING, SubstringTypeComputer.INSTANCE, true);
         addFunction(SUM, NonTaggedNumericAggTypeComputer.INSTANCE, true);
         addPrivateFunction(LOCAL_SUM, NonTaggedNumericAggTypeComputer.INSTANCE, true);
@@ -991,14 +930,19 @@ public class AsterixBuiltinFunctions {
         addFunction(TID, AInt64TypeComputer.INSTANCE, true);
         addFunction(TIME_CONSTRUCTOR, OptionalATimeTypeComputer.INSTANCE, true);
         addPrivateFunction(TYPE_OF, null, true);
+        addPrivateFunction(UNION, UnorderedListConstructorResultType.INSTANCE, true);
         addPrivateFunction(UNORDERED_LIST_CONSTRUCTOR, UnorderedListConstructorResultType.INSTANCE, true);
-        addFunction(WORD_TOKENS, new IResultTypeComputer() {
-            @Override
-            public IAType computeType(ILogicalExpression expression, IVariableTypeEnvironment env,
-                    IMetadataProvider<?, ?> mp) throws AlgebricksException {
-                return new AOrderedListType(BuiltinType.ASTRING, "string");
-            }
-        }, true);
+        addFunction(WORD_TOKENS, OrderedListOfAStringTypeComputer.INSTANCE, true);
+
+        // records
+        addPrivateFunction(RECORD_MERGE, RecordMergeTypeComputer.INSTANCE, true);
+        addPrivateFunction(CLOSED_RECORD_CONSTRUCTOR, ClosedRecordConstructorResultType.INSTANCE, true);
+        addPrivateFunction(OPEN_RECORD_CONSTRUCTOR, OpenRecordConstructorResultType.INSTANCE, true);
+        addPrivateFunction(FIELD_ACCESS_BY_INDEX, FieldAccessByIndexResultType.INSTANCE, true);
+        addPrivateFunction(FIELD_ACCESS_NESTED, FieldAccessNestedResultType.INSTANCE, true);
+        addPrivateFunction(FIELD_ACCESS_BY_NAME, NonTaggedFieldAccessByNameResultType.INSTANCE, true);
+        addFunction(GET_RECORD_FIELDS, OrderedListOfAnyTypeComputer.INSTANCE, true);
+        addFunction(GET_RECORD_FIELD_VALUE, FieldAccessNestedResultType.INSTANCE, true);
 
         // temporal type accessors
         addFunction(ACCESSOR_TEMPORAL_YEAR, OptionalAInt64TypeComputer.INSTANCE, true);
@@ -1079,16 +1023,7 @@ public class AsterixBuiltinFunctions {
         addPrivateFunction(COLLECTION_TO_SEQUENCE, CollectionToSequenceTypeComputer.INSTANCE, true);
 
         // external lookup
-        addPrivateFunction(EXTERNAL_LOOKUP, new IResultTypeComputer() {
-
-            private static final long serialVersionUID = 1L;
-
-            @Override
-            public IAType computeType(ILogicalExpression expression, IVariableTypeEnvironment env,
-                    IMetadataProvider<?, ?> mp) throws AlgebricksException {
-                return BuiltinType.ANY;
-            }
-        }, false);
+        addPrivateFunction(EXTERNAL_LOOKUP, AnyTypeComputer.INSTANCE, false);
 
         String metadataFunctionLoaderClassName = "edu.uci.ics.asterix.metadata.functions.MetadataBuiltinFunctions";
         try {

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-om/src/main/java/edu/uci/ics/asterix/om/pointables/AListPointable.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/om/pointables/AListPointable.java b/asterix-om/src/main/java/edu/uci/ics/asterix/om/pointables/AListPointable.java
deleted file mode 100644
index 3c38cad..0000000
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/om/pointables/AListPointable.java
+++ /dev/null
@@ -1,181 +0,0 @@
-/*
- * Copyright 2009-2013 by The Regents of the University of California
- * Licensed 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 from
- *
- *     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.
- */
-
-package edu.uci.ics.asterix.om.pointables;
-
-import java.io.DataOutputStream;
-import java.util.ArrayList;
-import java.util.List;
-
-import edu.uci.ics.asterix.common.exceptions.AsterixException;
-import edu.uci.ics.asterix.dataflow.data.nontagged.serde.AInt32SerializerDeserializer;
-import edu.uci.ics.asterix.om.pointables.base.IVisitablePointable;
-import edu.uci.ics.asterix.om.pointables.visitor.IVisitablePointableVisitor;
-import edu.uci.ics.asterix.om.types.AOrderedListType;
-import edu.uci.ics.asterix.om.types.ATypeTag;
-import edu.uci.ics.asterix.om.types.AbstractCollectionType;
-import edu.uci.ics.asterix.om.types.EnumDeserializer;
-import edu.uci.ics.asterix.om.types.IAType;
-import edu.uci.ics.asterix.om.util.NonTaggedFormatUtil;
-import edu.uci.ics.asterix.om.util.ResettableByteArrayOutputStream;
-import edu.uci.ics.asterix.om.util.container.IObjectFactory;
-
-/**
- * This class interprets the binary data representation of a list, one can
- * call getItems and getItemTags to get pointable objects for items and item
- * type tags.
- */
-public class AListPointable extends AbstractVisitablePointable {
-
-    /**
-     * DO NOT allow to create AListPointable object arbitrarily, force to use
-     * object pool based allocator, in order to have object reuse.
-     */
-    static IObjectFactory<IVisitablePointable, IAType> FACTORY = new IObjectFactory<IVisitablePointable, IAType>() {
-        public IVisitablePointable create(IAType type) {
-            return new AListPointable((AbstractCollectionType) type);
-        }
-    };
-
-    private final List<IVisitablePointable> items = new ArrayList<IVisitablePointable>();
-    private final List<IVisitablePointable> itemTags = new ArrayList<IVisitablePointable>();
-    private final PointableAllocator allocator = new PointableAllocator();
-
-    private final ResettableByteArrayOutputStream dataBos = new ResettableByteArrayOutputStream();
-    private final DataOutputStream dataDos = new DataOutputStream(dataBos);
-
-    private IAType itemType;
-    private ATypeTag itemTag;
-    private boolean typedItemList = false;
-    private boolean ordered = false;
-
-    /**
-     * private constructor, to prevent constructing it arbitrarily
-     * 
-     * @param inputType
-     */
-    private AListPointable(AbstractCollectionType inputType) {
-        if (inputType instanceof AOrderedListType) {
-            ordered = true;
-        }
-        if (inputType != null && inputType.getItemType() != null) {
-            itemType = inputType.getItemType();
-            if (itemType.getTypeTag() == ATypeTag.ANY) {
-                typedItemList = false;
-            } else {
-                typedItemList = true;
-                itemTag = inputType.getItemType().getTypeTag();
-            }
-        } else {
-            this.typedItemList = false;
-        }
-    }
-
-    private void reset() {
-        allocator.reset();
-        items.clear();
-        itemTags.clear();
-        dataBos.reset();
-    }
-
-    @Override
-    public void set(byte[] b, int s, int len) {
-        reset();
-        super.set(b, s, len);
-
-        int numberOfitems = AInt32SerializerDeserializer.getInt(b, s + 6);
-        int itemOffset;
-        if (typedItemList) {
-            switch (itemTag) {
-                case STRING:
-                case BINARY:
-                case RECORD:
-                case ORDEREDLIST:
-                case UNORDEREDLIST:
-                case ANY:
-                    itemOffset = s + 10 + (numberOfitems * 4);
-                    break;
-                default:
-                    itemOffset = s + 10;
-            }
-        } else {
-            itemOffset = s + 10 + (numberOfitems * 4);
-        }
-        int itemLength = 0;
-        try {
-            if (typedItemList) {
-                for (int i = 0; i < numberOfitems; i++) {
-                    itemLength = NonTaggedFormatUtil.getFieldValueLength(b, itemOffset, itemTag, false);
-                    IVisitablePointable tag = allocator.allocateEmpty();
-                    IVisitablePointable item = allocator.allocateFieldValue(itemType);
-
-                    // set item type tag
-                    int start = dataBos.size();
-                    dataDos.writeByte(itemTag.serialize());
-                    int end = dataBos.size();
-                    tag.set(dataBos.getByteArray(), start, end - start);
-                    itemTags.add(tag);
-
-                    // set item value
-                    start = dataBos.size();
-                    dataDos.writeByte(itemTag.serialize());
-                    dataDos.write(b, itemOffset, itemLength);
-                    end = dataBos.size();
-                    item.set(dataBos.getByteArray(), start, end - start);
-                    itemOffset += itemLength;
-                    items.add(item);
-                }
-            } else {
-                for (int i = 0; i < numberOfitems; i++) {
-                    itemTag = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(b[itemOffset]);
-                    itemLength = NonTaggedFormatUtil.getFieldValueLength(b, itemOffset, itemTag, true) + 1;
-                    IVisitablePointable tag = allocator.allocateEmpty();
-                    IVisitablePointable item = allocator.allocateFieldValue(itemTag, b, itemOffset + 1);
-
-                    // set item type tag
-                    int start = dataBos.size();
-                    dataDos.writeByte(itemTag.serialize());
-                    int end = dataBos.size();
-                    tag.set(dataBos.getByteArray(), start, end - start);
-                    itemTags.add(tag);
-
-                    // open part field already include the type tag
-                    item.set(b, itemOffset, itemLength);
-                    itemOffset += itemLength;
-                    items.add(item);
-                }
-            }
-        } catch (Exception e) {
-            throw new IllegalStateException(e);
-        }
-    }
-
-    @Override
-    public <R, T> R accept(IVisitablePointableVisitor<R, T> vistor, T tag) throws AsterixException {
-        return vistor.visit(this, tag);
-    }
-
-    public List<IVisitablePointable> getItems() {
-        return items;
-    }
-
-    public List<IVisitablePointable> getItemTags() {
-        return itemTags;
-    }
-
-    public boolean ordered() {
-        return ordered;
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-om/src/main/java/edu/uci/ics/asterix/om/pointables/AListVisitablePointable.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/om/pointables/AListVisitablePointable.java b/asterix-om/src/main/java/edu/uci/ics/asterix/om/pointables/AListVisitablePointable.java
new file mode 100644
index 0000000..efa698f
--- /dev/null
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/om/pointables/AListVisitablePointable.java
@@ -0,0 +1,181 @@
+/*
+ * Copyright 2009-2013 by The Regents of the University of California
+ * Licensed 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 from
+ *
+ *     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.
+ */
+
+package edu.uci.ics.asterix.om.pointables;
+
+import java.io.DataOutputStream;
+import java.util.ArrayList;
+import java.util.List;
+
+import edu.uci.ics.asterix.common.exceptions.AsterixException;
+import edu.uci.ics.asterix.dataflow.data.nontagged.serde.AInt32SerializerDeserializer;
+import edu.uci.ics.asterix.om.pointables.base.IVisitablePointable;
+import edu.uci.ics.asterix.om.pointables.visitor.IVisitablePointableVisitor;
+import edu.uci.ics.asterix.om.types.AOrderedListType;
+import edu.uci.ics.asterix.om.types.ATypeTag;
+import edu.uci.ics.asterix.om.types.AbstractCollectionType;
+import edu.uci.ics.asterix.om.types.EnumDeserializer;
+import edu.uci.ics.asterix.om.types.IAType;
+import edu.uci.ics.asterix.om.util.NonTaggedFormatUtil;
+import edu.uci.ics.asterix.om.util.ResettableByteArrayOutputStream;
+import edu.uci.ics.asterix.om.util.container.IObjectFactory;
+
+/**
+ * This class interprets the binary data representation of a list, one can
+ * call getItems and getItemTags to get pointable objects for items and item
+ * type tags.
+ */
+public class AListVisitablePointable extends AbstractVisitablePointable {
+
+    /**
+     * DO NOT allow to create AListPointable object arbitrarily, force to use
+     * object pool based allocator, in order to have object reuse.
+     */
+    static IObjectFactory<IVisitablePointable, IAType> FACTORY = new IObjectFactory<IVisitablePointable, IAType>() {
+        public IVisitablePointable create(IAType type) {
+            return new AListVisitablePointable((AbstractCollectionType) type);
+        }
+    };
+
+    private final List<IVisitablePointable> items = new ArrayList<IVisitablePointable>();
+    private final List<IVisitablePointable> itemTags = new ArrayList<IVisitablePointable>();
+    private final PointableAllocator allocator = new PointableAllocator();
+
+    private final ResettableByteArrayOutputStream dataBos = new ResettableByteArrayOutputStream();
+    private final DataOutputStream dataDos = new DataOutputStream(dataBos);
+
+    private IAType itemType;
+    private ATypeTag itemTag;
+    private boolean typedItemList = false;
+    private boolean ordered = false;
+
+    /**
+     * private constructor, to prevent constructing it arbitrarily
+     * 
+     * @param inputType
+     */
+    public AListVisitablePointable(AbstractCollectionType inputType) {
+        if (inputType instanceof AOrderedListType) {
+            ordered = true;
+        }
+        if (inputType != null && inputType.getItemType() != null) {
+            itemType = inputType.getItemType();
+            if (itemType.getTypeTag() == ATypeTag.ANY) {
+                typedItemList = false;
+            } else {
+                typedItemList = true;
+                itemTag = inputType.getItemType().getTypeTag();
+            }
+        } else {
+            this.typedItemList = false;
+        }
+    }
+
+    private void reset() {
+        allocator.reset();
+        items.clear();
+        itemTags.clear();
+        dataBos.reset();
+    }
+
+    @Override
+    public void set(byte[] b, int s, int len) {
+        reset();
+        super.set(b, s, len);
+
+        int numberOfitems = AInt32SerializerDeserializer.getInt(b, s + 6);
+        int itemOffset;
+        if (typedItemList) {
+            switch (itemTag) {
+                case STRING:
+                case BINARY:
+                case RECORD:
+                case ORDEREDLIST:
+                case UNORDEREDLIST:
+                case ANY:
+                    itemOffset = s + 10 + (numberOfitems * 4);
+                    break;
+                default:
+                    itemOffset = s + 10;
+            }
+        } else {
+            itemOffset = s + 10 + (numberOfitems * 4);
+        }
+        int itemLength = 0;
+        try {
+            if (typedItemList) {
+                for (int i = 0; i < numberOfitems; i++) {
+                    itemLength = NonTaggedFormatUtil.getFieldValueLength(b, itemOffset, itemTag, false);
+                    IVisitablePointable tag = allocator.allocateEmpty();
+                    IVisitablePointable item = allocator.allocateFieldValue(itemType);
+
+                    // set item type tag
+                    int start = dataBos.size();
+                    dataDos.writeByte(itemTag.serialize());
+                    int end = dataBos.size();
+                    tag.set(dataBos.getByteArray(), start, end - start);
+                    itemTags.add(tag);
+
+                    // set item value
+                    start = dataBos.size();
+                    dataDos.writeByte(itemTag.serialize());
+                    dataDos.write(b, itemOffset, itemLength);
+                    end = dataBos.size();
+                    item.set(dataBos.getByteArray(), start, end - start);
+                    itemOffset += itemLength;
+                    items.add(item);
+                }
+            } else {
+                for (int i = 0; i < numberOfitems; i++) {
+                    itemTag = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(b[itemOffset]);
+                    itemLength = NonTaggedFormatUtil.getFieldValueLength(b, itemOffset, itemTag, true) + 1;
+                    IVisitablePointable tag = allocator.allocateEmpty();
+                    IVisitablePointable item = allocator.allocateFieldValue(itemTag, b, itemOffset + 1);
+
+                    // set item type tag
+                    int start = dataBos.size();
+                    dataDos.writeByte(itemTag.serialize());
+                    int end = dataBos.size();
+                    tag.set(dataBos.getByteArray(), start, end - start);
+                    itemTags.add(tag);
+
+                    // open part field already include the type tag
+                    item.set(b, itemOffset, itemLength);
+                    itemOffset += itemLength;
+                    items.add(item);
+                }
+            }
+        } catch (Exception e) {
+            throw new IllegalStateException(e);
+        }
+    }
+
+    @Override
+    public <R, T> R accept(IVisitablePointableVisitor<R, T> vistor, T tag) throws AsterixException {
+        return vistor.visit(this, tag);
+    }
+
+    public List<IVisitablePointable> getItems() {
+        return items;
+    }
+
+    public List<IVisitablePointable> getItemTags() {
+        return itemTags;
+    }
+
+    public boolean ordered() {
+        return ordered;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-om/src/main/java/edu/uci/ics/asterix/om/pointables/ARecordPointable.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/om/pointables/ARecordPointable.java b/asterix-om/src/main/java/edu/uci/ics/asterix/om/pointables/ARecordPointable.java
deleted file mode 100644
index 68f0854..0000000
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/om/pointables/ARecordPointable.java
+++ /dev/null
@@ -1,288 +0,0 @@
-/*
- * Copyright 2009-2013 by The Regents of the University of California
- * Licensed 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 from
- *
- *     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.
- */
-
-package edu.uci.ics.asterix.om.pointables;
-
-import java.io.DataOutputStream;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-
-import edu.uci.ics.asterix.common.exceptions.AsterixException;
-import edu.uci.ics.asterix.dataflow.data.nontagged.AqlNullWriterFactory;
-import edu.uci.ics.asterix.dataflow.data.nontagged.serde.AInt32SerializerDeserializer;
-import edu.uci.ics.asterix.om.pointables.base.IVisitablePointable;
-import edu.uci.ics.asterix.om.pointables.visitor.IVisitablePointableVisitor;
-import edu.uci.ics.asterix.om.types.ARecordType;
-import edu.uci.ics.asterix.om.types.ATypeTag;
-import edu.uci.ics.asterix.om.types.AUnionType;
-import edu.uci.ics.asterix.om.types.EnumDeserializer;
-import edu.uci.ics.asterix.om.types.IAType;
-import edu.uci.ics.asterix.om.util.NonTaggedFormatUtil;
-import edu.uci.ics.asterix.om.util.ResettableByteArrayOutputStream;
-import edu.uci.ics.asterix.om.util.container.IObjectFactory;
-import edu.uci.ics.hyracks.api.dataflow.value.INullWriter;
-
-/**
- * This class interprets the binary data representation of a record. One can
- * call getFieldNames, getFieldTypeTags and getFieldValues to get pointable
- * objects for field names, field type tags, and field values.
- */
-public class ARecordPointable extends AbstractVisitablePointable {
-
-    /**
-     * DO NOT allow to create ARecordPointable object arbitrarily, force to use
-     * object pool based allocator, in order to have object reuse
-     */
-    static IObjectFactory<IVisitablePointable, IAType> FACTORY = new IObjectFactory<IVisitablePointable, IAType>() {
-        public IVisitablePointable create(IAType type) {
-            return new ARecordPointable((ARecordType) type);
-        }
-    };
-
-    // access results: field names, field types, and field values
-    private final List<IVisitablePointable> fieldNames = new ArrayList<IVisitablePointable>();
-    private final List<IVisitablePointable> fieldTypeTags = new ArrayList<IVisitablePointable>();
-    private final List<IVisitablePointable> fieldValues = new ArrayList<IVisitablePointable>();
-
-    // pointable allocator
-    private final PointableAllocator allocator = new PointableAllocator();
-
-    private final ResettableByteArrayOutputStream typeBos = new ResettableByteArrayOutputStream();
-    private final DataOutputStream typeDos = new DataOutputStream(typeBos);
-
-    private final ResettableByteArrayOutputStream dataBos = new ResettableByteArrayOutputStream();
-    private final DataOutputStream dataDos = new DataOutputStream(dataBos);
-
-    private final ARecordType inputRecType;
-
-    private final int numberOfSchemaFields;
-    private final int[] fieldOffsets;
-    private final IVisitablePointable nullReference = AFlatValuePointable.FACTORY.create(null);
-
-    private int closedPartTypeInfoSize = 0;
-    private int offsetArrayOffset;
-    private ATypeTag typeTag;
-
-    /**
-     * private constructor, to prevent constructing it arbitrarily
-     * 
-     * @param inputType
-     */
-    private ARecordPointable(ARecordType inputType) {
-        this.inputRecType = inputType;
-        IAType[] fieldTypes = inputType.getFieldTypes();
-        String[] fieldNameStrs = inputType.getFieldNames();
-        numberOfSchemaFields = fieldTypes.length;
-
-        // initialize the buffer for closed parts(fieldName bytes+ type bytes) +
-        // constant(null bytes)
-        typeBos.reset();
-        try {
-            for (int i = 0; i < numberOfSchemaFields; i++) {
-                ATypeTag ftypeTag = fieldTypes[i].getTypeTag();
-
-                if (fieldTypes[i].getTypeTag() == ATypeTag.UNION
-                        && NonTaggedFormatUtil.isOptionalField((AUnionType) fieldTypes[i]))
-                    // optional field: add the embedded non-null type tag
-                    ftypeTag = ((AUnionType) fieldTypes[i]).getUnionList()
-                            .get(AUnionType.OPTIONAL_TYPE_INDEX_IN_UNION_LIST).getTypeTag();
-
-                // add type tag Reference
-                int tagStart = typeBos.size();
-                typeDos.writeByte(ftypeTag.serialize());
-                int tagEnd = typeBos.size();
-                IVisitablePointable typeTagReference = AFlatValuePointable.FACTORY.create(null);
-                typeTagReference.set(typeBos.getByteArray(), tagStart, tagEnd - tagStart);
-                fieldTypeTags.add(typeTagReference);
-
-                // add type name Reference (including a astring type tag)
-                int nameStart = typeBos.size();
-                typeDos.writeByte(ATypeTag.STRING.serialize());
-                typeDos.writeUTF(fieldNameStrs[i]);
-                int nameEnd = typeBos.size();
-                IVisitablePointable typeNameReference = AFlatValuePointable.FACTORY.create(null);
-                typeNameReference.set(typeBos.getByteArray(), nameStart, nameEnd - nameStart);
-                fieldNames.add(typeNameReference);
-            }
-
-            // initialize a constant: null value bytes reference
-            int nullFieldStart = typeBos.size();
-            INullWriter nullWriter = AqlNullWriterFactory.INSTANCE.createNullWriter();
-            nullWriter.writeNull(typeDos);
-            int nullFieldEnd = typeBos.size();
-            nullReference.set(typeBos.getByteArray(), nullFieldStart, nullFieldEnd - nullFieldStart);
-        } catch (IOException e) {
-            throw new IllegalStateException(e);
-        }
-        closedPartTypeInfoSize = typeBos.size();
-        fieldOffsets = new int[numberOfSchemaFields];
-    }
-
-    private void reset() {
-        typeBos.reset(closedPartTypeInfoSize);
-        dataBos.reset(0);
-        // reset the allocator
-        allocator.reset();
-
-        // clean up the returned containers
-        for (int i = fieldNames.size() - 1; i >= numberOfSchemaFields; i--)
-            fieldNames.remove(i);
-        for (int i = fieldTypeTags.size() - 1; i >= numberOfSchemaFields; i--)
-            fieldTypeTags.remove(i);
-        fieldValues.clear();
-    }
-
-    @Override
-    public void set(byte[] b, int start, int len) {
-        // clear the previous states
-        reset();
-        super.set(b, start, len);
-
-        boolean isExpanded = false;
-        int openPartOffset = 0;
-        int s = start;
-        int recordOffset = s;
-        if (inputRecType == null) {
-            openPartOffset = s + AInt32SerializerDeserializer.getInt(b, s + 6);
-            s += 8;
-            isExpanded = true;
-        } else {
-            if (inputRecType.isOpen()) {
-                isExpanded = b[s + 5] == 1 ? true : false;
-                if (isExpanded) {
-                    openPartOffset = s + AInt32SerializerDeserializer.getInt(b, s + 6);
-                    s += 10;
-                } else {
-                    s += 6;
-                }
-            } else {
-                s += 5;
-            }
-        }
-        try {
-            if (numberOfSchemaFields > 0) {
-                s += 4;
-                int nullBitMapOffset = 0;
-                boolean hasNullableFields = NonTaggedFormatUtil.hasNullableField(inputRecType);
-                if (hasNullableFields) {
-                    nullBitMapOffset = s;
-                    offsetArrayOffset = s
-                            + (this.numberOfSchemaFields % 8 == 0 ? numberOfSchemaFields / 8
-                                    : numberOfSchemaFields / 8 + 1);
-                } else {
-                    offsetArrayOffset = s;
-                }
-                for (int i = 0; i < numberOfSchemaFields; i++) {
-                    fieldOffsets[i] = AInt32SerializerDeserializer.getInt(b, offsetArrayOffset) + recordOffset;
-                    offsetArrayOffset += 4;
-                }
-                for (int fieldNumber = 0; fieldNumber < numberOfSchemaFields; fieldNumber++) {
-                    if (hasNullableFields) {
-                        byte b1 = b[nullBitMapOffset + fieldNumber / 8];
-                        int p = 1 << (7 - (fieldNumber % 8));
-                        if ((b1 & p) == 0) {
-                            // set null value (including type tag inside)
-                            fieldValues.add(nullReference);
-                            continue;
-                        }
-                    }
-                    IAType[] fieldTypes = inputRecType.getFieldTypes();
-                    int fieldValueLength = 0;
-
-                    IAType fieldType = fieldTypes[fieldNumber];
-                    if (fieldTypes[fieldNumber].getTypeTag() == ATypeTag.UNION) {
-                        if (NonTaggedFormatUtil.isOptionalField((AUnionType) fieldTypes[fieldNumber])) {
-                            fieldType = ((AUnionType) fieldTypes[fieldNumber]).getUnionList().get(
-                                    AUnionType.OPTIONAL_TYPE_INDEX_IN_UNION_LIST);
-                            typeTag = fieldType.getTypeTag();
-                            fieldValueLength = NonTaggedFormatUtil.getFieldValueLength(b, fieldOffsets[fieldNumber],
-                                    typeTag, false);
-                        }
-                    } else {
-                        typeTag = fieldTypes[fieldNumber].getTypeTag();
-                        fieldValueLength = NonTaggedFormatUtil.getFieldValueLength(b, fieldOffsets[fieldNumber],
-                                typeTag, false);
-                    }
-                    // set field value (including the type tag)
-                    int fstart = dataBos.size();
-                    dataDos.writeByte(typeTag.serialize());
-                    dataDos.write(b, fieldOffsets[fieldNumber], fieldValueLength);
-                    int fend = dataBos.size();
-                    IVisitablePointable fieldValue = allocator.allocateFieldValue(fieldType);
-                    fieldValue.set(dataBos.getByteArray(), fstart, fend - fstart);
-                    fieldValues.add(fieldValue);
-                }
-            }
-            if (isExpanded) {
-                int numberOfOpenFields = AInt32SerializerDeserializer.getInt(b, openPartOffset);
-                int fieldOffset = openPartOffset + 4 + (8 * numberOfOpenFields);
-                for (int i = 0; i < numberOfOpenFields; i++) {
-                    // set the field name (including a type tag, which is
-                    // astring)
-                    int fieldValueLength = NonTaggedFormatUtil.getFieldValueLength(b, fieldOffset, ATypeTag.STRING,
-                            false);
-                    int fnstart = dataBos.size();
-                    dataDos.writeByte(ATypeTag.STRING.serialize());
-                    dataDos.write(b, fieldOffset, fieldValueLength);
-                    int fnend = dataBos.size();
-                    IVisitablePointable fieldName = allocator.allocateEmpty();
-                    fieldName.set(dataBos.getByteArray(), fnstart, fnend - fnstart);
-                    fieldNames.add(fieldName);
-                    fieldOffset += fieldValueLength;
-
-                    // set the field type tag
-                    IVisitablePointable fieldTypeTag = allocator.allocateEmpty();
-                    fieldTypeTag.set(b, fieldOffset, 1);
-                    fieldTypeTags.add(fieldTypeTag);
-                    typeTag = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(b[fieldOffset]);
-
-                    // set the field value (already including type tag)
-                    fieldValueLength = NonTaggedFormatUtil.getFieldValueLength(b, fieldOffset, typeTag, true) + 1;
-
-                    // allocate
-                    IVisitablePointable fieldValueAccessor = allocator.allocateFieldValue(typeTag, b, fieldOffset + 1);
-                    fieldValueAccessor.set(b, fieldOffset, fieldValueLength);
-                    fieldValues.add(fieldValueAccessor);
-                    fieldOffset += fieldValueLength;
-                }
-            }
-        } catch (Exception e) {
-            throw new IllegalStateException(e);
-        }
-    }
-
-    public List<IVisitablePointable> getFieldNames() {
-        return fieldNames;
-    }
-
-    public List<IVisitablePointable> getFieldTypeTags() {
-        return fieldTypeTags;
-    }
-
-    public List<IVisitablePointable> getFieldValues() {
-        return fieldValues;
-    }
-    
-    public ARecordType getInputRecordType(){
-        return inputRecType;
-    }
-
-    @Override
-    public <R, T> R accept(IVisitablePointableVisitor<R, T> vistor, T tag) throws AsterixException {
-        return vistor.visit(this, tag);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-om/src/main/java/edu/uci/ics/asterix/om/pointables/ARecordVisitablePointable.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/om/pointables/ARecordVisitablePointable.java b/asterix-om/src/main/java/edu/uci/ics/asterix/om/pointables/ARecordVisitablePointable.java
new file mode 100644
index 0000000..9ea28d7
--- /dev/null
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/om/pointables/ARecordVisitablePointable.java
@@ -0,0 +1,288 @@
+/*
+ * Copyright 2009-2013 by The Regents of the University of California
+ * Licensed 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 from
+ *
+ *     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.
+ */
+
+package edu.uci.ics.asterix.om.pointables;
+
+import java.io.DataOutputStream;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+import edu.uci.ics.asterix.common.exceptions.AsterixException;
+import edu.uci.ics.asterix.dataflow.data.nontagged.AqlNullWriterFactory;
+import edu.uci.ics.asterix.dataflow.data.nontagged.serde.AInt32SerializerDeserializer;
+import edu.uci.ics.asterix.om.pointables.base.IVisitablePointable;
+import edu.uci.ics.asterix.om.pointables.visitor.IVisitablePointableVisitor;
+import edu.uci.ics.asterix.om.types.ARecordType;
+import edu.uci.ics.asterix.om.types.ATypeTag;
+import edu.uci.ics.asterix.om.types.AUnionType;
+import edu.uci.ics.asterix.om.types.EnumDeserializer;
+import edu.uci.ics.asterix.om.types.IAType;
+import edu.uci.ics.asterix.om.util.NonTaggedFormatUtil;
+import edu.uci.ics.asterix.om.util.ResettableByteArrayOutputStream;
+import edu.uci.ics.asterix.om.util.container.IObjectFactory;
+import edu.uci.ics.hyracks.api.dataflow.value.INullWriter;
+
+/**
+ * This class interprets the binary data representation of a record. One can
+ * call getFieldNames, getFieldTypeTags and getFieldValues to get pointable
+ * objects for field names, field type tags, and field values.
+ */
+public class ARecordVisitablePointable extends AbstractVisitablePointable {
+
+    /**
+     * DO NOT allow to create ARecordPointable object arbitrarily, force to use
+     * object pool based allocator, in order to have object reuse
+     */
+    static IObjectFactory<IVisitablePointable, IAType> FACTORY = new IObjectFactory<IVisitablePointable, IAType>() {
+        public IVisitablePointable create(IAType type) {
+            return new ARecordVisitablePointable((ARecordType) type);
+        }
+    };
+
+    // access results: field names, field types, and field values
+    private final List<IVisitablePointable> fieldNames = new ArrayList<IVisitablePointable>();
+    private final List<IVisitablePointable> fieldTypeTags = new ArrayList<IVisitablePointable>();
+    private final List<IVisitablePointable> fieldValues = new ArrayList<IVisitablePointable>();
+
+    // pointable allocator
+    private final PointableAllocator allocator = new PointableAllocator();
+
+    private final ResettableByteArrayOutputStream typeBos = new ResettableByteArrayOutputStream();
+    private final DataOutputStream typeDos = new DataOutputStream(typeBos);
+
+    private final ResettableByteArrayOutputStream dataBos = new ResettableByteArrayOutputStream();
+    private final DataOutputStream dataDos = new DataOutputStream(dataBos);
+
+    private final ARecordType inputRecType;
+
+    private final int numberOfSchemaFields;
+    private final int[] fieldOffsets;
+    private final IVisitablePointable nullReference = AFlatValuePointable.FACTORY.create(null);
+
+    private int closedPartTypeInfoSize = 0;
+    private int offsetArrayOffset;
+    private ATypeTag typeTag;
+
+    /**
+     * private constructor, to prevent constructing it arbitrarily
+     * 
+     * @param inputType
+     */
+    public ARecordVisitablePointable(ARecordType inputType) {
+        this.inputRecType = inputType;
+        IAType[] fieldTypes = inputType.getFieldTypes();
+        String[] fieldNameStrs = inputType.getFieldNames();
+        numberOfSchemaFields = fieldTypes.length;
+
+        // initialize the buffer for closed parts(fieldName bytes+ type bytes) +
+        // constant(null bytes)
+        typeBos.reset();
+        try {
+            for (int i = 0; i < numberOfSchemaFields; i++) {
+                ATypeTag ftypeTag = fieldTypes[i].getTypeTag();
+
+                if (fieldTypes[i].getTypeTag() == ATypeTag.UNION
+                        && NonTaggedFormatUtil.isOptionalField((AUnionType) fieldTypes[i]))
+                    // optional field: add the embedded non-null type tag
+                    ftypeTag = ((AUnionType) fieldTypes[i]).getUnionList()
+                            .get(AUnionType.OPTIONAL_TYPE_INDEX_IN_UNION_LIST).getTypeTag();
+
+                // add type tag Reference
+                int tagStart = typeBos.size();
+                typeDos.writeByte(ftypeTag.serialize());
+                int tagEnd = typeBos.size();
+                IVisitablePointable typeTagReference = AFlatValuePointable.FACTORY.create(null);
+                typeTagReference.set(typeBos.getByteArray(), tagStart, tagEnd - tagStart);
+                fieldTypeTags.add(typeTagReference);
+
+                // add type name Reference (including a astring type tag)
+                int nameStart = typeBos.size();
+                typeDos.writeByte(ATypeTag.STRING.serialize());
+                typeDos.writeUTF(fieldNameStrs[i]);
+                int nameEnd = typeBos.size();
+                IVisitablePointable typeNameReference = AFlatValuePointable.FACTORY.create(null);
+                typeNameReference.set(typeBos.getByteArray(), nameStart, nameEnd - nameStart);
+                fieldNames.add(typeNameReference);
+            }
+
+            // initialize a constant: null value bytes reference
+            int nullFieldStart = typeBos.size();
+            INullWriter nullWriter = AqlNullWriterFactory.INSTANCE.createNullWriter();
+            nullWriter.writeNull(typeDos);
+            int nullFieldEnd = typeBos.size();
+            nullReference.set(typeBos.getByteArray(), nullFieldStart, nullFieldEnd - nullFieldStart);
+        } catch (IOException e) {
+            throw new IllegalStateException(e);
+        }
+        closedPartTypeInfoSize = typeBos.size();
+        fieldOffsets = new int[numberOfSchemaFields];
+    }
+
+    private void reset() {
+        typeBos.reset(closedPartTypeInfoSize);
+        dataBos.reset(0);
+        // reset the allocator
+        allocator.reset();
+
+        // clean up the returned containers
+        for (int i = fieldNames.size() - 1; i >= numberOfSchemaFields; i--)
+            fieldNames.remove(i);
+        for (int i = fieldTypeTags.size() - 1; i >= numberOfSchemaFields; i--)
+            fieldTypeTags.remove(i);
+        fieldValues.clear();
+    }
+
+    @Override
+    public void set(byte[] b, int start, int len) {
+        // clear the previous states
+        reset();
+        super.set(b, start, len);
+
+        boolean isExpanded = false;
+        int openPartOffset = 0;
+        int s = start;
+        int recordOffset = s;
+        if (inputRecType == null) {
+            openPartOffset = s + AInt32SerializerDeserializer.getInt(b, s + 6);
+            s += 8;
+            isExpanded = true;
+        } else {
+            if (inputRecType.isOpen()) {
+                isExpanded = b[s + 5] == 1 ? true : false;
+                if (isExpanded) {
+                    openPartOffset = s + AInt32SerializerDeserializer.getInt(b, s + 6);
+                    s += 10;
+                } else {
+                    s += 6;
+                }
+            } else {
+                s += 5;
+            }
+        }
+        try {
+            if (numberOfSchemaFields > 0) {
+                s += 4;
+                int nullBitMapOffset = 0;
+                boolean hasNullableFields = NonTaggedFormatUtil.hasNullableField(inputRecType);
+                if (hasNullableFields) {
+                    nullBitMapOffset = s;
+                    offsetArrayOffset = s
+                            + (this.numberOfSchemaFields % 8 == 0 ? numberOfSchemaFields / 8
+                                    : numberOfSchemaFields / 8 + 1);
+                } else {
+                    offsetArrayOffset = s;
+                }
+                for (int i = 0; i < numberOfSchemaFields; i++) {
+                    fieldOffsets[i] = AInt32SerializerDeserializer.getInt(b, offsetArrayOffset) + recordOffset;
+                    offsetArrayOffset += 4;
+                }
+                for (int fieldNumber = 0; fieldNumber < numberOfSchemaFields; fieldNumber++) {
+                    if (hasNullableFields) {
+                        byte b1 = b[nullBitMapOffset + fieldNumber / 8];
+                        int p = 1 << (7 - (fieldNumber % 8));
+                        if ((b1 & p) == 0) {
+                            // set null value (including type tag inside)
+                            fieldValues.add(nullReference);
+                            continue;
+                        }
+                    }
+                    IAType[] fieldTypes = inputRecType.getFieldTypes();
+                    int fieldValueLength = 0;
+
+                    IAType fieldType = fieldTypes[fieldNumber];
+                    if (fieldTypes[fieldNumber].getTypeTag() == ATypeTag.UNION) {
+                        if (NonTaggedFormatUtil.isOptionalField((AUnionType) fieldTypes[fieldNumber])) {
+                            fieldType = ((AUnionType) fieldTypes[fieldNumber]).getUnionList().get(
+                                    AUnionType.OPTIONAL_TYPE_INDEX_IN_UNION_LIST);
+                            typeTag = fieldType.getTypeTag();
+                            fieldValueLength = NonTaggedFormatUtil.getFieldValueLength(b, fieldOffsets[fieldNumber],
+                                    typeTag, false);
+                        }
+                    } else {
+                        typeTag = fieldTypes[fieldNumber].getTypeTag();
+                        fieldValueLength = NonTaggedFormatUtil.getFieldValueLength(b, fieldOffsets[fieldNumber],
+                                typeTag, false);
+                    }
+                    // set field value (including the type tag)
+                    int fstart = dataBos.size();
+                    dataDos.writeByte(typeTag.serialize());
+                    dataDos.write(b, fieldOffsets[fieldNumber], fieldValueLength);
+                    int fend = dataBos.size();
+                    IVisitablePointable fieldValue = allocator.allocateFieldValue(fieldType);
+                    fieldValue.set(dataBos.getByteArray(), fstart, fend - fstart);
+                    fieldValues.add(fieldValue);
+                }
+            }
+            if (isExpanded) {
+                int numberOfOpenFields = AInt32SerializerDeserializer.getInt(b, openPartOffset);
+                int fieldOffset = openPartOffset + 4 + (8 * numberOfOpenFields);
+                for (int i = 0; i < numberOfOpenFields; i++) {
+                    // set the field name (including a type tag, which is
+                    // astring)
+                    int fieldValueLength = NonTaggedFormatUtil.getFieldValueLength(b, fieldOffset, ATypeTag.STRING,
+                            false);
+                    int fnstart = dataBos.size();
+                    dataDos.writeByte(ATypeTag.STRING.serialize());
+                    dataDos.write(b, fieldOffset, fieldValueLength);
+                    int fnend = dataBos.size();
+                    IVisitablePointable fieldName = allocator.allocateEmpty();
+                    fieldName.set(dataBos.getByteArray(), fnstart, fnend - fnstart);
+                    fieldNames.add(fieldName);
+                    fieldOffset += fieldValueLength;
+
+                    // set the field type tag
+                    IVisitablePointable fieldTypeTag = allocator.allocateEmpty();
+                    fieldTypeTag.set(b, fieldOffset, 1);
+                    fieldTypeTags.add(fieldTypeTag);
+                    typeTag = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(b[fieldOffset]);
+
+                    // set the field value (already including type tag)
+                    fieldValueLength = NonTaggedFormatUtil.getFieldValueLength(b, fieldOffset, typeTag, true) + 1;
+
+                    // allocate
+                    IVisitablePointable fieldValueAccessor = allocator.allocateFieldValue(typeTag, b, fieldOffset + 1);
+                    fieldValueAccessor.set(b, fieldOffset, fieldValueLength);
+                    fieldValues.add(fieldValueAccessor);
+                    fieldOffset += fieldValueLength;
+                }
+            }
+        } catch (Exception e) {
+            throw new IllegalStateException(e);
+        }
+    }
+
+    public List<IVisitablePointable> getFieldNames() {
+        return fieldNames;
+    }
+
+    public List<IVisitablePointable> getFieldTypeTags() {
+        return fieldTypeTags;
+    }
+
+    public List<IVisitablePointable> getFieldValues() {
+        return fieldValues;
+    }
+
+    public ARecordType getInputRecordType() {
+        return inputRecType;
+    }
+    
+    @Override
+    public <R, T> R accept(IVisitablePointableVisitor<R, T> vistor, T tag) throws AsterixException {
+        return vistor.visit(this, tag);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-om/src/main/java/edu/uci/ics/asterix/om/pointables/PointableAllocator.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/om/pointables/PointableAllocator.java b/asterix-om/src/main/java/edu/uci/ics/asterix/om/pointables/PointableAllocator.java
index bbea453..b616b59 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/om/pointables/PointableAllocator.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/om/pointables/PointableAllocator.java
@@ -36,9 +36,9 @@ public class PointableAllocator {
     private IObjectPool<IVisitablePointable, IAType> flatValueAllocator = new ListObjectPool<IVisitablePointable, IAType>(
             AFlatValuePointable.FACTORY);
     private IObjectPool<IVisitablePointable, IAType> recordValueAllocator = new ListObjectPool<IVisitablePointable, IAType>(
-            ARecordPointable.FACTORY);
+            ARecordVisitablePointable.FACTORY);
     private IObjectPool<IVisitablePointable, IAType> listValueAllocator = new ListObjectPool<IVisitablePointable, IAType>(
-            AListPointable.FACTORY);
+            AListVisitablePointable.FACTORY);
     private IObjectPool<AOrderedListType, IAType> orederedListTypeAllocator = new ListObjectPool<AOrderedListType, IAType>(
             new IObjectFactory<AOrderedListType, IAType>() {
                 @Override

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-om/src/main/java/edu/uci/ics/asterix/om/pointables/cast/ACastVisitor.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/om/pointables/cast/ACastVisitor.java b/asterix-om/src/main/java/edu/uci/ics/asterix/om/pointables/cast/ACastVisitor.java
index 7626b88..06e44ba 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/om/pointables/cast/ACastVisitor.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/om/pointables/cast/ACastVisitor.java
@@ -22,8 +22,8 @@ import java.util.Map;
 
 import edu.uci.ics.asterix.common.exceptions.AsterixException;
 import edu.uci.ics.asterix.om.pointables.AFlatValuePointable;
-import edu.uci.ics.asterix.om.pointables.AListPointable;
-import edu.uci.ics.asterix.om.pointables.ARecordPointable;
+import edu.uci.ics.asterix.om.pointables.AListVisitablePointable;
+import edu.uci.ics.asterix.om.pointables.ARecordVisitablePointable;
 import edu.uci.ics.asterix.om.pointables.base.DefaultOpenFieldType;
 import edu.uci.ics.asterix.om.pointables.base.IVisitablePointable;
 import edu.uci.ics.asterix.om.pointables.visitor.IVisitablePointableVisitor;
@@ -54,7 +54,7 @@ public class ACastVisitor implements IVisitablePointableVisitor<Void, Triple<IVi
     private final Map<IVisitablePointable, AListCaster> laccessorToCaster = new HashMap<IVisitablePointable, AListCaster>();
 
     @Override
-    public Void visit(AListPointable accessor, Triple<IVisitablePointable, IAType, Boolean> arg)
+    public Void visit(AListVisitablePointable accessor, Triple<IVisitablePointable, IAType, Boolean> arg)
             throws AsterixException {
         AListCaster caster = laccessorToCaster.get(accessor);
         if (caster == null) {
@@ -73,7 +73,7 @@ public class ACastVisitor implements IVisitablePointableVisitor<Void, Triple<IVi
     }
 
     @Override
-    public Void visit(ARecordPointable accessor, Triple<IVisitablePointable, IAType, Boolean> arg)
+    public Void visit(ARecordVisitablePointable accessor, Triple<IVisitablePointable, IAType, Boolean> arg)
             throws AsterixException {
         ARecordCaster caster = raccessorToCaster.get(accessor);
         if (caster == null) {

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-om/src/main/java/edu/uci/ics/asterix/om/pointables/cast/AListCaster.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/om/pointables/cast/AListCaster.java b/asterix-om/src/main/java/edu/uci/ics/asterix/om/pointables/cast/AListCaster.java
index 5fdd438..afc3305 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/om/pointables/cast/AListCaster.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/om/pointables/cast/AListCaster.java
@@ -23,7 +23,7 @@ import java.util.List;
 import edu.uci.ics.asterix.builders.OrderedListBuilder;
 import edu.uci.ics.asterix.builders.UnorderedListBuilder;
 import edu.uci.ics.asterix.common.exceptions.AsterixException;
-import edu.uci.ics.asterix.om.pointables.AListPointable;
+import edu.uci.ics.asterix.om.pointables.AListVisitablePointable;
 import edu.uci.ics.asterix.om.pointables.PointableAllocator;
 import edu.uci.ics.asterix.om.pointables.base.DefaultOpenFieldType;
 import edu.uci.ics.asterix.om.pointables.base.IVisitablePointable;
@@ -60,7 +60,7 @@ class AListCaster {
 
     }
 
-    public void castList(AListPointable listAccessor, IVisitablePointable resultAccessor,
+    public void castList(AListVisitablePointable listAccessor, IVisitablePointable resultAccessor,
             AbstractCollectionType reqType, ACastVisitor visitor) throws IOException, AsterixException {
         if (reqType.getTypeTag().equals(ATypeTag.UNORDEREDLIST)) {
             unOrderedListBuilder.reset((AUnorderedListType) reqType);

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-om/src/main/java/edu/uci/ics/asterix/om/pointables/cast/ARecordCaster.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/om/pointables/cast/ARecordCaster.java b/asterix-om/src/main/java/edu/uci/ics/asterix/om/pointables/cast/ARecordCaster.java
index 988df90..8f3a219 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/om/pointables/cast/ARecordCaster.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/om/pointables/cast/ARecordCaster.java
@@ -27,7 +27,7 @@ import edu.uci.ics.asterix.builders.RecordBuilder;
 import edu.uci.ics.asterix.common.exceptions.AsterixException;
 import edu.uci.ics.asterix.common.exceptions.TypeException;
 import edu.uci.ics.asterix.dataflow.data.nontagged.AqlNullWriterFactory;
-import edu.uci.ics.asterix.om.pointables.ARecordPointable;
+import edu.uci.ics.asterix.om.pointables.ARecordVisitablePointable;
 import edu.uci.ics.asterix.om.pointables.PointableAllocator;
 import edu.uci.ics.asterix.om.pointables.base.DefaultOpenFieldType;
 import edu.uci.ics.asterix.om.pointables.base.IVisitablePointable;
@@ -108,7 +108,7 @@ class ARecordCaster {
         }
     }
 
-    public void castRecord(ARecordPointable recordAccessor, IVisitablePointable resultAccessor, ARecordType reqType,
+    public void castRecord(ARecordVisitablePointable recordAccessor, IVisitablePointable resultAccessor, ARecordType reqType,
             ACastVisitor visitor) throws IOException, TypeException {
         List<IVisitablePointable> fieldNames = recordAccessor.getFieldNames();
         List<IVisitablePointable> fieldTypeTags = recordAccessor.getFieldTypeTags();

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-om/src/main/java/edu/uci/ics/asterix/om/pointables/nonvisitor/AListPointable.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/om/pointables/nonvisitor/AListPointable.java b/asterix-om/src/main/java/edu/uci/ics/asterix/om/pointables/nonvisitor/AListPointable.java
new file mode 100644
index 0000000..d14443d
--- /dev/null
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/om/pointables/nonvisitor/AListPointable.java
@@ -0,0 +1,193 @@
+/*
+ * Copyright 2009-2013 by The Regents of the University of California
+ * Licensed 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 from
+ * 
+ *     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.
+ */
+
+package edu.uci.ics.asterix.om.pointables.nonvisitor;
+
+import java.io.DataOutput;
+import java.io.IOException;
+
+import edu.uci.ics.asterix.common.exceptions.AsterixException;
+import edu.uci.ics.asterix.om.types.AOrderedListType;
+import edu.uci.ics.asterix.om.types.ATypeTag;
+import edu.uci.ics.asterix.om.types.AbstractCollectionType;
+import edu.uci.ics.asterix.om.util.NonTaggedFormatUtil;
+import edu.uci.ics.asterix.om.util.container.IObjectFactory;
+import edu.uci.ics.hyracks.api.dataflow.value.ITypeTraits;
+import edu.uci.ics.hyracks.data.std.api.AbstractPointable;
+import edu.uci.ics.hyracks.data.std.api.IPointable;
+import edu.uci.ics.hyracks.data.std.api.IPointableFactory;
+import edu.uci.ics.hyracks.data.std.primitive.BytePointable;
+import edu.uci.ics.hyracks.data.std.primitive.IntegerPointable;
+
+/*
+ * This class interprets the binary data representation of a list.
+ * 
+ * List {
+ *   byte type;
+ *   int length;
+ *   int numberOfItems;
+ *   int[numberOfItems] itemOffset;
+ *   IPointable[numberOfItems] item;
+ */
+public class AListPointable extends AbstractPointable {
+
+    public static final ITypeTraits TYPE_TRAITS = new ITypeTraits() {
+        private static final long serialVersionUID = 1L;
+
+        @Override
+        public boolean isFixedLength() {
+            return false;
+        }
+
+        @Override
+        public int getFixedLength() {
+            return 0;
+        }
+    };
+
+    public static final IPointableFactory FACTORY = new IPointableFactory() {
+        private static final long serialVersionUID = 1L;
+
+        @Override
+        public IPointable createPointable() {
+            return new AListPointable();
+        }
+
+        @Override
+        public ITypeTraits getTypeTraits() {
+            return TYPE_TRAITS;
+        }
+    };
+
+    public static final IObjectFactory<IPointable, String> ALLOCATOR = new IObjectFactory<IPointable, String>() {
+        public IPointable create(String id) {
+            return new AListPointable();
+        }
+    };
+    
+    private static final int TAG_SIZE = 1;
+    private static final int TYPE_SIZE = 1;
+    private static final int LENGTH_SIZE = 4;
+    private static final int ITEM_COUNT_SIZE = 4;
+    private static final int ITEM_OFFSET_SIZE = 4;
+
+    public byte getTag() {
+        return BytePointable.getByte(bytes, getTagOffset());
+    }
+
+    public int getTagOffset() {
+        return start;
+    }
+
+    public int getTagSize() {
+        return TAG_SIZE;
+    }
+
+    public byte getType() {
+        return BytePointable.getByte(bytes, getTypeOffset());
+    }
+
+    public int getTypeOffset() {
+        return getTagOffset() + getTagSize();
+    }
+
+    public int getTypeSize() {
+        return TYPE_SIZE;
+    }
+
+    public boolean isTyped() {
+        if (getType() != ATypeTag.ANY.serialize()) {
+            return true;
+        }
+        return false;
+    }
+
+    public boolean isFixedType(AbstractCollectionType inputType) {
+        return NonTaggedFormatUtil.isFixedSizedCollection(inputType.getItemType());
+    }
+
+    public int getFixedLength(AbstractCollectionType inputType) throws AsterixException {
+        return NonTaggedFormatUtil.getFieldValueLength(bytes, 0, inputType.getItemType().getTypeTag(), false);
+    }
+
+    public boolean isOrdered(AbstractCollectionType inputType) {
+        if (inputType instanceof AOrderedListType) {
+            return true;
+        }
+        return false;
+    }
+
+    public int getLength() {
+        return IntegerPointable.getInteger(bytes, getLengthOffset());
+    }
+
+    public int getLengthOffset() {
+        return getTypeOffset() + getTypeSize();
+    }
+
+    public int getLengthSize() {
+        return LENGTH_SIZE;
+    }
+
+    public int getItemCount() {
+        return IntegerPointable.getInteger(bytes, getItemCountOffset());
+    }
+
+    public int getItemCountOffset() {
+        return getLengthOffset() + getLengthSize();
+    }
+
+    public int getItemCountSize() {
+        return ITEM_COUNT_SIZE;
+    }
+
+    // ----------------------
+    // Item accessors
+    // ----------------------
+
+    public int getItemOffset(AbstractCollectionType inputType, int index) throws AsterixException {
+        if (isFixedType(inputType)) {
+            return getItemCountOffset() + getItemCountSize() + index * getFixedLength(inputType);
+        } else {
+            int offset = getItemCountOffset() + getItemCountSize() + index * ITEM_OFFSET_SIZE;
+            return IntegerPointable.getInteger(bytes, offset);
+        }
+    }
+
+    public byte getItemTag(AbstractCollectionType inputType, int index) throws AsterixException {
+        if (getType() != ATypeTag.ANY.serialize()) {
+            return getType();
+        }
+        return bytes[getItemOffset(inputType, index)];
+    }
+
+    public int getItemSize(AbstractCollectionType inputType, int index) throws AsterixException {
+        if (isFixedType(inputType)) {
+            return getFixedLength(inputType);
+        } else {
+            int nextOffset = (getItemCount() > index + 1) ? getItemOffset(inputType, index + 1) : getLength();
+            return nextOffset - getItemOffset(inputType, index);
+        }
+    }
+
+    public void getItemValue(AbstractCollectionType inputType, int index, DataOutput dOut) throws IOException,
+            AsterixException {
+        if (getType() != ATypeTag.ANY.serialize()) {
+            dOut.writeByte(getType());
+        }
+        dOut.write(bytes, getItemOffset(inputType, index), getItemSize(inputType, index));
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-om/src/main/java/edu/uci/ics/asterix/om/pointables/nonvisitor/ARecordPointable.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/om/pointables/nonvisitor/ARecordPointable.java b/asterix-om/src/main/java/edu/uci/ics/asterix/om/pointables/nonvisitor/ARecordPointable.java
new file mode 100644
index 0000000..cb0e136
--- /dev/null
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/om/pointables/nonvisitor/ARecordPointable.java
@@ -0,0 +1,335 @@
+/*
+ * Copyright 2009-2013 by The Regents of the University of California
+ * Licensed 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 from
+ * 
+ *     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.
+ */
+
+package edu.uci.ics.asterix.om.pointables.nonvisitor;
+
+import java.io.DataOutput;
+import java.io.IOException;
+import java.util.Arrays;
+
+import edu.uci.ics.asterix.common.exceptions.AsterixException;
+import edu.uci.ics.asterix.om.types.ARecordType;
+import edu.uci.ics.asterix.om.types.ATypeTag;
+import edu.uci.ics.asterix.om.types.AUnionType;
+import edu.uci.ics.asterix.om.types.EnumDeserializer;
+import edu.uci.ics.asterix.om.types.IAType;
+import edu.uci.ics.asterix.om.util.NonTaggedFormatUtil;
+import edu.uci.ics.asterix.om.util.container.IObjectFactory;
+import edu.uci.ics.hyracks.api.dataflow.value.ITypeTraits;
+import edu.uci.ics.hyracks.data.std.api.AbstractPointable;
+import edu.uci.ics.hyracks.data.std.api.IPointable;
+import edu.uci.ics.hyracks.data.std.api.IPointableFactory;
+import edu.uci.ics.hyracks.data.std.primitive.BooleanPointable;
+import edu.uci.ics.hyracks.data.std.primitive.BytePointable;
+import edu.uci.ics.hyracks.data.std.primitive.IntegerPointable;
+import edu.uci.ics.hyracks.data.std.primitive.UTF8StringPointable;
+
+/*
+ * This class interprets the binary data representation of a record.
+ * 
+ * Record {
+ *   byte tag;
+ *   int length;
+ *   byte isExpanded;
+ *   int openOffset?;
+ *   int numberOfClosedFields;
+ *   byte[ceil (numberOfFields / 8)] nullBitMap; // 1 bit per field, "1" means field is Null for this record
+ *   int[numberOfClosedFields] closedFieldOffset;
+ *   IPointable[numberOfClosedFields] fieldValue;
+ *   int numberOfOpenFields?;
+ *   OpenFieldLookup[numberOfOpenFields] lookup;
+ *   OpenField[numberOfOpenFields] openFields;
+ * }
+ * 
+ * OpenFieldLookup {
+ *   int hashCode;
+ *   int Offset;
+ * }
+ * 
+ * OpenField {
+ *   StringPointable fieldName;
+ *   IPointable fieldValue;
+ * }
+ */
+public class ARecordPointable extends AbstractPointable {
+
+    public static final ITypeTraits TYPE_TRAITS = new ITypeTraits() {
+        private static final long serialVersionUID = 1L;
+
+        @Override
+        public boolean isFixedLength() {
+            return false;
+        }
+
+        @Override
+        public int getFixedLength() {
+            return 0;
+        }
+    };
+
+    public static final IPointableFactory FACTORY = new IPointableFactory() {
+        private static final long serialVersionUID = 1L;
+
+        @Override
+        public IPointable createPointable() {
+            return new ARecordPointable();
+        }
+
+        @Override
+        public ITypeTraits getTypeTraits() {
+            return TYPE_TRAITS;
+        }
+    };
+    
+    public static final IObjectFactory<IPointable, String> ALLOCATOR = new IObjectFactory<IPointable, String>() {
+        public IPointable create(String id) {
+            return new ARecordPointable();
+        }
+    };
+
+
+    private static final int TAG_SIZE = 1;
+    private static final int RECORD_LENGTH_SIZE = 4;
+    private static final int EXPANDED_SIZE = 1;
+    private static final int OPEN_OFFSET_SIZE = 4;
+    private static final int CLOSED_COUNT_SIZE = 4;
+    private static final int FIELD_OFFSET_SIZE = 4;
+    private static final int OPEN_COUNT_SIZE = 4;
+    private static final int OPEN_FIELD_HASH_SIZE = 4;
+    private static final int OPEN_FIELD_OFFSET_SIZE = 4;
+    private static final int OPEN_FIELD_HEADER = OPEN_FIELD_HASH_SIZE + OPEN_FIELD_OFFSET_SIZE;
+
+    private static final int STRING_LENGTH_SIZE = 2;
+
+    private static boolean isOpen(ARecordType recordType) {
+        return recordType == null || recordType.isOpen();
+    }
+    
+    public int getSchemeFieldCount(ARecordType recordType) {
+        return recordType.getFieldNames().length;
+    }
+
+    public byte getTag() {
+        return BytePointable.getByte(bytes, getTagOffset());
+    }
+
+    public int getTagOffset() {
+        return start;
+    }
+
+    public int getTagSize() {
+        return TAG_SIZE;
+    }
+
+    public int getLength() {
+        return IntegerPointable.getInteger(bytes, getLengthOffset());
+    }
+
+    public int getLengthOffset() {
+        return getTagOffset() + getTagSize();
+    }
+
+    public int getLengthSize() {
+        return RECORD_LENGTH_SIZE;
+    }
+
+    public boolean isExpanded(ARecordType recordType) {
+        if (isOpen(recordType)) {
+            return BooleanPointable.getBoolean(bytes, getExpendedOffset(recordType));
+        }
+        return false;
+    }
+
+    public int getExpendedOffset(ARecordType recordType) {
+        return getLengthOffset() + getLengthSize();
+    }
+
+    public int getExpandedSize(ARecordType recordType) {
+        return (isOpen(recordType)) ? EXPANDED_SIZE : 0;
+    }
+
+    public int getOpenPart(ARecordType recordType) {
+        return IntegerPointable.getInteger(bytes, getOpenPartOffset(recordType));
+    }
+
+    public int getOpenPartOffset(ARecordType recordType) {
+        return getExpendedOffset(recordType) + getExpandedSize(recordType);
+    }
+
+    public int getOpenPartSize(ARecordType recordType) {
+        return (isExpanded(recordType)) ? OPEN_OFFSET_SIZE : 0;
+    }
+
+    public int getClosedFieldCount(ARecordType recordType) {
+        return IntegerPointable.getInteger(bytes, getClosedFieldCountOffset(recordType));
+    }
+
+    public int getClosedFieldCountOffset(ARecordType recordType) {
+        return getOpenPartOffset(recordType) + getOpenPartSize(recordType);
+    }
+
+    public int getClosedFieldCountSize(ARecordType recordType) {
+        return CLOSED_COUNT_SIZE;
+    }
+
+    public byte[] getNullBitmap(ARecordType recordType) {
+        if (getNullBitmapSize(recordType) > 0) {
+            return Arrays.copyOfRange(bytes, getNullBitmapOffset(recordType), getNullBitmapSize(recordType));
+        }
+        return null;
+    }
+
+    public int getNullBitmapOffset(ARecordType recordType) {
+        return getClosedFieldCountOffset(recordType) + getClosedFieldCountSize(recordType);
+    }
+
+    public int getNullBitmapSize(ARecordType recordType) {
+        return ARecordType.computeNullBitmapSize(recordType);
+    }
+
+    public boolean isClosedFieldNull(ARecordType recordType, int fieldId) {
+        if (getNullBitmapSize(recordType) > 0) {
+            return ((bytes[getNullBitmapOffset(recordType) + fieldId / 8] & (1 << (7 - (fieldId % 8)))) == 0);
+        }
+        return false;
+    }
+
+    // -----------------------
+    // Closed field accessors.
+    // -----------------------
+
+    public void getClosedFieldValue(ARecordType recordType, int fieldId, DataOutput dOut) throws IOException,
+            AsterixException {
+        if (isClosedFieldNull(recordType, fieldId)) {
+            dOut.writeByte(ATypeTag.NULL.serialize());
+        } else {
+            dOut.write(getClosedFieldTag(recordType, fieldId));
+            dOut.write(bytes, getClosedFieldOffset(recordType, fieldId), getClosedFieldSize(recordType, fieldId));
+        }
+    }
+
+    public String getClosedFieldName(ARecordType recordType, int fieldId) {
+        return recordType.getFieldNames()[fieldId];
+    }
+
+    public void getClosedFieldName(ARecordType recordType, int fieldId, DataOutput dOut) throws IOException {
+        dOut.writeByte(ATypeTag.STRING.serialize());
+        dOut.writeUTF(getClosedFieldName(recordType, fieldId));
+    }
+
+    public byte getClosedFieldTag(ARecordType recordType, int fieldId) {
+        return getClosedFieldType(recordType, fieldId).getTypeTag().serialize();
+    }
+
+    public IAType getClosedFieldType(ARecordType recordType, int fieldId) {
+        IAType aType = recordType.getFieldTypes()[fieldId];
+        if (aType.getTypeTag() == ATypeTag.UNION && NonTaggedFormatUtil.isOptionalField((AUnionType) aType)) {
+            // optional field: add the embedded non-null type tag
+            aType = ((AUnionType) aType).getUnionList().get(AUnionType.OPTIONAL_TYPE_INDEX_IN_UNION_LIST);
+        }
+        return aType;
+    }
+
+    public int getClosedFieldSize(ARecordType recordType, int fieldId) throws AsterixException {
+        if (isClosedFieldNull(recordType, fieldId)) {
+            return 0;
+        }
+        return NonTaggedFormatUtil.getFieldValueLength(bytes, getClosedFieldOffset(recordType, fieldId),
+                getClosedFieldType(recordType, fieldId).getTypeTag(), false);
+    }
+
+    public int getClosedFieldOffset(ARecordType recordType, int fieldId) {
+        int offset = getNullBitmapOffset(recordType) + getNullBitmapSize(recordType) + fieldId * FIELD_OFFSET_SIZE;
+        return IntegerPointable.getInteger(bytes, offset);
+    }
+
+    // -----------------------
+    // Open field count.
+    // -----------------------
+
+    public int getOpenFieldCount(ARecordType recordType) {
+        return isExpanded(recordType) ? IntegerPointable.getInteger(bytes, getOpenFieldCountOffset(recordType)) : 0;
+    }
+
+    public int getOpenFieldCountSize(ARecordType recordType) {
+        return (isExpanded(recordType)) ? OPEN_COUNT_SIZE : 0;
+    }
+
+    public int getOpenFieldCountOffset(ARecordType recordType) {
+        return getOpenPart(recordType);
+    }
+
+    // -----------------------
+    // Open field accessors.
+    // -----------------------
+
+    public void getOpenFieldValue(ARecordType recordType, int fieldId, DataOutput dOut) throws IOException,
+            AsterixException {
+        dOut.write(bytes, getOpenFieldValueOffset(recordType, fieldId), getOpenFieldValueSize(recordType, fieldId));
+    }
+
+    public int getOpenFieldValueOffset(ARecordType recordType, int fieldId) {
+        return getOpenFieldNameOffset(recordType, fieldId) + getOpenFieldNameSize(recordType, fieldId);
+    }
+
+    public int getOpenFieldValueSize(ARecordType recordType, int fieldId) throws AsterixException {
+        int offset = getOpenFieldValueOffset(recordType, fieldId);
+        ATypeTag tag = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(getOpenFieldTag(recordType, fieldId));
+        return NonTaggedFormatUtil.getFieldValueLength(bytes, offset, tag, true);
+    }
+
+    public void getOpenFieldName(ARecordType recordType, int fieldId, DataOutput dOut) throws IOException {
+        dOut.writeByte(ATypeTag.STRING.serialize());
+        dOut.write(bytes, getOpenFieldNameOffset(recordType, fieldId), getOpenFieldNameSize(recordType, fieldId));
+    }
+
+    public int getOpenFieldNameSize(ARecordType recordType, int fieldId) {
+        return UTF8StringPointable.getUTFLength(bytes, getOpenFieldNameOffset(recordType, fieldId))
+                + STRING_LENGTH_SIZE;
+    }
+
+    public int getOpenFieldNameOffset(ARecordType recordType, int fieldId) {
+        return getOpenFieldOffset(recordType, fieldId);
+    }
+
+    public byte getOpenFieldTag(ARecordType recordType, int fieldId) {
+        return bytes[getOpenFieldValueOffset(recordType, fieldId)];
+    }
+
+    public int getOpenFieldHash(ARecordType recordType, int fieldId) {
+        return IntegerPointable.getInteger(bytes, getOpenFieldHashOffset(recordType, fieldId));
+    }
+
+    public int getOpenFieldHashOffset(ARecordType recordType, int fieldId) {
+        return getOpenFieldCountOffset(recordType) + getOpenFieldCountSize(recordType) + fieldId * OPEN_FIELD_HEADER;
+    }
+
+    public int getOpenFieldHashSize(ARecordType recordType, int fieldId) {
+        return OPEN_FIELD_HASH_SIZE;
+    }
+
+    public int getOpenFieldOffset(ARecordType recordType, int fieldId) {
+        return IntegerPointable.getInteger(bytes, getOpenFieldOffsetOffset(recordType, fieldId));
+    }
+
+    public int getOpenFieldOffsetOffset(ARecordType recordType, int fieldId) {
+        return getOpenFieldHashOffset(recordType, fieldId) + getOpenFieldHashSize(recordType, fieldId);
+    }
+
+    public int getOpenFieldOffsetSize(ARecordType recordType, int fieldId) {
+        return OPEN_FIELD_HASH_SIZE;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-om/src/main/java/edu/uci/ics/asterix/om/pointables/printer/AListPrinter.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/om/pointables/printer/AListPrinter.java b/asterix-om/src/main/java/edu/uci/ics/asterix/om/pointables/printer/AListPrinter.java
index 74b0bfc..ffb975a 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/om/pointables/printer/AListPrinter.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/om/pointables/printer/AListPrinter.java
@@ -20,7 +20,7 @@ import java.io.PrintStream;
 import java.util.List;
 
 import edu.uci.ics.asterix.common.exceptions.AsterixException;
-import edu.uci.ics.asterix.om.pointables.AListPointable;
+import edu.uci.ics.asterix.om.pointables.AListVisitablePointable;
 import edu.uci.ics.asterix.om.pointables.base.IVisitablePointable;
 import edu.uci.ics.asterix.om.types.ATypeTag;
 import edu.uci.ics.asterix.om.types.EnumDeserializer;
@@ -48,7 +48,7 @@ class AListPrinter {
         }
     }
 
-    public void printList(AListPointable listAccessor, PrintStream ps, APrintVisitor visitor) throws IOException,
+    public void printList(AListVisitablePointable listAccessor, PrintStream ps, APrintVisitor visitor) throws IOException,
             AsterixException {
         List<IVisitablePointable> itemTags = listAccessor.getItemTags();
         List<IVisitablePointable> items = listAccessor.getItems();

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-om/src/main/java/edu/uci/ics/asterix/om/pointables/printer/APrintVisitor.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/om/pointables/printer/APrintVisitor.java b/asterix-om/src/main/java/edu/uci/ics/asterix/om/pointables/printer/APrintVisitor.java
index 7d4cc86..578b47c 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/om/pointables/printer/APrintVisitor.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/om/pointables/printer/APrintVisitor.java
@@ -46,8 +46,8 @@ import edu.uci.ics.asterix.dataflow.data.nontagged.printers.AUUIDPrinter;
 import edu.uci.ics.asterix.dataflow.data.nontagged.printers.AYearMonthDurationPrinter;
 import edu.uci.ics.asterix.dataflow.data.nontagged.printers.ShortWithoutTypeInfoPrinter;
 import edu.uci.ics.asterix.om.pointables.AFlatValuePointable;
-import edu.uci.ics.asterix.om.pointables.AListPointable;
-import edu.uci.ics.asterix.om.pointables.ARecordPointable;
+import edu.uci.ics.asterix.om.pointables.AListVisitablePointable;
+import edu.uci.ics.asterix.om.pointables.ARecordVisitablePointable;
 import edu.uci.ics.asterix.om.pointables.base.IVisitablePointable;
 import edu.uci.ics.asterix.om.pointables.visitor.IVisitablePointableVisitor;
 import edu.uci.ics.asterix.om.types.ATypeTag;
@@ -65,7 +65,7 @@ public class APrintVisitor implements IVisitablePointableVisitor<Void, Pair<Prin
     private final Map<IVisitablePointable, AListPrinter> laccessorToPrinter = new HashMap<IVisitablePointable, AListPrinter>();
 
     @Override
-    public Void visit(AListPointable accessor, Pair<PrintStream, ATypeTag> arg) throws AsterixException {
+    public Void visit(AListVisitablePointable accessor, Pair<PrintStream, ATypeTag> arg) throws AsterixException {
         AListPrinter printer = laccessorToPrinter.get(accessor);
         if (printer == null) {
             printer = new AListPrinter(accessor.ordered());
@@ -80,7 +80,7 @@ public class APrintVisitor implements IVisitablePointableVisitor<Void, Pair<Prin
     }
 
     @Override
-    public Void visit(ARecordPointable accessor, Pair<PrintStream, ATypeTag> arg) throws AsterixException {
+    public Void visit(ARecordVisitablePointable accessor, Pair<PrintStream, ATypeTag> arg) throws AsterixException {
         ARecordPrinter printer = raccessorToPrinter.get(accessor);
         if (printer == null) {
             printer = new ARecordPrinter();



[5/9] incubator-asterixdb git commit: Adding introspection for getting record details.

Posted by im...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-app/src/test/resources/runtimets/results/records/get-record-fields/tiny-social-example/tiny-social-example.8.adm
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/results/records/get-record-fields/tiny-social-example/tiny-social-example.8.adm b/asterix-app/src/test/resources/runtimets/results/records/get-record-fields/tiny-social-example/tiny-social-example.8.adm
new file mode 100644
index 0000000..7a1ca5d
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/records/get-record-fields/tiny-social-example/tiny-social-example.8.adm
@@ -0,0 +1,13 @@
+[ [ { "field-name": "tweetid", "field-type": "STRING", "is-open": false }, { "field-name": "user", "field-type": "RECORD", "is-open": false, "nested": [ { "field-name": "screen-name", "field-type": "STRING", "is-open": false }, { "field-name": "lang", "field-type": "STRING", "is-open": false }, { "field-name": "friends_count", "field-type": "INT64", "is-open": false }, { "field-name": "statuses_count", "field-type": "INT64", "is-open": false }, { "field-name": "name", "field-type": "STRING", "is-open": true }, { "field-name": "followers_count", "field-type": "INT64", "is-open": true } ] }, { "field-name": "sender-location", "field-type": "POINT", "is-open": false }, { "field-name": "send-time", "field-type": "DATETIME", "is-open": false }, { "field-name": "referred-topics", "field-type": "UNORDEREDLIST", "is-open": false, "list": [ { "field-type": "STRING" }, { "field-type": "STRING" } ] }, { "field-name": "message-text", "field-type": "STRING", "is-open": false } ]
+, [ { "field-name": "tweetid", "field-type": "STRING", "is-open": false }, { "field-name": "user", "field-type": "RECORD", "is-open": false, "nested": [ { "field-name": "screen-name", "field-type": "STRING", "is-open": false }, { "field-name": "lang", "field-type": "STRING", "is-open": false }, { "field-name": "friends_count", "field-type": "INT64", "is-open": false }, { "field-name": "statuses_count", "field-type": "INT64", "is-open": false }, { "field-name": "name", "field-type": "STRING", "is-open": true }, { "field-name": "followers_count", "field-type": "INT64", "is-open": true } ] }, { "field-name": "sender-location", "field-type": "POINT", "is-open": false }, { "field-name": "send-time", "field-type": "DATETIME", "is-open": false }, { "field-name": "referred-topics", "field-type": "UNORDEREDLIST", "is-open": false, "list": [ { "field-type": "STRING" }, { "field-type": "STRING" } ] }, { "field-name": "message-text", "field-type": "STRING", "is-open": false } ]
+, [ { "field-name": "tweetid", "field-type": "STRING", "is-open": false }, { "field-name": "user", "field-type": "RECORD", "is-open": false, "nested": [ { "field-name": "screen-name", "field-type": "STRING", "is-open": false }, { "field-name": "lang", "field-type": "STRING", "is-open": false }, { "field-name": "friends_count", "field-type": "INT64", "is-open": false }, { "field-name": "statuses_count", "field-type": "INT64", "is-open": false }, { "field-name": "name", "field-type": "STRING", "is-open": true }, { "field-name": "followers_count", "field-type": "INT64", "is-open": true } ] }, { "field-name": "sender-location", "field-type": "POINT", "is-open": false }, { "field-name": "send-time", "field-type": "DATETIME", "is-open": false }, { "field-name": "referred-topics", "field-type": "UNORDEREDLIST", "is-open": false, "list": [ { "field-type": "STRING" }, { "field-type": "STRING" } ] }, { "field-name": "message-text", "field-type": "STRING", "is-open": false } ]
+, [ { "field-name": "tweetid", "field-type": "STRING", "is-open": false }, { "field-name": "user", "field-type": "RECORD", "is-open": false, "nested": [ { "field-name": "screen-name", "field-type": "STRING", "is-open": false }, { "field-name": "lang", "field-type": "STRING", "is-open": false }, { "field-name": "friends_count", "field-type": "INT64", "is-open": false }, { "field-name": "statuses_count", "field-type": "INT64", "is-open": false }, { "field-name": "name", "field-type": "STRING", "is-open": true }, { "field-name": "followers_count", "field-type": "INT64", "is-open": true } ] }, { "field-name": "sender-location", "field-type": "POINT", "is-open": false }, { "field-name": "send-time", "field-type": "DATETIME", "is-open": false }, { "field-name": "referred-topics", "field-type": "UNORDEREDLIST", "is-open": false, "list": [ { "field-type": "STRING" }, { "field-type": "STRING" } ] }, { "field-name": "message-text", "field-type": "STRING", "is-open": false } ]
+, [ { "field-name": "tweetid", "field-type": "STRING", "is-open": false }, { "field-name": "user", "field-type": "RECORD", "is-open": false, "nested": [ { "field-name": "screen-name", "field-type": "STRING", "is-open": false }, { "field-name": "lang", "field-type": "STRING", "is-open": false }, { "field-name": "friends_count", "field-type": "INT64", "is-open": false }, { "field-name": "statuses_count", "field-type": "INT64", "is-open": false }, { "field-name": "name", "field-type": "STRING", "is-open": true }, { "field-name": "followers_count", "field-type": "INT64", "is-open": true } ] }, { "field-name": "sender-location", "field-type": "POINT", "is-open": false }, { "field-name": "send-time", "field-type": "DATETIME", "is-open": false }, { "field-name": "referred-topics", "field-type": "UNORDEREDLIST", "is-open": false, "list": [ { "field-type": "STRING" }, { "field-type": "STRING" } ] }, { "field-name": "message-text", "field-type": "STRING", "is-open": false } ]
+, [ { "field-name": "tweetid", "field-type": "STRING", "is-open": false }, { "field-name": "user", "field-type": "RECORD", "is-open": false, "nested": [ { "field-name": "screen-name", "field-type": "STRING", "is-open": false }, { "field-name": "lang", "field-type": "STRING", "is-open": false }, { "field-name": "friends_count", "field-type": "INT64", "is-open": false }, { "field-name": "statuses_count", "field-type": "INT64", "is-open": false }, { "field-name": "name", "field-type": "STRING", "is-open": true }, { "field-name": "followers_count", "field-type": "INT64", "is-open": true } ] }, { "field-name": "sender-location", "field-type": "POINT", "is-open": false }, { "field-name": "send-time", "field-type": "DATETIME", "is-open": false }, { "field-name": "referred-topics", "field-type": "UNORDEREDLIST", "is-open": false, "list": [ { "field-type": "STRING" }, { "field-type": "STRING" } ] }, { "field-name": "message-text", "field-type": "STRING", "is-open": false } ]
+, [ { "field-name": "tweetid", "field-type": "STRING", "is-open": false }, { "field-name": "user", "field-type": "RECORD", "is-open": false, "nested": [ { "field-name": "screen-name", "field-type": "STRING", "is-open": false }, { "field-name": "lang", "field-type": "STRING", "is-open": false }, { "field-name": "friends_count", "field-type": "INT64", "is-open": false }, { "field-name": "statuses_count", "field-type": "INT64", "is-open": false }, { "field-name": "name", "field-type": "STRING", "is-open": true }, { "field-name": "followers_count", "field-type": "INT64", "is-open": true } ] }, { "field-name": "sender-location", "field-type": "POINT", "is-open": false }, { "field-name": "send-time", "field-type": "DATETIME", "is-open": false }, { "field-name": "referred-topics", "field-type": "UNORDEREDLIST", "is-open": false, "list": [ { "field-type": "STRING" }, { "field-type": "STRING" } ] }, { "field-name": "message-text", "field-type": "STRING", "is-open": false } ]
+, [ { "field-name": "tweetid", "field-type": "STRING", "is-open": false }, { "field-name": "user", "field-type": "RECORD", "is-open": false, "nested": [ { "field-name": "screen-name", "field-type": "STRING", "is-open": false }, { "field-name": "lang", "field-type": "STRING", "is-open": false }, { "field-name": "friends_count", "field-type": "INT64", "is-open": false }, { "field-name": "statuses_count", "field-type": "INT64", "is-open": false }, { "field-name": "name", "field-type": "STRING", "is-open": true }, { "field-name": "followers_count", "field-type": "INT64", "is-open": true } ] }, { "field-name": "sender-location", "field-type": "POINT", "is-open": false }, { "field-name": "send-time", "field-type": "DATETIME", "is-open": false }, { "field-name": "referred-topics", "field-type": "UNORDEREDLIST", "is-open": false, "list": [ { "field-type": "STRING" }, { "field-type": "STRING" } ] }, { "field-name": "message-text", "field-type": "STRING", "is-open": false } ]
+, [ { "field-name": "tweetid", "field-type": "STRING", "is-open": false }, { "field-name": "user", "field-type": "RECORD", "is-open": false, "nested": [ { "field-name": "screen-name", "field-type": "STRING", "is-open": false }, { "field-name": "lang", "field-type": "STRING", "is-open": false }, { "field-name": "friends_count", "field-type": "INT64", "is-open": false }, { "field-name": "statuses_count", "field-type": "INT64", "is-open": false }, { "field-name": "name", "field-type": "STRING", "is-open": true }, { "field-name": "followers_count", "field-type": "INT64", "is-open": true } ] }, { "field-name": "sender-location", "field-type": "POINT", "is-open": false }, { "field-name": "send-time", "field-type": "DATETIME", "is-open": false }, { "field-name": "referred-topics", "field-type": "UNORDEREDLIST", "is-open": false, "list": [ { "field-type": "STRING" }, { "field-type": "STRING" } ] }, { "field-name": "message-text", "field-type": "STRING", "is-open": false } ]
+, [ { "field-name": "tweetid", "field-type": "STRING", "is-open": false }, { "field-name": "user", "field-type": "RECORD", "is-open": false, "nested": [ { "field-name": "screen-name", "field-type": "STRING", "is-open": false }, { "field-name": "lang", "field-type": "STRING", "is-open": false }, { "field-name": "friends_count", "field-type": "INT64", "is-open": false }, { "field-name": "statuses_count", "field-type": "INT64", "is-open": false }, { "field-name": "name", "field-type": "STRING", "is-open": true }, { "field-name": "followers_count", "field-type": "INT64", "is-open": true } ] }, { "field-name": "sender-location", "field-type": "POINT", "is-open": false }, { "field-name": "send-time", "field-type": "DATETIME", "is-open": false }, { "field-name": "referred-topics", "field-type": "UNORDEREDLIST", "is-open": false, "list": [ { "field-type": "STRING" }, { "field-type": "STRING" } ] }, { "field-name": "message-text", "field-type": "STRING", "is-open": false } ]
+, [ { "field-name": "tweetid", "field-type": "STRING", "is-open": false }, { "field-name": "user", "field-type": "RECORD", "is-open": false, "nested": [ { "field-name": "screen-name", "field-type": "STRING", "is-open": false }, { "field-name": "lang", "field-type": "STRING", "is-open": false }, { "field-name": "friends_count", "field-type": "INT64", "is-open": false }, { "field-name": "statuses_count", "field-type": "INT64", "is-open": false }, { "field-name": "name", "field-type": "STRING", "is-open": true }, { "field-name": "followers_count", "field-type": "INT64", "is-open": true } ] }, { "field-name": "sender-location", "field-type": "POINT", "is-open": false }, { "field-name": "send-time", "field-type": "DATETIME", "is-open": false }, { "field-name": "referred-topics", "field-type": "UNORDEREDLIST", "is-open": false, "list": [ { "field-type": "STRING" }, { "field-type": "STRING" } ] }, { "field-name": "message-text", "field-type": "STRING", "is-open": false } ]
+, [ { "field-name": "tweetid", "field-type": "STRING", "is-open": false }, { "field-name": "user", "field-type": "RECORD", "is-open": false, "nested": [ { "field-name": "screen-name", "field-type": "STRING", "is-open": false }, { "field-name": "lang", "field-type": "STRING", "is-open": false }, { "field-name": "friends_count", "field-type": "INT64", "is-open": false }, { "field-name": "statuses_count", "field-type": "INT64", "is-open": false }, { "field-name": "name", "field-type": "STRING", "is-open": true }, { "field-name": "followers_count", "field-type": "INT64", "is-open": true } ] }, { "field-name": "sender-location", "field-type": "POINT", "is-open": false }, { "field-name": "send-time", "field-type": "DATETIME", "is-open": false }, { "field-name": "referred-topics", "field-type": "UNORDEREDLIST", "is-open": false, "list": [ { "field-type": "STRING" }, { "field-type": "STRING" } ] }, { "field-name": "message-text", "field-type": "STRING", "is-open": false } ]
+ ]
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-app/src/test/resources/runtimets/results/records/get-record-fields/tiny-social-example/tiny-social-example.9.adm
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/results/records/get-record-fields/tiny-social-example/tiny-social-example.9.adm b/asterix-app/src/test/resources/runtimets/results/records/get-record-fields/tiny-social-example/tiny-social-example.9.adm
new file mode 100644
index 0000000..898d763
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/records/get-record-fields/tiny-social-example/tiny-social-example.9.adm
@@ -0,0 +1,7 @@
+[ { "count": 12, "field-name": "message-text", "field-type": "STRING" }
+, { "count": 12, "field-name": "referred-topics", "field-type": "UNORDEREDLIST" }
+, { "count": 12, "field-name": "send-time", "field-type": "DATETIME" }
+, { "count": 12, "field-name": "sender-location", "field-type": "POINT" }
+, { "count": 12, "field-name": "tweetid", "field-type": "STRING" }
+, { "count": 12, "field-name": "user", "field-type": "RECORD" }
+ ]
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-app/src/test/resources/runtimets/testsuite.xml
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/testsuite.xml b/asterix-app/src/test/resources/runtimets/testsuite.xml
index 2163093..94ae2f2 100644
--- a/asterix-app/src/test/resources/runtimets/testsuite.xml
+++ b/asterix-app/src/test/resources/runtimets/testsuite.xml
@@ -12,6 +12,11 @@
  ! See the License for the specific language governing permissions and
  ! limitations under the License.
  !-->
+<!DOCTYPE test-suite [
+
+<!ENTITY RecordsQueries SYSTEM "queries/records/RecordsQueries.xml">
+
+]>
 <test-suite
         xmlns="urn:xml.testframework.asterix.ics.uci.edu"
         ResultOffsetPath="results"
@@ -4343,65 +4348,7 @@
         </test-case>
     </test-group>
     <test-group name="records">
-        <test-case FilePath="records">
-            <compilation-unit name="closed-record-constructor_01">
-                <output-dir compare="Text">closed-record-constructor_01</output-dir>
-            </compilation-unit>
-        </test-case>
-        <test-case FilePath="records">
-            <compilation-unit name="closed-record-constructor_02">
-                <output-dir compare="Text">closed-record-constructor_02</output-dir>
-            </compilation-unit>
-        </test-case>
-        <test-case FilePath="records">
-            <compilation-unit name="closed-record-constructor_03">
-                <output-dir compare="Text">closed-record-constructor_03</output-dir>
-            </compilation-unit>
-        </test-case>
-        -->
-        <test-case FilePath="records">
-            <compilation-unit name="expFieldName">
-                <output-dir compare="Text">expFieldName</output-dir>
-            </compilation-unit>
-        </test-case>
-        <test-case FilePath="records">
-            <compilation-unit name="field-access-by-index_01">
-                <output-dir compare="Text">field-access-by-index_01</output-dir>
-            </compilation-unit>
-        </test-case>
-        <test-case FilePath="records">
-            <compilation-unit name="field-access-on-open-field">
-                <output-dir compare="Text">field-access-on-open-field</output-dir>
-            </compilation-unit>
-        </test-case>
-        <test-case FilePath="records">
-            <compilation-unit name="open-record-constructor_01">
-                <output-dir compare="Text">open-record-constructor_01</output-dir>
-            </compilation-unit>
-        </test-case>
-        <test-case FilePath="records">
-            <compilation-unit name="open-record-constructor_02">
-                <output-dir compare="Text">open-record-constructor_02</output-dir>
-            </compilation-unit>
-        </test-case>
-        <test-case FilePath="records">
-            <compilation-unit name="closed-closed-fieldname-conflict_issue173">
-                <output-dir compare="Text">closed-closed-fieldname-conflict_issue173</output-dir>
-                <expected-error>edu.uci.ics.asterix.common.exceptions.AsterixException</expected-error>
-            </compilation-unit>
-        </test-case>
-        <test-case FilePath="records">
-            <compilation-unit name="open-closed-fieldname-conflict_issue173">
-                <output-dir compare="Text">open-closed-fieldname-conflict_issue173</output-dir>
-                <expected-error>edu.uci.ics.asterix.common.exceptions.AsterixException</expected-error>
-            </compilation-unit>
-        </test-case>
-        <test-case FilePath="records">
-            <compilation-unit name="open-open-fieldname-conflict_issue173">
-                <output-dir compare="Text">open-open-fieldname-conflict_issue173</output-dir>
-                <expected-error>edu.uci.ics.asterix.common.exceptions.AsterixException</expected-error>
-            </compilation-unit>
-        </test-case>
+        &RecordsQueries;
     </test-group>
     <test-group name="scan">
         <test-case FilePath="scan">

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-common/src/main/resources/schema/asterix-conf.xsd
----------------------------------------------------------------------
diff --git a/asterix-common/src/main/resources/schema/asterix-conf.xsd b/asterix-common/src/main/resources/schema/asterix-conf.xsd
index 6edfbf8..bed63be 100644
--- a/asterix-common/src/main/resources/schema/asterix-conf.xsd
+++ b/asterix-common/src/main/resources/schema/asterix-conf.xsd
@@ -1,88 +1,108 @@
 <?xml version="1.0" encoding="ISO-8859-1" ?>
-<!--
- ! Copyright 2009-2013 by The Regents of the University of California
- ! Licensed 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 from
- !
- !     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.
- !-->
-<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
-	xmlns:mg="asterixconf" targetNamespace="asterixconf"
-	elementFormDefault="qualified">
+<xs:schema
+    xmlns:xs="http://www.w3.org/2001/XMLSchema"
+    xmlns:mg="asterixconf"
+    targetNamespace="asterixconf"
+    elementFormDefault="qualified">
 
-	<!-- definition of simple types -->
+    <!-- definition of simple types -->
+    <xs:element
+        name="instanceName"
+        type="xs:string" />
+    <xs:element
+        name="version"
+        type="xs:string" />
+    <xs:element
+        name="metadataNode"
+        type="xs:string" />
+    <xs:element
+        name="coredumpPath"
+        type="xs:string" />
+    <xs:element
+        name="storeDirs"
+        type="xs:string" />
+    <xs:element
+        name="ncId"
+        type="xs:string" />
+    <xs:element
+        name="name"
+        type="xs:string" />
+    <xs:element
+        name="value"
+        type="xs:string" />
+    <xs:element
+        name="description"
+        type="xs:string" />
+    <xs:element
+        name="txnLogDirPath"
+        type="xs:string" />
 
+    <!-- definition of complex elements -->
+    <xs:element name="store">
+        <xs:complexType>
+            <xs:sequence>
+                <xs:element ref="mg:ncId" />
+                <xs:element ref="mg:storeDirs" />
+            </xs:sequence>
+        </xs:complexType>
+    </xs:element>
 
-	<xs:element name="instanceName" type="xs:string" />
-	<xs:element name="version" type="xs:string"/>
-	<xs:element name="metadataNode" type="xs:string" />
-	<xs:element name="coredumpPath" type="xs:string" />
-	<xs:element name="storeDirs" type="xs:string" />
-	<xs:element name="ncId" type="xs:string" />
-	<xs:element name="name" type="xs:string" />
-	<xs:element name="value" type="xs:string" />
-	<xs:element name="description" type="xs:string" />
-	<xs:element name="txnLogDirPath" type="xs:string" />
+    <xs:element name="coredump">
+        <xs:complexType>
+            <xs:sequence>
+                <xs:element ref="mg:ncId" />
+                <xs:element ref="mg:coredumpPath" />
+            </xs:sequence>
+        </xs:complexType>
+    </xs:element>
 
+    <xs:element name="transactionLogDir">
+        <xs:complexType>
+            <xs:sequence>
+                <xs:element ref="mg:ncId" />
+                <xs:element ref="mg:txnLogDirPath" />
+            </xs:sequence>
+        </xs:complexType>
+    </xs:element>
 
-	<!-- definition of complex elements -->
-	<xs:element name="store">
-		<xs:complexType>
-			<xs:sequence>
-				<xs:element ref="mg:ncId" />
-				<xs:element ref="mg:storeDirs" />
-			</xs:sequence>
-		</xs:complexType>
-	</xs:element>
+    <xs:element name="property">
+        <xs:complexType>
+            <xs:sequence>
+                <xs:element ref="mg:name" />
+                <xs:element ref="mg:value" />
+                <xs:element ref="mg:description" />
+            </xs:sequence>
+        </xs:complexType>
+    </xs:element>
 
-	<xs:element name="coredump">
-		<xs:complexType>
-			<xs:sequence>
-				<xs:element ref="mg:ncId" />
-				<xs:element ref="mg:coredumpPath" />
-			</xs:sequence>
-		</xs:complexType>
-	</xs:element>
 
-	<xs:element name="transactionLogDir">
-		<xs:complexType>
-			<xs:sequence>
-				<xs:element ref="mg:ncId" />
-				<xs:element ref="mg:txnLogDirPath" />
-			</xs:sequence>
-		</xs:complexType>
-	</xs:element>
+    <xs:element name="asterixConfiguration">
+        <xs:complexType>
+            <xs:sequence>
+                <xs:element
+                    ref="mg:instanceName"
+                    minOccurs="0" />
+                <xs:element
+                    ref="mg:version"
+                    minOccurs="0" />
+                <xs:element
+                    ref="mg:metadataNode"
+                    minOccurs="0" />
+                <xs:element
+                    ref="mg:store"
+                    maxOccurs="unbounded" />
+                <xs:element
+                    ref="mg:coredump"
+                    maxOccurs="unbounded" />
+                <xs:element
+                    ref="mg:transactionLogDir"
+                    maxOccurs="unbounded" />
+                <xs:element
+                    ref="mg:property"
+                    minOccurs="0"
+                    maxOccurs="unbounded" />
+            </xs:sequence>
+        </xs:complexType>
+    </xs:element>
 
-	<xs:element name="property">
-		<xs:complexType>
-			<xs:sequence>
-				<xs:element ref="mg:name" />
-				<xs:element ref="mg:value" />
-				<xs:element ref="mg:description" />
-			</xs:sequence>
-		</xs:complexType>
-	</xs:element>
-
-
-	<xs:element name="asterixConfiguration">
-		<xs:complexType>
-			<xs:sequence>
-				<xs:element ref="mg:instanceName" minOccurs="0" />
-				<xs:element ref="mg:version" minOccurs="0" />
-				<xs:element ref="mg:metadataNode" minOccurs="0" />
-				<xs:element ref="mg:store" maxOccurs="unbounded" />
-				<xs:element ref="mg:coredump" maxOccurs="unbounded" />
-				<xs:element ref="mg:transactionLogDir" maxOccurs="unbounded" />
-				<xs:element ref="mg:property" minOccurs="0" maxOccurs="unbounded" />
-			</xs:sequence>
-		</xs:complexType>
-	</xs:element>
-
-</xs:schema>     
+</xs:schema>

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-common/src/main/resources/schema/yarn_cluster.xsd
----------------------------------------------------------------------
diff --git a/asterix-common/src/main/resources/schema/yarn_cluster.xsd b/asterix-common/src/main/resources/schema/yarn_cluster.xsd
index 2aa76cf..62c6f9a 100644
--- a/asterix-common/src/main/resources/schema/yarn_cluster.xsd
+++ b/asterix-common/src/main/resources/schema/yarn_cluster.xsd
@@ -1,103 +1,179 @@
 <?xml version="1.0" encoding="ISO-8859-1" ?>
-<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
-	xmlns:cl="yarn_cluster" targetNamespace="yarn_cluster" elementFormDefault="qualified">
+<xs:schema
+    xmlns:xs="http://www.w3.org/2001/XMLSchema"
+    xmlns:cl="yarn_cluster"
+    targetNamespace="yarn_cluster"
+    elementFormDefault="qualified">
 
 	<!-- definition of simple types -->
-	<xs:element name="instance_name" type="xs:string" />
-	<xs:element name="cluster_name" type="xs:string" />
-	<xs:element name="log_dir" type="xs:string" />
-	<xs:element name="txn_log_dir" type="xs:string" />
-	<xs:element name="id" type="xs:string" />
-	<xs:element name="client_ip" type="xs:string" />
-	<xs:element name="cluster_ip" type="xs:string" />
-	<xs:element name="key" type="xs:string" />
-	<xs:element name="value" type="xs:string" />
-	<xs:element name="store" type="xs:string" />
-	<xs:element name="iodevices" type="xs:string" />
-	<xs:element name="web_port" type="xs:string" />
-	<xs:element name="client_port" type="xs:integer" />
-	<xs:element name="cluster_port" type="xs:integer" />
-	<xs:element name="http_port" type="xs:integer" />
-	<xs:element name="debug_port" type="xs:integer" />
-	<xs:element name="metadata_node" type="xs:string" />
-	<xs:element name="cc_container_mem" type="xs:string" />
-	<xs:element name="nc_container_mem" type="xs:string" />
+    <xs:element
+        name="instance_name"
+        type="xs:string" />
+    <xs:element
+        name="cluster_name"
+        type="xs:string" />
+    <xs:element
+        name="log_dir"
+        type="xs:string" />
+    <xs:element
+        name="txn_log_dir"
+        type="xs:string" />
+    <xs:element
+        name="id"
+        type="xs:string" />
+    <xs:element
+        name="client_ip"
+        type="xs:string" />
+    <xs:element
+        name="cluster_ip"
+        type="xs:string" />
+    <xs:element
+        name="key"
+        type="xs:string" />
+    <xs:element
+        name="value"
+        type="xs:string" />
+    <xs:element
+        name="store"
+        type="xs:string" />
+    <xs:element
+        name="iodevices"
+        type="xs:string" />
+    <xs:element
+        name="web_port"
+        type="xs:string" />
+    <xs:element
+        name="client_port"
+        type="xs:integer" />
+    <xs:element
+        name="cluster_port"
+        type="xs:integer" />
+    <xs:element
+        name="http_port"
+        type="xs:integer" />
+    <xs:element
+        name="debug_port"
+        type="xs:integer" />
+    <xs:element
+        name="metadata_node"
+        type="xs:string" />
+    <xs:element
+        name="cc_container_mem"
+        type="xs:string" />
+    <xs:element
+        name="nc_container_mem"
+        type="xs:string" />
 	
 
 	<!-- definition of complex elements -->
 
-	<xs:element name="master_node">
-		<xs:complexType>
-			<xs:sequence>
-				<xs:element ref="cl:id" />
-				<xs:element ref="cl:client_ip" />
-				<xs:element ref="cl:cluster_ip" />
-				<xs:element ref="cl:log_dir" minOccurs="0" />
-				<xs:element ref="cl:client_port" />
-				<xs:element ref="cl:cluster_port" />
-				<xs:element ref="cl:http_port" />
-				<xs:element ref="cl:debug_port" minOccurs="0" />
-			</xs:sequence>
-		</xs:complexType>
-	</xs:element>
+    <xs:element name="master_node">
+        <xs:complexType>
+            <xs:sequence>
+                <xs:element ref="cl:id" />
+                <xs:element ref="cl:client_ip" />
+                <xs:element ref="cl:cluster_ip" />
+                <xs:element
+                    ref="cl:log_dir"
+                    minOccurs="0" />
+                <xs:element ref="cl:client_port" />
+                <xs:element ref="cl:cluster_port" />
+                <xs:element ref="cl:http_port" />
+                <xs:element
+                    ref="cl:debug_port"
+                    minOccurs="0" />
+            </xs:sequence>
+        </xs:complexType>
+    </xs:element>
 
-	<xs:element name="property">
-		<xs:complexType>
-			<xs:sequence>
-				<xs:element ref="cl:key" />
-				<xs:element ref="cl:value" />
-			</xs:sequence>
-		</xs:complexType>
-	</xs:element>
+    <xs:element name="property">
+        <xs:complexType>
+            <xs:sequence>
+                <xs:element ref="cl:key" />
+                <xs:element ref="cl:value" />
+            </xs:sequence>
+        </xs:complexType>
+    </xs:element>
 
-	<xs:element name="env">
-		<xs:complexType>
-			<xs:sequence>
-				<xs:element ref="cl:property" minOccurs="0" maxOccurs="unbounded" />
-			</xs:sequence>
-		</xs:complexType>
-	</xs:element>
+    <xs:element name="env">
+        <xs:complexType>
+            <xs:sequence>
+                <xs:element
+                    ref="cl:property"
+                    minOccurs="0"
+                    maxOccurs="unbounded" />
+            </xs:sequence>
+        </xs:complexType>
+    </xs:element>
 
-	<xs:element name="node">
-		<xs:complexType>
-			<xs:sequence>
-				<xs:element ref="cl:id" />
-				<xs:element ref="cl:cluster_ip" />
-				<xs:element ref="cl:log_dir" minOccurs="0" />
-				<xs:element ref="cl:txn_log_dir" minOccurs="0" />
-				<xs:element ref="cl:store" minOccurs="0" />
-				<xs:element ref="cl:iodevices" minOccurs="0" />
-				<xs:element ref="cl:debug_port" minOccurs="0" />
-			</xs:sequence>
-		</xs:complexType>
-	</xs:element>
+    <xs:element name="node">
+        <xs:complexType>
+            <xs:sequence>
+                <xs:element ref="cl:id" />
+                <xs:element ref="cl:cluster_ip" />
+                <xs:element
+                    ref="cl:log_dir"
+                    minOccurs="0" />
+                <xs:element
+                    ref="cl:txn_log_dir"
+                    minOccurs="0" />
+                <xs:element
+                    ref="cl:store"
+                    minOccurs="0" />
+                <xs:element
+                    ref="cl:iodevices"
+                    minOccurs="0" />
+                <xs:element
+                    ref="cl:debug_port"
+                    minOccurs="0" />
+            </xs:sequence>
+        </xs:complexType>
+    </xs:element>
 
-	<xs:element name="substitute_nodes">
-		<xs:complexType>
-			<xs:sequence>
-				<xs:element ref="cl:node" maxOccurs="unbounded" />
-			</xs:sequence>
-		</xs:complexType>
-	</xs:element>
+    <xs:element name="substitute_nodes">
+        <xs:complexType>
+            <xs:sequence>
+                <xs:element
+                    ref="cl:node"
+                    maxOccurs="unbounded" />
+            </xs:sequence>
+        </xs:complexType>
+    </xs:element>
 
-	<xs:element name="cluster">
-		<xs:complexType>
-			<xs:sequence>
-				<xs:element ref="cl:instance_name" />
-				<xs:element ref="cl:cluster_name" />
-				<xs:element ref="cl:cc_container_mem" minOccurs="0" />
-				<xs:element ref="cl:nc_container_mem" minOccurs="0" />
-				<xs:element ref="cl:env" minOccurs="0" />
-				<xs:element ref="cl:log_dir" minOccurs="0" />
-				<xs:element ref="cl:txn_log_dir" minOccurs="0" />
-				<xs:element ref="cl:store" minOccurs="0" />
-				<xs:element ref="cl:iodevices" minOccurs="0" />
-				<xs:element ref="cl:metadata_node" />
-				<xs:element ref="cl:master_node" />
-				<xs:element ref="cl:node" maxOccurs="unbounded" />
-				<xs:element ref="cl:substitute_nodes" />
-			</xs:sequence>
-		</xs:complexType>
-	</xs:element>
+    <xs:element name="cluster">
+        <xs:complexType>
+            <xs:sequence>
+                <xs:element ref="cl:instance_name" />
+                <xs:element ref="cl:cluster_name" />
+                <xs:element
+                    ref="cl:cc_container_mem"
+                    minOccurs="0" />
+                <xs:element
+                    ref="cl:nc_container_mem"
+                    minOccurs="0" />
+                <xs:element
+                    ref="cl:env"
+                    minOccurs="0" />
+                <xs:element
+                    ref="cl:log_dir"
+                    minOccurs="0" />
+                <xs:element
+                    ref="cl:txn_log_dir"
+                    minOccurs="0" />
+                <xs:element
+                    ref="cl:store"
+                    minOccurs="0" />
+                <xs:element
+                    ref="cl:iodevices"
+                    minOccurs="0" />
+                <xs:element ref="cl:metadata_node" />
+                <xs:element ref="cl:master_node" />
+                <xs:element
+                    ref="cl:node"
+                    maxOccurs="unbounded" />
+                <xs:element ref="cl:substitute_nodes" />
+            </xs:sequence>
+        </xs:complexType>
+    </xs:element>
 
 </xs:schema>     

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-doc/src/site/markdown/aql/functions.md
----------------------------------------------------------------------
diff --git a/asterix-doc/src/site/markdown/aql/functions.md b/asterix-doc/src/site/markdown/aql/functions.md
index a5f7961..fd00d11 100644
--- a/asterix-doc/src/site/markdown/aql/functions.md
+++ b/asterix-doc/src/site/markdown/aql/functions.md
@@ -9,6 +9,7 @@
 * [Similarity Functions](#SimilarityFunctions)
 * [Tokenizing Functions](#TokenizingFunctions)
 * [Temporal Functions](#TemporalFunctions)
+* [Record Functions](#RecordFunctions)
 * [Other Functions](#OtherFunctions)
 
 Asterix provides various classes of functions to support operations on numeric, string, spatial, and temporal data. This document explains how to use these functions.
@@ -2221,6 +2222,66 @@ See the [Allen's Relations](allens.html).
           "datetimebins": [ interval-datetime("1800-01-01T00:00:00.000Z, 1900-01-01T00:00:00.000Z"), interval-datetime("1900-01-01T00:00:00.000Z, 2000-01-01T00:00:00.000Z"), interval-datetime("2000-01-01T00:00:00.000Z, 2100-01-01T00:00:00.000Z") ] }
 
 
+## <a id="RecordFunctions">Record Functions</a> <font size="4"><a href="#toc">[Back to TOC]</a></font> ##
+
+
+### get-record-fields ###
+ * Syntax:
+
+        get-record-fields(record_expression)
+
+ * Access the record field names, type and open status for a given record.
+ * Arguments:
+    * `record_expression` : a record value.
+ * Return Value:
+    * An order list of `record` values that include the field-name `string`, field-type `string`, is-open `boolean` and optional nested `orderedList` for the values of a nested record.
+
+ * Example:
+
+        let $r1 := {"id": 1, 
+            "project": "AsterixDB", 
+            "address": {"city": "Irvine", "state": "CA"}, 
+            "related": ["Hivestrix", "Preglix", "Apache VXQuery"] }
+        return get-record-fields($r1)
+
+ * The expected result is:
+
+        [ { "field-name": "id", "field-type": "INT64", "is-open": false }, 
+          { "field-name": "project", "field-type": "STRING", "is-open": false }, 
+          { "field-name": "address", "field-type": "RECORD", "is-open": false, "nested": [ 
+            { "field-name": "city", "field-type": "STRING", "is-open": false }, 
+            { "field-name": "state", "field-type": "STRING", "is-open": false } ] }, 
+          { "field-name": "related", "field-type": "ORDEREDLIST", "is-open": false, "list": [ 
+            { "field-type": "STRING" }, 
+            { "field-type": "STRING" }, 
+            { "field-type": "STRING" } ] } ]
+
+ ]
+### get-record-field-value ###
+ * Syntax:
+
+        get-record-field-value(record_expression, string_expression)
+
+ * Access the field name given in the `string_expression` from the `record_expression`.
+ * Arguments:
+    * `record_expression` : A `record` value.
+    * `string_expression` : A `string` representing the top level field name.
+ * Return Value:
+    * An `any` value saved in the designated field of the record.
+
+ * Example:
+
+        let $r1 := {"id": 1, 
+            "project": "AsterixDB", 
+            "address": {"city": "Irvine", "state": "CA"}, 
+            "related": ["Hivestrix", "Preglix", "Apache VXQuery"] }
+        return get-record-field-value($r1, "project")
+
+ * The expected result is:
+
+        "AsterixDB"
+
+
 ## <a id="OtherFunctions">Other Functions</a> <font size="4"><a href="#toc">[Back to TOC]</a></font> ##
 
 

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-external-data/src/main/java/edu/uci/ics/asterix/external/indexing/input/AbstractHDFSReader.java
----------------------------------------------------------------------
diff --git a/asterix-external-data/src/main/java/edu/uci/ics/asterix/external/indexing/input/AbstractHDFSReader.java b/asterix-external-data/src/main/java/edu/uci/ics/asterix/external/indexing/input/AbstractHDFSReader.java
index b6bc2c0..1027517 100644
--- a/asterix-external-data/src/main/java/edu/uci/ics/asterix/external/indexing/input/AbstractHDFSReader.java
+++ b/asterix-external-data/src/main/java/edu/uci/ics/asterix/external/indexing/input/AbstractHDFSReader.java
@@ -24,38 +24,40 @@ import org.apache.hadoop.mapred.Reporter;
  * an abstract class to be used for reading hdfs based datasets one record at a time <- used for indexing->
  */
 @SuppressWarnings("deprecation")
-public abstract class AbstractHDFSReader extends InputStream{
+public abstract class AbstractHDFSReader extends InputStream {
 
     /***
      * This function should be called once to do initial setup before starting to read records
+     * 
      * @return true if ready for reading
      */
     abstract public boolean initialize() throws Exception;
-    
+
     /***
      * @return the next object read or null if reached end of stream
      */
     abstract public Object readNext() throws Exception;
-    
+
     /**
      * @return the file name of the current filesplit being read
-     * @throws Exception in case of end of records is reached
+     * @throws Exception
+     *             in case of end of records is reached
      */
     abstract public String getFileName() throws Exception;
-    
+
     /**
      * @return return the reader position of last record read
-     * @throws Exception in case of end of records is reached
+     * @throws Exception
+     *             in case of end of records is reached
      */
     abstract public long getReaderPosition() throws Exception;
-    
+
     /**
-     * 
      * @return the file number of the file being read
      * @throws Exception
      */
     abstract public int getFileNumber() throws Exception;
-    
+
     protected Reporter getReporter() {
         Reporter reporter = new Reporter() {
 
@@ -70,8 +72,7 @@ public abstract class AbstractHDFSReader extends InputStream{
             }
 
             @Override
-            public InputSplit getInputSplit()
-                    throws UnsupportedOperationException {
+            public InputSplit getInputSplit() throws UnsupportedOperationException {
                 return null;
             }
 

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-external-data/src/main/java/edu/uci/ics/asterix/external/library/JavaFunctionHelper.java
----------------------------------------------------------------------
diff --git a/asterix-external-data/src/main/java/edu/uci/ics/asterix/external/library/JavaFunctionHelper.java b/asterix-external-data/src/main/java/edu/uci/ics/asterix/external/library/JavaFunctionHelper.java
index ed6cc23..e2e694a 100644
--- a/asterix-external-data/src/main/java/edu/uci/ics/asterix/external/library/JavaFunctionHelper.java
+++ b/asterix-external-data/src/main/java/edu/uci/ics/asterix/external/library/JavaFunctionHelper.java
@@ -24,8 +24,8 @@ import edu.uci.ics.asterix.external.library.java.JObjectPointableVisitor;
 import edu.uci.ics.asterix.external.library.java.JTypeTag;
 import edu.uci.ics.asterix.om.functions.IExternalFunctionInfo;
 import edu.uci.ics.asterix.om.pointables.AFlatValuePointable;
-import edu.uci.ics.asterix.om.pointables.AListPointable;
-import edu.uci.ics.asterix.om.pointables.ARecordPointable;
+import edu.uci.ics.asterix.om.pointables.AListVisitablePointable;
+import edu.uci.ics.asterix.om.pointables.ARecordVisitablePointable;
 import edu.uci.ics.asterix.om.pointables.PointableAllocator;
 import edu.uci.ics.asterix.om.pointables.base.IVisitablePointable;
 import edu.uci.ics.asterix.om.types.BuiltinType;
@@ -88,13 +88,13 @@ public class JavaFunctionHelper implements IFunctionHelper {
             case RECORD:
                 pointable = pointableAllocator.allocateRecordValue(type);
                 pointable.set(valueReference);
-                jObject = pointableVisitor.visit((ARecordPointable) pointable, getTypeInfo(index, type));
+                jObject = pointableVisitor.visit((ARecordVisitablePointable) pointable, getTypeInfo(index, type));
                 break;
             case ORDEREDLIST:
             case UNORDEREDLIST:
                 pointable = pointableAllocator.allocateListValue(type);
                 pointable.set(valueReference);
-                jObject = pointableVisitor.visit((AListPointable) pointable, getTypeInfo(index, type));
+                jObject = pointableVisitor.visit((AListVisitablePointable) pointable, getTypeInfo(index, type));
                 break;
             case ANY:
                 throw new IllegalStateException("Cannot handle a function argument of type " + type.getTypeTag());

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-external-data/src/main/java/edu/uci/ics/asterix/external/library/java/IJListAccessor.java
----------------------------------------------------------------------
diff --git a/asterix-external-data/src/main/java/edu/uci/ics/asterix/external/library/java/IJListAccessor.java b/asterix-external-data/src/main/java/edu/uci/ics/asterix/external/library/java/IJListAccessor.java
index f1ae883..71f6ff2 100644
--- a/asterix-external-data/src/main/java/edu/uci/ics/asterix/external/library/java/IJListAccessor.java
+++ b/asterix-external-data/src/main/java/edu/uci/ics/asterix/external/library/java/IJListAccessor.java
@@ -14,13 +14,13 @@
  */
 package edu.uci.ics.asterix.external.library.java;
 
-import edu.uci.ics.asterix.om.pointables.AListPointable;
+import edu.uci.ics.asterix.om.pointables.AListVisitablePointable;
 import edu.uci.ics.asterix.om.types.IAType;
 import edu.uci.ics.asterix.om.util.container.IObjectPool;
 import edu.uci.ics.hyracks.api.exceptions.HyracksDataException;
 
 public interface IJListAccessor {
 
-    IJObject access(AListPointable pointable, IObjectPool<IJObject, IAType> objectPool, IAType listType,
+    IJObject access(AListVisitablePointable pointable, IObjectPool<IJObject, IAType> objectPool, IAType listType,
             JObjectPointableVisitor pointableVisitor) throws HyracksDataException;
 }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-external-data/src/main/java/edu/uci/ics/asterix/external/library/java/IJRecordAccessor.java
----------------------------------------------------------------------
diff --git a/asterix-external-data/src/main/java/edu/uci/ics/asterix/external/library/java/IJRecordAccessor.java b/asterix-external-data/src/main/java/edu/uci/ics/asterix/external/library/java/IJRecordAccessor.java
index 54b8726..1e3d692 100644
--- a/asterix-external-data/src/main/java/edu/uci/ics/asterix/external/library/java/IJRecordAccessor.java
+++ b/asterix-external-data/src/main/java/edu/uci/ics/asterix/external/library/java/IJRecordAccessor.java
@@ -15,7 +15,7 @@
 package edu.uci.ics.asterix.external.library.java;
 
 import edu.uci.ics.asterix.external.library.java.JObjects.JRecord;
-import edu.uci.ics.asterix.om.pointables.ARecordPointable;
+import edu.uci.ics.asterix.om.pointables.ARecordVisitablePointable;
 import edu.uci.ics.asterix.om.types.ARecordType;
 import edu.uci.ics.asterix.om.types.IAType;
 import edu.uci.ics.asterix.om.util.container.IObjectPool;
@@ -23,7 +23,7 @@ import edu.uci.ics.hyracks.api.exceptions.HyracksDataException;
 
 public interface IJRecordAccessor {
 
-    public JRecord access(ARecordPointable pointable, IObjectPool<IJObject, IAType> objectPool, ARecordType recordType,
+    public JRecord access(ARecordVisitablePointable pointable, IObjectPool<IJObject, IAType> objectPool, ARecordType recordType,
             JObjectPointableVisitor pointableVisitor) throws HyracksDataException;
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-external-data/src/main/java/edu/uci/ics/asterix/external/library/java/JObjectAccessors.java
----------------------------------------------------------------------
diff --git a/asterix-external-data/src/main/java/edu/uci/ics/asterix/external/library/java/JObjectAccessors.java b/asterix-external-data/src/main/java/edu/uci/ics/asterix/external/library/java/JObjectAccessors.java
index 084dd8e..c2e4cf3 100644
--- a/asterix-external-data/src/main/java/edu/uci/ics/asterix/external/library/java/JObjectAccessors.java
+++ b/asterix-external-data/src/main/java/edu/uci/ics/asterix/external/library/java/JObjectAccessors.java
@@ -16,7 +16,6 @@ package edu.uci.ics.asterix.external.library.java;
 
 import java.io.ByteArrayInputStream;
 import java.io.DataInputStream;
-import java.io.UnsupportedEncodingException;
 import java.util.LinkedHashMap;
 import java.util.List;
 
@@ -72,8 +71,8 @@ import edu.uci.ics.asterix.om.base.APoint3D;
 import edu.uci.ics.asterix.om.base.APolygon;
 import edu.uci.ics.asterix.om.base.ARectangle;
 import edu.uci.ics.asterix.om.pointables.AFlatValuePointable;
-import edu.uci.ics.asterix.om.pointables.AListPointable;
-import edu.uci.ics.asterix.om.pointables.ARecordPointable;
+import edu.uci.ics.asterix.om.pointables.AListVisitablePointable;
+import edu.uci.ics.asterix.om.pointables.ARecordVisitablePointable;
 import edu.uci.ics.asterix.om.pointables.base.IVisitablePointable;
 import edu.uci.ics.asterix.om.types.ARecordType;
 import edu.uci.ics.asterix.om.types.ATypeTag;
@@ -448,14 +447,14 @@ public class JObjectAccessors {
         }
 
         @Override
-        public JRecord access(ARecordPointable pointable, IObjectPool<IJObject, IAType> objectPool,
+        public JRecord access(ARecordVisitablePointable pointable, IObjectPool<IJObject, IAType> objectPool,
                 ARecordType recordType, JObjectPointableVisitor pointableVisitor) throws HyracksDataException {
             try {
                 jRecord.reset();
             } catch (AlgebricksException e) {
                 throw new HyracksDataException(e);
             }
-            ARecordPointable recordPointable = (ARecordPointable) pointable;
+            ARecordVisitablePointable recordPointable = (ARecordVisitablePointable) pointable;
             List<IVisitablePointable> fieldPointables = recordPointable.getFieldValues();
             List<IVisitablePointable> fieldTypeTags = recordPointable.getFieldTypeTags();
             List<IVisitablePointable> fieldNames = recordPointable.getFieldNames();
@@ -473,7 +472,7 @@ public class JObjectAccessors {
                     typeInfo.reset(fieldType, typeTag);
                     switch (typeTag) {
                         case RECORD:
-                            fieldObject = pointableVisitor.visit((ARecordPointable) fieldPointable, typeInfo);
+                            fieldObject = pointableVisitor.visit((ARecordVisitablePointable) fieldPointable, typeInfo);
                             break;
                         case ORDEREDLIST:
                         case UNORDEREDLIST:
@@ -481,7 +480,7 @@ public class JObjectAccessors {
                                 // value is null
                                 fieldObject = null;
                             } else {
-                                fieldObject = pointableVisitor.visit((AListPointable) fieldPointable, typeInfo);
+                                fieldObject = pointableVisitor.visit((AListVisitablePointable) fieldPointable, typeInfo);
                             }
                             break;
                         case ANY:
@@ -530,7 +529,7 @@ public class JObjectAccessors {
         }
 
         @Override
-        public IJObject access(AListPointable pointable, IObjectPool<IJObject, IAType> objectPool, IAType listType,
+        public IJObject access(AListVisitablePointable pointable, IObjectPool<IJObject, IAType> objectPool, IAType listType,
                 JObjectPointableVisitor pointableVisitor) throws HyracksDataException {
             List<IVisitablePointable> items = pointable.getItems();
             List<IVisitablePointable> itemTags = pointable.getItemTags();
@@ -546,11 +545,11 @@ public class JObjectAccessors {
                     typeInfo.reset(listType.getType(), listType.getTypeTag());
                     switch (itemTypeTag) {
                         case RECORD:
-                            listItem = pointableVisitor.visit((ARecordPointable) itemPointable, typeInfo);
+                            listItem = pointableVisitor.visit((ARecordVisitablePointable) itemPointable, typeInfo);
                             break;
                         case UNORDEREDLIST:
                         case ORDEREDLIST:
-                            listItem = pointableVisitor.visit((AListPointable) itemPointable, typeInfo);
+                            listItem = pointableVisitor.visit((AListVisitablePointable) itemPointable, typeInfo);
                             break;
                         case ANY:
                             throw new IllegalArgumentException("Cannot parse list item of type "

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-external-data/src/main/java/edu/uci/ics/asterix/external/library/java/JObjectPointableVisitor.java
----------------------------------------------------------------------
diff --git a/asterix-external-data/src/main/java/edu/uci/ics/asterix/external/library/java/JObjectPointableVisitor.java b/asterix-external-data/src/main/java/edu/uci/ics/asterix/external/library/java/JObjectPointableVisitor.java
index cceec85..20d7c28 100644
--- a/asterix-external-data/src/main/java/edu/uci/ics/asterix/external/library/java/JObjectPointableVisitor.java
+++ b/asterix-external-data/src/main/java/edu/uci/ics/asterix/external/library/java/JObjectPointableVisitor.java
@@ -22,8 +22,8 @@ import edu.uci.ics.asterix.external.library.TypeInfo;
 import edu.uci.ics.asterix.external.library.java.JObjectAccessors.JListAccessor;
 import edu.uci.ics.asterix.external.library.java.JObjectAccessors.JRecordAccessor;
 import edu.uci.ics.asterix.om.pointables.AFlatValuePointable;
-import edu.uci.ics.asterix.om.pointables.AListPointable;
-import edu.uci.ics.asterix.om.pointables.ARecordPointable;
+import edu.uci.ics.asterix.om.pointables.AListVisitablePointable;
+import edu.uci.ics.asterix.om.pointables.ARecordVisitablePointable;
 import edu.uci.ics.asterix.om.pointables.base.IVisitablePointable;
 import edu.uci.ics.asterix.om.pointables.visitor.IVisitablePointableVisitor;
 import edu.uci.ics.asterix.om.types.ARecordType;
@@ -37,7 +37,7 @@ public class JObjectPointableVisitor implements IVisitablePointableVisitor<IJObj
     private final Map<IVisitablePointable, IJListAccessor> laccessorToPrinter = new HashMap<IVisitablePointable, IJListAccessor>();
 
     @Override
-    public IJObject visit(AListPointable accessor, TypeInfo arg) throws AsterixException {
+    public IJObject visit(AListVisitablePointable accessor, TypeInfo arg) throws AsterixException {
         IJObject result = null;
         IJListAccessor jListAccessor = laccessorToPrinter.get(accessor);
         if (jListAccessor == null) {
@@ -53,7 +53,7 @@ public class JObjectPointableVisitor implements IVisitablePointableVisitor<IJObj
     }
 
     @Override
-    public IJObject visit(ARecordPointable accessor, TypeInfo arg) throws AsterixException {
+    public IJObject visit(ARecordVisitablePointable accessor, TypeInfo arg) throws AsterixException {
         IJObject result = null;
         IJRecordAccessor jRecordAccessor = raccessorToJObject.get(accessor);
         if (jRecordAccessor == null) {

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/declared/PKGeneratingAdapter.java
----------------------------------------------------------------------
diff --git a/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/declared/PKGeneratingAdapter.java b/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/declared/PKGeneratingAdapter.java
index 862092a..9f78b37 100644
--- a/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/declared/PKGeneratingAdapter.java
+++ b/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/declared/PKGeneratingAdapter.java
@@ -21,7 +21,7 @@ import edu.uci.ics.asterix.builders.RecordBuilder;
 import edu.uci.ics.asterix.common.feeds.api.IDatasourceAdapter;
 import edu.uci.ics.asterix.om.base.AMutableUUID;
 import edu.uci.ics.asterix.om.base.AUUID;
-import edu.uci.ics.asterix.om.pointables.ARecordPointable;
+import edu.uci.ics.asterix.om.pointables.ARecordVisitablePointable;
 import edu.uci.ics.asterix.om.pointables.PointableAllocator;
 import edu.uci.ics.asterix.om.pointables.base.IVisitablePointable;
 import edu.uci.ics.asterix.om.types.ARecordType;
@@ -75,7 +75,7 @@ public class PKGeneratingAdapter implements IDatasourceAdapter {
         private final byte AUUIDTag = ATypeTag.UUID.serialize();
         private final byte[] serializedUUID = new byte[16];
         private final PointableAllocator pa = new PointableAllocator();
-        private final ARecordPointable recordPointable;
+        private final ARecordVisitablePointable recordPointable;
         private final IAType[] outClosedTypes;
 
         private final RecordBuilder recBuilder;
@@ -85,7 +85,7 @@ public class PKGeneratingAdapter implements IDatasourceAdapter {
             this.outRecType = outRecType;
             this.tb = new ArrayTupleBuilder(2);
             this.recBuilder = new RecordBuilder();
-            this.recordPointable = (ARecordPointable) pa.allocateRecordValue(inRecType);
+            this.recordPointable = (ARecordVisitablePointable) pa.allocateRecordValue(inRecType);
             this.outClosedTypes = outRecType.getFieldTypes();
         }
 

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-om/src/main/java/edu/uci/ics/asterix/builders/AbvsBuilderFactory.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/builders/AbvsBuilderFactory.java b/asterix-om/src/main/java/edu/uci/ics/asterix/builders/AbvsBuilderFactory.java
new file mode 100644
index 0000000..9d0e434
--- /dev/null
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/builders/AbvsBuilderFactory.java
@@ -0,0 +1,27 @@
+/*
+ * Copyright 2009-2013 by The Regents of the University of California
+ * Licensed 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 from
+ * 
+ *     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.
+ */
+package edu.uci.ics.asterix.builders;
+
+import edu.uci.ics.asterix.om.util.container.IObjectFactory;
+import edu.uci.ics.hyracks.data.std.api.IMutableValueStorage;
+import edu.uci.ics.hyracks.data.std.util.ArrayBackedValueStorage;
+
+public class AbvsBuilderFactory implements IObjectFactory<IMutableValueStorage, String> {
+
+    @Override
+    public IMutableValueStorage create(String type) {
+        return new ArrayBackedValueStorage();
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-om/src/main/java/edu/uci/ics/asterix/builders/ListBuilderFactory.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/builders/ListBuilderFactory.java b/asterix-om/src/main/java/edu/uci/ics/asterix/builders/ListBuilderFactory.java
new file mode 100644
index 0000000..da098e5
--- /dev/null
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/builders/ListBuilderFactory.java
@@ -0,0 +1,29 @@
+/*
+ * Copyright 2009-2013 by The Regents of the University of California
+ * Licensed 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 from
+ * 
+ *     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.
+ */
+package edu.uci.ics.asterix.builders;
+
+import edu.uci.ics.asterix.om.util.container.IObjectFactory;
+
+public class ListBuilderFactory implements IObjectFactory<IAsterixListBuilder, String> {
+
+    @Override
+    public IAsterixListBuilder create(String type) {
+        if (type.equals("ordered")) {
+            return new OrderedListBuilder();
+        } else {
+            return new UnorderedListBuilder();
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-om/src/main/java/edu/uci/ics/asterix/builders/RecordBuilderFactory.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/builders/RecordBuilderFactory.java b/asterix-om/src/main/java/edu/uci/ics/asterix/builders/RecordBuilderFactory.java
new file mode 100644
index 0000000..55ab2d0
--- /dev/null
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/builders/RecordBuilderFactory.java
@@ -0,0 +1,25 @@
+/*
+ * Copyright 2009-2013 by The Regents of the University of California
+ * Licensed 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 from
+ * 
+ *     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.
+ */
+package edu.uci.ics.asterix.builders;
+
+import edu.uci.ics.asterix.om.util.container.IObjectFactory;
+
+public class RecordBuilderFactory implements IObjectFactory<IARecordBuilder, String> {
+
+    @Override
+    public IARecordBuilder create(String type) {
+        return new RecordBuilder();
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/ADatePrinter.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/ADatePrinter.java b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/ADatePrinter.java
index 545cfb2..b6eca48 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/ADatePrinter.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/ADatePrinter.java
@@ -36,14 +36,8 @@ public class ADatePrinter implements IPrinter {
 
     @Override
     public void print(byte[] b, int s, int l, PrintStream ps) throws AlgebricksException {
-        long chrononTime = AInt32SerializerDeserializer.getInt(b, s + 1) * CHRONON_OF_DAY;
-
         ps.print("date(\"");
-        try {
-            gCalInstance.getExtendStringRepUntilField(chrononTime, 0, ps, Fields.YEAR, Fields.DAY, false);
-        } catch (IOException e) {
-            throw new AlgebricksException(e);
-        }
+        printString(b, s, l, ps);
         ps.print("\")");
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/ADateTimePrinter.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/ADateTimePrinter.java b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/ADateTimePrinter.java
index cd7a2fb..bede764 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/ADateTimePrinter.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/ADateTimePrinter.java
@@ -35,16 +35,8 @@ public class ADateTimePrinter implements IPrinter {
 
     @Override
     public void print(byte[] b, int s, int l, PrintStream ps) throws AlgebricksException {
-        long chrononTime = AInt64SerializerDeserializer.getLong(b, s + 1);
-
         ps.print("datetime(\"");
-
-        try {
-            gCalInstance.getExtendStringRepUntilField(chrononTime, 0, ps, Fields.YEAR, Fields.MILLISECOND, true);
-        } catch (IOException e) {
-            throw new AlgebricksException(e);
-        }
-
+        printString(b, s, l, ps);
         ps.print("\")");
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/ADayTimeDurationPrinter.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/ADayTimeDurationPrinter.java b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/ADayTimeDurationPrinter.java
index 558c49f..99e076a 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/ADayTimeDurationPrinter.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/ADayTimeDurationPrinter.java
@@ -30,7 +30,6 @@ public class ADayTimeDurationPrinter implements IPrinter {
 
     @Override
     public void init() throws AlgebricksException {
-        // TODO Auto-generated method stub
 
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/AObjectPrinter.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/AObjectPrinter.java b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/AObjectPrinter.java
index 5a96e52..aeb325f 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/AObjectPrinter.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/AObjectPrinter.java
@@ -115,6 +115,10 @@ public class AObjectPrinter implements IPrinter {
                 APolygonPrinter.INSTANCE.print(b, s, l, ps);
                 break;
             }
+            case RECTANGLE: {
+                ARectanglePrinter.INSTANCE.print(b, s, l, ps);
+                break;
+            }
             case CIRCLE: {
                 ACirclePrinter.INSTANCE.print(b, s, l, ps);
                 break;
@@ -150,9 +154,20 @@ public class AObjectPrinter implements IPrinter {
                 ShortWithoutTypeInfoPrinter.INSTANCE.print(b, s, l, ps);
                 break;
             }
-            default: {
+            case ANY:
+            case BITARRAY:
+            case ENUM:
+            case SPARSERECORD:
+            case SYSTEM_NULL:
+            case TYPE:
+            case UINT16:
+            case UINT32:
+            case UINT64:
+            case UINT8:
+            case UNION:
+            case UUID_STRING:
+                // These are internal types and do not need a printer.
                 throw new NotImplementedException("No printer for type " + typeTag);
-            }
         }
     }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/ATimePrinter.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/ATimePrinter.java b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/ATimePrinter.java
index 618b17a..8a2e179 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/ATimePrinter.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/ATimePrinter.java
@@ -35,16 +35,8 @@ public class ATimePrinter implements IPrinter {
 
     @Override
     public void print(byte[] b, int s, int l, PrintStream ps) throws AlgebricksException {
-        int time = AInt32SerializerDeserializer.getInt(b, s + 1);
-
         ps.print("time(\"");
-
-        try {
-            gCalInstance.getExtendStringRepUntilField(time, 0, ps, Fields.HOUR, Fields.MILLISECOND, true);
-        } catch (IOException e) {
-            throw new AlgebricksException(e);
-        }
-
+        printString(b,s,l, ps);
         ps.print("\")");
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/PrintTools.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/PrintTools.java b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/PrintTools.java
index e4b8441..53cbe6d 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/PrintTools.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/PrintTools.java
@@ -14,12 +14,11 @@
  */
 package edu.uci.ics.asterix.dataflow.data.nontagged.printers;
 
-import edu.uci.ics.hyracks.data.std.primitive.UTF8StringPointable;
-
-import javax.xml.bind.DatatypeConverter;
 import java.io.IOException;
 import java.io.OutputStream;
 
+import edu.uci.ics.hyracks.data.std.primitive.UTF8StringPointable;
+
 public class PrintTools {
     public static enum CASE {
         LOWER_CASE,

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/csv/ADatePrinter.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/csv/ADatePrinter.java b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/csv/ADatePrinter.java
index 37af669..a63b0bc 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/csv/ADatePrinter.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/csv/ADatePrinter.java
@@ -16,7 +16,6 @@ package edu.uci.ics.asterix.dataflow.data.nontagged.printers.csv;
 
 import java.io.PrintStream;
 
-import edu.uci.ics.asterix.dataflow.data.nontagged.serde.AInt32SerializerDeserializer;
 import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
 import edu.uci.ics.hyracks.algebricks.data.IPrinter;
 

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/csv/ADateTimePrinter.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/csv/ADateTimePrinter.java b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/csv/ADateTimePrinter.java
index e90c586..1cbafcb 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/csv/ADateTimePrinter.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/csv/ADateTimePrinter.java
@@ -16,7 +16,6 @@ package edu.uci.ics.asterix.dataflow.data.nontagged.printers.csv;
 
 import java.io.PrintStream;
 
-import edu.uci.ics.asterix.dataflow.data.nontagged.serde.AInt64SerializerDeserializer;
 import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
 import edu.uci.ics.hyracks.algebricks.data.IPrinter;
 

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/csv/AIntervalPrinter.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/csv/AIntervalPrinter.java b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/csv/AIntervalPrinter.java
index c1793c9..7080b16 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/csv/AIntervalPrinter.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/csv/AIntervalPrinter.java
@@ -16,8 +16,6 @@ package edu.uci.ics.asterix.dataflow.data.nontagged.printers.csv;
 
 import java.io.PrintStream;
 
-import edu.uci.ics.asterix.dataflow.data.nontagged.serde.AInt8SerializerDeserializer;
-import edu.uci.ics.asterix.om.types.ATypeTag;
 import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
 import edu.uci.ics.hyracks.algebricks.data.IPrinter;
 

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/csv/AObjectPrinter.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/csv/AObjectPrinter.java b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/csv/AObjectPrinter.java
index dbf6729..8b543da 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/csv/AObjectPrinter.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/csv/AObjectPrinter.java
@@ -93,6 +93,9 @@ public class AObjectPrinter implements IPrinter {
                 ADayTimeDurationPrinter.INSTANCE.print(b, s, l, ps);
                 break;
             }
+            case INTERVAL:
+                AIntervalPrinter.INSTANCE.print(b, s, l, ps);
+                break;
             case POINT: {
                 APointPrinter.INSTANCE.print(b, s, l, ps);
                 break;
@@ -113,6 +116,9 @@ public class AObjectPrinter implements IPrinter {
                 ACirclePrinter.INSTANCE.print(b, s, l, ps);
                 break;
             }
+            case RECTANGLE:
+                ARectanglePrinter.INSTANCE.print(b, s, l, ps);
+                break;
             case STRING: {
                 AStringPrinter.INSTANCE.print(b, s, l, ps);
                 break;
@@ -122,9 +128,24 @@ public class AObjectPrinter implements IPrinter {
                 recordPrinter.print(b, s, l, ps);
                 break;
             }
-            default: {
+            case ANY:
+            case BINARY:
+            case BITARRAY:
+            case ENUM:
+            case ORDEREDLIST:
+            case SHORTWITHOUTTYPEINFO:
+            case SPARSERECORD:
+            case SYSTEM_NULL:
+            case TYPE:
+            case UINT16:
+            case UINT32:
+            case UINT64:
+            case UINT8:
+            case UNION:
+            case UNORDEREDLIST:
+            case UUID:
+            case UUID_STRING:
                 throw new NotImplementedException("No printer for type " + typeTag);
-            }
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/ADayTimeDurationPrinter.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/ADayTimeDurationPrinter.java b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/ADayTimeDurationPrinter.java
index 50f994f..bd5c69c 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/ADayTimeDurationPrinter.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/ADayTimeDurationPrinter.java
@@ -26,7 +26,6 @@ public class ADayTimeDurationPrinter implements IPrinter {
 
     @Override
     public void init() throws AlgebricksException {
-        // TODO Auto-generated method stub
 
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/ADurationPrinter.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/ADurationPrinter.java b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/ADurationPrinter.java
index 01850bc..58e83ec 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/ADurationPrinter.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/ADurationPrinter.java
@@ -38,7 +38,7 @@ public class ADurationPrinter implements IPrinter {
         ps.print("{ \"duration\": { ");
         ps.print("\"months\": ");
         ps.print(months);
-        ps.print("\"millis\": ");
+        ps.print(", \"millis\": ");
         ps.print(milliseconds);
         ps.print("} }");
     }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/AObjectPrinter.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/AObjectPrinter.java b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/AObjectPrinter.java
index 7c38a34..85cbcfb 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/AObjectPrinter.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/AObjectPrinter.java
@@ -96,7 +96,11 @@ public class AObjectPrinter implements IPrinter {
                 ADayTimeDurationPrinter.INSTANCE.print(b, s, l, ps);
                 break;
             }
-            case POINT: {
+            case INTERVAL: {
+                AIntervalPrinter.INSTANCE.print(b, s, l, ps);
+                break;
+            }
+             case POINT: {
                 APointPrinter.INSTANCE.print(b, s, l, ps);
                 break;
             }
@@ -116,6 +120,10 @@ public class AObjectPrinter implements IPrinter {
                 ACirclePrinter.INSTANCE.print(b, s, l, ps);
                 break;
             }
+            case RECTANGLE: {
+                ARectanglePrinter.INSTANCE.print(b, s, l, ps);
+                break;
+            }
             case STRING: {
                 AStringPrinter.INSTANCE.print(b, s, l, ps);
                 break;
@@ -139,9 +147,21 @@ public class AObjectPrinter implements IPrinter {
                 unorderedListPrinter.print(b, s, l, ps);
                 break;
             }
-            default: {
+            case ANY:
+            case BITARRAY:
+            case ENUM:
+            case SHORTWITHOUTTYPEINFO:
+            case SPARSERECORD:
+            case SYSTEM_NULL:
+            case TYPE:
+            case UINT16:
+            case UINT32:
+            case UINT64:
+            case UINT8:
+            case UNION:
+            case UUID:
+            case UUID_STRING:
                 throw new NotImplementedException("No printer for type " + typeTag);
-            }
         }
     }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-om/src/main/java/edu/uci/ics/asterix/formats/nontagged/AqlCSVPrinterFactoryProvider.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/formats/nontagged/AqlCSVPrinterFactoryProvider.java b/asterix-om/src/main/java/edu/uci/ics/asterix/formats/nontagged/AqlCSVPrinterFactoryProvider.java
index 371aa5d..2f120cc 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/formats/nontagged/AqlCSVPrinterFactoryProvider.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/formats/nontagged/AqlCSVPrinterFactoryProvider.java
@@ -28,6 +28,7 @@ import edu.uci.ics.asterix.dataflow.data.nontagged.printers.csv.AInt16PrinterFac
 import edu.uci.ics.asterix.dataflow.data.nontagged.printers.csv.AInt32PrinterFactory;
 import edu.uci.ics.asterix.dataflow.data.nontagged.printers.csv.AInt64PrinterFactory;
 import edu.uci.ics.asterix.dataflow.data.nontagged.printers.csv.AInt8PrinterFactory;
+import edu.uci.ics.asterix.dataflow.data.nontagged.printers.csv.AIntervalPrinterFactory;
 import edu.uci.ics.asterix.dataflow.data.nontagged.printers.csv.ALinePrinterFactory;
 import edu.uci.ics.asterix.dataflow.data.nontagged.printers.csv.ANullPrinterFactory;
 import edu.uci.ics.asterix.dataflow.data.nontagged.printers.csv.ANullableFieldPrinterFactory;
@@ -62,8 +63,6 @@ public class AqlCSVPrinterFactoryProvider implements IPrinterFactoryProvider {
 
         if (aqlType != null) {
             switch (aqlType.getTypeTag()) {
-            // case ANYTYPE:
-            // return AAnyTypePrinterFactory.INSTANCE;
                 case INT8:
                     return AInt8PrinterFactory.INSTANCE;
                 case INT16:
@@ -92,6 +91,8 @@ public class AqlCSVPrinterFactoryProvider implements IPrinterFactoryProvider {
                     return AYearMonthDurationPrinterFactory.INSTANCE;
                 case DAYTIMEDURATION:
                     return ADayTimeDurationPrinterFactory.INSTANCE;
+                case INTERVAL:
+                    return AIntervalPrinterFactory.INSTANCE;
                 case POINT:
                     return APointPrinterFactory.INSTANCE;
                 case POINT3D:
@@ -123,6 +124,20 @@ public class AqlCSVPrinterFactoryProvider implements IPrinterFactoryProvider {
                 }
                 case SHORTWITHOUTTYPEINFO:
                     return ShortWithoutTypeInfoPrinterFactory.INSTANCE;
+                case ANY:
+                case BINARY:
+                case BITARRAY:
+                case ENUM:
+                case SPARSERECORD:
+                case SYSTEM_NULL:
+                case TYPE:
+                case UINT16:
+                case UINT32:
+                case UINT64:
+                case UINT8:
+                case UUID_STRING:
+                    // These types are not intended to be printed to the user.
+                    break;
             }
         }
         return AObjectPrinterFactory.INSTANCE;

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-om/src/main/java/edu/uci/ics/asterix/formats/nontagged/AqlJSONPrinterFactoryProvider.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/formats/nontagged/AqlJSONPrinterFactoryProvider.java b/asterix-om/src/main/java/edu/uci/ics/asterix/formats/nontagged/AqlJSONPrinterFactoryProvider.java
index 9ae9dbc..15bab45 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/formats/nontagged/AqlJSONPrinterFactoryProvider.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/formats/nontagged/AqlJSONPrinterFactoryProvider.java
@@ -29,6 +29,7 @@ import edu.uci.ics.asterix.dataflow.data.nontagged.printers.json.AInt16PrinterFa
 import edu.uci.ics.asterix.dataflow.data.nontagged.printers.json.AInt32PrinterFactory;
 import edu.uci.ics.asterix.dataflow.data.nontagged.printers.json.AInt64PrinterFactory;
 import edu.uci.ics.asterix.dataflow.data.nontagged.printers.json.AInt8PrinterFactory;
+import edu.uci.ics.asterix.dataflow.data.nontagged.printers.json.AIntervalPrinterFactory;
 import edu.uci.ics.asterix.dataflow.data.nontagged.printers.json.ALinePrinterFactory;
 import edu.uci.ics.asterix.dataflow.data.nontagged.printers.json.ANullPrinterFactory;
 import edu.uci.ics.asterix.dataflow.data.nontagged.printers.json.ANullableFieldPrinterFactory;
@@ -67,8 +68,6 @@ public class AqlJSONPrinterFactoryProvider implements IPrinterFactoryProvider {
 
         if (aqlType != null) {
             switch (aqlType.getTypeTag()) {
-            // case ANYTYPE:
-            // return AAnyTypePrinterFactory.INSTANCE;
                 case INT8:
                     return AInt8PrinterFactory.INSTANCE;
                 case INT16:
@@ -97,6 +96,8 @@ public class AqlJSONPrinterFactoryProvider implements IPrinterFactoryProvider {
                     return AYearMonthDurationPrinterFactory.INSTANCE;
                 case DAYTIMEDURATION:
                     return ADayTimeDurationPrinterFactory.INSTANCE;
+                case INTERVAL:
+                    return AIntervalPrinterFactory.INSTANCE;
                 case POINT:
                     return APointPrinterFactory.INSTANCE;
                 case POINT3D:
@@ -130,9 +131,21 @@ public class AqlJSONPrinterFactoryProvider implements IPrinterFactoryProvider {
                 }
                 case SHORTWITHOUTTYPEINFO:
                     return ShortWithoutTypeInfoPrinterFactory.INSTANCE;
+                case ANY:
+                case BITARRAY:
+                case ENUM:
+                case SPARSERECORD:
+                case SYSTEM_NULL:
+                case TYPE:
+                case UINT16:
+                case UINT32:
+                case UINT64:
+                case UINT8:
+                case UUID_STRING:
+                    // These types are not intended to be printed to the user.
+                    break;
             }
         }
         return AObjectPrinterFactory.INSTANCE;
-
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-om/src/main/java/edu/uci/ics/asterix/formats/nontagged/AqlPrinterFactoryProvider.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/formats/nontagged/AqlPrinterFactoryProvider.java b/asterix-om/src/main/java/edu/uci/ics/asterix/formats/nontagged/AqlPrinterFactoryProvider.java
index bf941d0..24a0561 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/formats/nontagged/AqlPrinterFactoryProvider.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/formats/nontagged/AqlPrinterFactoryProvider.java
@@ -19,6 +19,7 @@ import edu.uci.ics.asterix.dataflow.data.nontagged.printers.ABooleanPrinterFacto
 import edu.uci.ics.asterix.dataflow.data.nontagged.printers.ACirclePrinterFactory;
 import edu.uci.ics.asterix.dataflow.data.nontagged.printers.ADatePrinterFactory;
 import edu.uci.ics.asterix.dataflow.data.nontagged.printers.ADateTimePrinterFactory;
+import edu.uci.ics.asterix.dataflow.data.nontagged.printers.ADayTimeDurationPrinterFactory;
 import edu.uci.ics.asterix.dataflow.data.nontagged.printers.ADoublePrinterFactory;
 import edu.uci.ics.asterix.dataflow.data.nontagged.printers.ADurationPrinterFactory;
 import edu.uci.ics.asterix.dataflow.data.nontagged.printers.AFloatPrinterFactory;
@@ -42,6 +43,7 @@ import edu.uci.ics.asterix.dataflow.data.nontagged.printers.ATimePrinterFactory;
 import edu.uci.ics.asterix.dataflow.data.nontagged.printers.AUUIDPrinterFactory;
 import edu.uci.ics.asterix.dataflow.data.nontagged.printers.AUnionPrinterFactory;
 import edu.uci.ics.asterix.dataflow.data.nontagged.printers.AUnorderedlistPrinterFactory;
+import edu.uci.ics.asterix.dataflow.data.nontagged.printers.AYearMonthDurationPrinterFactory;
 import edu.uci.ics.asterix.dataflow.data.nontagged.printers.ShortWithoutTypeInfoPrinterFactory;
 import edu.uci.ics.asterix.om.types.AOrderedListType;
 import edu.uci.ics.asterix.om.types.ARecordType;
@@ -66,8 +68,6 @@ public class AqlPrinterFactoryProvider implements IPrinterFactoryProvider {
 
         if (aqlType != null) {
             switch (aqlType.getTypeTag()) {
-                // case ANYTYPE:
-                // return AAnyTypePrinterFactory.INSTANCE;
                 case INT8:
                     return AInt8PrinterFactory.INSTANCE;
                 case INT16:
@@ -92,6 +92,10 @@ public class AqlPrinterFactoryProvider implements IPrinterFactoryProvider {
                     return ADateTimePrinterFactory.INSTANCE;
                 case DURATION:
                     return ADurationPrinterFactory.INSTANCE;
+                case DAYTIMEDURATION:
+                    return ADayTimeDurationPrinterFactory.INSTANCE;
+                case YEARMONTHDURATION:
+                    return AYearMonthDurationPrinterFactory.INSTANCE;
                 case INTERVAL:
                     return AIntervalPrinterFactory.INSTANCE;
                 case POINT:
@@ -127,6 +131,19 @@ public class AqlPrinterFactoryProvider implements IPrinterFactoryProvider {
                 }
                 case SHORTWITHOUTTYPEINFO:
                     return ShortWithoutTypeInfoPrinterFactory.INSTANCE;
+                case ANY:
+                case BITARRAY:
+                case ENUM:
+                case SPARSERECORD:
+                case SYSTEM_NULL:
+                case TYPE:
+                case UINT16:
+                case UINT32:
+                case UINT64:
+                case UINT8:
+                case UUID_STRING:
+                    // These types are not intended to be printed to the user.
+                    break;
             }
         }
         return AObjectPrinterFactory.INSTANCE;


[2/9] incubator-asterixdb git commit: Adding introspection for getting record details.

Posted by im...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/records/FieldAccessByIndexDescriptor.java
----------------------------------------------------------------------
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/records/FieldAccessByIndexDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/records/FieldAccessByIndexDescriptor.java
new file mode 100644
index 0000000..072edac
--- /dev/null
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/records/FieldAccessByIndexDescriptor.java
@@ -0,0 +1,50 @@
+/*
+ * Copyright 2009-2013 by The Regents of the University of California
+ * Licensed 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 from
+ *
+ *     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.
+ */
+package edu.uci.ics.asterix.runtime.evaluators.functions.records;
+
+import edu.uci.ics.asterix.om.functions.AsterixBuiltinFunctions;
+import edu.uci.ics.asterix.om.functions.IFunctionDescriptor;
+import edu.uci.ics.asterix.om.functions.IFunctionDescriptorFactory;
+import edu.uci.ics.asterix.om.types.ARecordType;
+import edu.uci.ics.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
+import edu.uci.ics.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+
+public class FieldAccessByIndexDescriptor extends AbstractScalarFunctionDynamicDescriptor {
+
+    private static final long serialVersionUID = 1L;
+    public static final IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() {
+        public IFunctionDescriptor createFunctionDescriptor() {
+            return new FieldAccessByIndexDescriptor();
+        }
+    };
+
+    private ARecordType recType;
+
+    public void reset(ARecordType recType) {
+        this.recType = recType;
+    }
+
+    @Override
+    public FunctionIdentifier getIdentifier() {
+        return AsterixBuiltinFunctions.FIELD_ACCESS_BY_INDEX;
+    }
+
+    @Override
+    public ICopyEvaluatorFactory createEvaluatorFactory(ICopyEvaluatorFactory[] args) {
+        return new FieldAccessByIndexEvalFactory(args[0], args[1], recType);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/records/FieldAccessByIndexEvalFactory.java
----------------------------------------------------------------------
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/records/FieldAccessByIndexEvalFactory.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/records/FieldAccessByIndexEvalFactory.java
new file mode 100644
index 0000000..2b9f666
--- /dev/null
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/records/FieldAccessByIndexEvalFactory.java
@@ -0,0 +1,138 @@
+/*
+ * Copyright 2009-2013 by The Regents of the University of California
+ * Licensed 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 from
+ *
+ *     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.
+ */
+package edu.uci.ics.asterix.runtime.evaluators.functions.records;
+
+import java.io.DataOutput;
+import java.io.IOException;
+
+import edu.uci.ics.asterix.common.exceptions.AsterixException;
+import edu.uci.ics.asterix.dataflow.data.nontagged.serde.ARecordSerializerDeserializer;
+import edu.uci.ics.asterix.formats.nontagged.AqlSerializerDeserializerProvider;
+import edu.uci.ics.asterix.om.base.ANull;
+import edu.uci.ics.asterix.om.types.ARecordType;
+import edu.uci.ics.asterix.om.types.ATypeTag;
+import edu.uci.ics.asterix.om.types.AUnionType;
+import edu.uci.ics.asterix.om.types.BuiltinType;
+import edu.uci.ics.asterix.om.types.EnumDeserializer;
+import edu.uci.ics.asterix.om.types.IAType;
+import edu.uci.ics.asterix.om.util.NonTaggedFormatUtil;
+import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
+import edu.uci.ics.hyracks.algebricks.common.exceptions.NotImplementedException;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluator;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import edu.uci.ics.hyracks.api.dataflow.value.ISerializerDeserializer;
+import edu.uci.ics.hyracks.data.std.api.IDataOutputProvider;
+import edu.uci.ics.hyracks.data.std.primitive.IntegerPointable;
+import edu.uci.ics.hyracks.data.std.util.ArrayBackedValueStorage;
+import edu.uci.ics.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
+
+public class FieldAccessByIndexEvalFactory implements ICopyEvaluatorFactory {
+
+    private static final long serialVersionUID = 1L;
+
+    private ICopyEvaluatorFactory recordEvalFactory;
+    private ICopyEvaluatorFactory fieldIndexEvalFactory;
+    private int nullBitmapSize;
+    private ARecordType recordType;
+    private final static byte SER_NULL_TYPE_TAG = ATypeTag.NULL.serialize();
+    private final static byte SER_RECORD_TYPE_TAG = ATypeTag.RECORD.serialize();
+
+    public FieldAccessByIndexEvalFactory(ICopyEvaluatorFactory recordEvalFactory,
+            ICopyEvaluatorFactory fieldIndexEvalFactory, ARecordType recordType) {
+        this.recordEvalFactory = recordEvalFactory;
+        this.fieldIndexEvalFactory = fieldIndexEvalFactory;
+        this.recordType = recordType;
+        this.nullBitmapSize = ARecordType.computeNullBitmapSize(recordType);
+
+    }
+
+    @Override
+    public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
+        return new ICopyEvaluator() {
+
+            private DataOutput out = output.getDataOutput();
+
+            private ArrayBackedValueStorage outInput0 = new ArrayBackedValueStorage();
+            private ArrayBackedValueStorage outInput1 = new ArrayBackedValueStorage();
+            private ICopyEvaluator eval0 = recordEvalFactory.createEvaluator(outInput0);
+            private ICopyEvaluator eval1 = fieldIndexEvalFactory.createEvaluator(outInput1);
+            @SuppressWarnings("unchecked")
+            private ISerializerDeserializer<ANull> nullSerde = AqlSerializerDeserializerProvider.INSTANCE
+                    .getSerializerDeserializer(BuiltinType.ANULL);
+            private int fieldIndex;
+            private int fieldValueOffset;
+            private int fieldValueLength;
+            private IAType fieldValueType;
+            private ATypeTag fieldValueTypeTag = ATypeTag.NULL;
+
+            @Override
+            public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
+                try {
+                    outInput0.reset();
+                    eval0.evaluate(tuple);
+                    outInput1.reset();
+                    eval1.evaluate(tuple);
+                    byte[] serRecord = outInput0.getByteArray();
+
+                    if (serRecord[0] == SER_NULL_TYPE_TAG) {
+                        nullSerde.serialize(ANull.NULL, out);
+                        return;
+                    }
+
+                    if (serRecord[0] != SER_RECORD_TYPE_TAG) {
+                        throw new AlgebricksException("Field accessor is not defined for values of type "
+                                + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(serRecord[0]));
+                    }
+
+                    fieldIndex = IntegerPointable.getInteger(outInput1.getByteArray(), 1);
+                    fieldValueOffset = ARecordSerializerDeserializer.getFieldOffsetById(serRecord, fieldIndex,
+                            nullBitmapSize, recordType.isOpen());
+
+                    if (fieldValueOffset == 0) {
+                        // the field is null, we checked the null bit map
+                        out.writeByte(SER_NULL_TYPE_TAG);
+                        return;
+                    }
+
+                    fieldValueType = recordType.getFieldTypes()[fieldIndex];
+                    if (fieldValueType.getTypeTag().equals(ATypeTag.UNION)) {
+                        if (NonTaggedFormatUtil.isOptionalField((AUnionType) fieldValueType)) {
+                            fieldValueTypeTag = ((AUnionType) fieldValueType).getUnionList()
+                                    .get(AUnionType.OPTIONAL_TYPE_INDEX_IN_UNION_LIST).getTypeTag();
+                            fieldValueLength = NonTaggedFormatUtil.getFieldValueLength(serRecord, fieldValueOffset,
+                                    fieldValueTypeTag, false);
+                            out.writeByte(fieldValueTypeTag.serialize());
+                        } else {
+                            // union .. the general case
+                            throw new NotImplementedException();
+                        }
+                    } else {
+                        fieldValueTypeTag = fieldValueType.getTypeTag();
+                        fieldValueLength = NonTaggedFormatUtil.getFieldValueLength(serRecord, fieldValueOffset,
+                                fieldValueTypeTag, false);
+                        out.writeByte(fieldValueTypeTag.serialize());
+                    }
+                    out.write(serRecord, fieldValueOffset, fieldValueLength);
+
+                } catch (IOException e) {
+                    throw new AlgebricksException(e);
+                } catch (AsterixException e) {
+                    throw new AlgebricksException(e);
+                }
+            }
+        };
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/records/FieldAccessByNameDescriptor.java
----------------------------------------------------------------------
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/records/FieldAccessByNameDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/records/FieldAccessByNameDescriptor.java
new file mode 100644
index 0000000..316eb9a
--- /dev/null
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/records/FieldAccessByNameDescriptor.java
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2009-2013 by The Regents of the University of California
+ * Licensed 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 from
+ * 
+ *     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.
+ */
+package edu.uci.ics.asterix.runtime.evaluators.functions.records;
+
+import edu.uci.ics.asterix.om.functions.AsterixBuiltinFunctions;
+import edu.uci.ics.asterix.om.functions.IFunctionDescriptor;
+import edu.uci.ics.asterix.om.functions.IFunctionDescriptorFactory;
+import edu.uci.ics.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
+import edu.uci.ics.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+
+public class FieldAccessByNameDescriptor extends AbstractScalarFunctionDynamicDescriptor {
+
+    private static final long serialVersionUID = 1L;
+    public static final IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() {
+        public IFunctionDescriptor createFunctionDescriptor() {
+            return new FieldAccessByNameDescriptor();
+        }
+    };
+
+    @Override
+    public FunctionIdentifier getIdentifier() {
+        return AsterixBuiltinFunctions.FIELD_ACCESS_BY_NAME;
+    }
+
+    @Override
+    public ICopyEvaluatorFactory createEvaluatorFactory(ICopyEvaluatorFactory[] args) {
+        return new FieldAccessByNameEvalFactory(args[0], args[1]);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/records/FieldAccessByNameEvalFactory.java
----------------------------------------------------------------------
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/records/FieldAccessByNameEvalFactory.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/records/FieldAccessByNameEvalFactory.java
new file mode 100644
index 0000000..d9a10de
--- /dev/null
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/records/FieldAccessByNameEvalFactory.java
@@ -0,0 +1,111 @@
+/*
+ * Copyright 2009-2013 by The Regents of the University of California
+ * Licensed 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 from
+ *
+ *     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.
+ */
+package edu.uci.ics.asterix.runtime.evaluators.functions.records;
+
+import java.io.DataOutput;
+import java.io.IOException;
+
+import edu.uci.ics.asterix.common.exceptions.AsterixException;
+import edu.uci.ics.asterix.dataflow.data.nontagged.serde.ARecordSerializerDeserializer;
+import edu.uci.ics.asterix.formats.nontagged.AqlSerializerDeserializerProvider;
+import edu.uci.ics.asterix.om.base.ANull;
+import edu.uci.ics.asterix.om.functions.AsterixBuiltinFunctions;
+import edu.uci.ics.asterix.om.types.ATypeTag;
+import edu.uci.ics.asterix.om.types.BuiltinType;
+import edu.uci.ics.asterix.om.types.EnumDeserializer;
+import edu.uci.ics.asterix.om.util.NonTaggedFormatUtil;
+import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluator;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import edu.uci.ics.hyracks.api.dataflow.value.ISerializerDeserializer;
+import edu.uci.ics.hyracks.data.std.api.IDataOutputProvider;
+import edu.uci.ics.hyracks.data.std.util.ArrayBackedValueStorage;
+import edu.uci.ics.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
+
+public class FieldAccessByNameEvalFactory implements ICopyEvaluatorFactory {
+
+    private static final long serialVersionUID = 1L;
+
+    private ICopyEvaluatorFactory recordEvalFactory;
+    private ICopyEvaluatorFactory fldNameEvalFactory;
+
+    private final static byte SER_NULL_TYPE_TAG = ATypeTag.NULL.serialize();
+    private final static byte SER_RECORD_TYPE_TAG = ATypeTag.RECORD.serialize();
+
+    public FieldAccessByNameEvalFactory(ICopyEvaluatorFactory recordEvalFactory,
+            ICopyEvaluatorFactory fldNameEvalFactory) {
+        this.recordEvalFactory = recordEvalFactory;
+        this.fldNameEvalFactory = fldNameEvalFactory;
+    }
+
+    @Override
+    public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
+        return new ICopyEvaluator() {
+
+            private DataOutput out = output.getDataOutput();
+
+            private ArrayBackedValueStorage outInput0 = new ArrayBackedValueStorage();
+            private ArrayBackedValueStorage outInput1 = new ArrayBackedValueStorage();
+            private ICopyEvaluator eval0 = recordEvalFactory.createEvaluator(outInput0);
+            private ICopyEvaluator eval1 = fldNameEvalFactory.createEvaluator(outInput1);
+            @SuppressWarnings("unchecked")
+            private ISerializerDeserializer<ANull> nullSerde = AqlSerializerDeserializerProvider.INSTANCE
+                    .getSerializerDeserializer(BuiltinType.ANULL);
+            private int fieldValueOffset;
+            private int fieldValueLength;
+            private ATypeTag fieldValueTypeTag = ATypeTag.NULL;
+
+            @Override
+            public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
+
+                try {
+                    outInput0.reset();
+                    eval0.evaluate(tuple);
+                    outInput1.reset();
+                    eval1.evaluate(tuple);
+                    byte[] serRecord = outInput0.getByteArray();
+
+                    if (serRecord[0] == SER_NULL_TYPE_TAG) {
+                        nullSerde.serialize(ANull.NULL, out);
+                        return;
+                    }
+
+                    if (serRecord[0] != SER_RECORD_TYPE_TAG) {
+                        throw new AlgebricksException(AsterixBuiltinFunctions.FIELD_ACCESS_BY_NAME.getName()
+                                + ": expects input type NULL or RECORD, but got "
+                                + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(serRecord[0]));
+                    }
+
+                    byte[] serFldName = outInput1.getByteArray();
+                    fieldValueOffset = ARecordSerializerDeserializer.getFieldOffsetByName(serRecord, serFldName);
+                    if (fieldValueOffset < 0) {
+                        out.writeByte(ATypeTag.NULL.serialize());
+                        return;
+                    }
+
+                    fieldValueTypeTag = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(serRecord[fieldValueOffset]);
+                    fieldValueLength = NonTaggedFormatUtil.getFieldValueLength(serRecord, fieldValueOffset,
+                            fieldValueTypeTag, true) + 1;
+                    out.write(serRecord, fieldValueOffset, fieldValueLength);
+
+                } catch (IOException e) {
+                    throw new AlgebricksException(e);
+                } catch (AsterixException e) {
+                    throw new AlgebricksException(e);
+                }
+            }
+        };
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/records/FieldAccessNestedDescriptor.java
----------------------------------------------------------------------
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/records/FieldAccessNestedDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/records/FieldAccessNestedDescriptor.java
new file mode 100644
index 0000000..4a79d93
--- /dev/null
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/records/FieldAccessNestedDescriptor.java
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2009-2013 by The Regents of the University of California
+ * Licensed 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 from
+ *
+ *     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.
+ */
+package edu.uci.ics.asterix.runtime.evaluators.functions.records;
+
+import java.util.List;
+
+import edu.uci.ics.asterix.om.functions.AsterixBuiltinFunctions;
+import edu.uci.ics.asterix.om.functions.IFunctionDescriptor;
+import edu.uci.ics.asterix.om.functions.IFunctionDescriptorFactory;
+import edu.uci.ics.asterix.om.types.ARecordType;
+import edu.uci.ics.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
+import edu.uci.ics.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+
+public class FieldAccessNestedDescriptor extends AbstractScalarFunctionDynamicDescriptor {
+
+    private static final long serialVersionUID = 1L;
+    public static final IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() {
+        public IFunctionDescriptor createFunctionDescriptor() {
+            return new FieldAccessNestedDescriptor();
+        }
+    };
+
+    private ARecordType recType;
+    private List<String> fldName;
+
+    public void reset(ARecordType recType, List<String> fldName) {
+        this.recType = recType;
+        this.fldName = fldName;
+    }
+
+    @Override
+    public FunctionIdentifier getIdentifier() {
+        return AsterixBuiltinFunctions.FIELD_ACCESS_NESTED;
+    }
+
+    @Override
+    public ICopyEvaluatorFactory createEvaluatorFactory(ICopyEvaluatorFactory[] args) {
+        return new FieldAccessNestedEvalFactory(args[0], recType, fldName);
+    }
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/records/FieldAccessNestedEvalFactory.java
----------------------------------------------------------------------
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/records/FieldAccessNestedEvalFactory.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/records/FieldAccessNestedEvalFactory.java
new file mode 100644
index 0000000..06c2109
--- /dev/null
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/records/FieldAccessNestedEvalFactory.java
@@ -0,0 +1,68 @@
+/*
+ * Copyright 2009-2013 by The Regents of the University of California
+ * Licensed 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 from
+ *
+ *     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.
+ */
+package edu.uci.ics.asterix.runtime.evaluators.functions.records;
+
+import java.io.DataOutput;
+import java.util.List;
+
+import edu.uci.ics.asterix.om.types.ARecordType;
+import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluator;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import edu.uci.ics.hyracks.data.std.api.IDataOutputProvider;
+import edu.uci.ics.hyracks.data.std.util.ArrayBackedValueStorage;
+import edu.uci.ics.hyracks.data.std.util.ByteArrayAccessibleOutputStream;
+import edu.uci.ics.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
+
+public class FieldAccessNestedEvalFactory implements ICopyEvaluatorFactory {
+
+    private static final long serialVersionUID = 1L;
+
+    private ICopyEvaluatorFactory recordEvalFactory;
+    private ARecordType recordType;
+    private List<String> fieldPath;
+
+    public FieldAccessNestedEvalFactory(ICopyEvaluatorFactory recordEvalFactory, ARecordType recordType,
+            List<String> fldName) {
+        this.recordEvalFactory = recordEvalFactory;
+        this.recordType = recordType;
+        this.fieldPath = fldName;
+
+    }
+
+    @Override
+    public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
+        return new ICopyEvaluator() {
+
+            private DataOutput out = output.getDataOutput();
+            private ByteArrayAccessibleOutputStream subRecordTmpStream = new ByteArrayAccessibleOutputStream();
+
+            private ArrayBackedValueStorage outInput0 = new ArrayBackedValueStorage();
+            private ICopyEvaluator eval0 = recordEvalFactory.createEvaluator(outInput0);
+            private ArrayBackedValueStorage[] abvsFields = new ArrayBackedValueStorage[fieldPath.size()];
+            private DataOutput[] doFields = new DataOutput[fieldPath.size()];
+
+            {
+                FieldAccessUtil.getFieldsAbvs(abvsFields, doFields, fieldPath);
+                recordType = recordType.deepCopy(recordType);
+            }
+
+            @Override
+            public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
+                FieldAccessUtil.evaluate(tuple, out, eval0, abvsFields, outInput0, subRecordTmpStream, recordType);
+            }
+        };
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/records/FieldAccessUtil.java
----------------------------------------------------------------------
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/records/FieldAccessUtil.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/records/FieldAccessUtil.java
new file mode 100644
index 0000000..ef790fc
--- /dev/null
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/records/FieldAccessUtil.java
@@ -0,0 +1,194 @@
+/*
+ * Copyright 2009-2013 by The Regents of the University of California
+ * Licensed 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 from
+ *
+ *     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.
+ */
+package edu.uci.ics.asterix.runtime.evaluators.functions.records;
+
+import java.io.DataOutput;
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.List;
+
+import edu.uci.ics.asterix.common.exceptions.AsterixException;
+import edu.uci.ics.asterix.dataflow.data.nontagged.serde.ARecordSerializerDeserializer;
+import edu.uci.ics.asterix.formats.nontagged.AqlSerializerDeserializerProvider;
+import edu.uci.ics.asterix.om.base.ANull;
+import edu.uci.ics.asterix.om.base.AString;
+import edu.uci.ics.asterix.om.types.ARecordType;
+import edu.uci.ics.asterix.om.types.ATypeTag;
+import edu.uci.ics.asterix.om.types.AUnionType;
+import edu.uci.ics.asterix.om.types.BuiltinType;
+import edu.uci.ics.asterix.om.types.EnumDeserializer;
+import edu.uci.ics.asterix.om.types.IAType;
+import edu.uci.ics.asterix.om.util.NonTaggedFormatUtil;
+import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
+import edu.uci.ics.hyracks.algebricks.common.exceptions.NotImplementedException;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluator;
+import edu.uci.ics.hyracks.api.dataflow.value.ISerializerDeserializer;
+import edu.uci.ics.hyracks.api.exceptions.HyracksDataException;
+import edu.uci.ics.hyracks.data.std.util.ArrayBackedValueStorage;
+import edu.uci.ics.hyracks.data.std.util.ByteArrayAccessibleOutputStream;
+import edu.uci.ics.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
+
+public class FieldAccessUtil {
+
+    private final static byte SER_NULL_TYPE_TAG = ATypeTag.NULL.serialize();
+    private final static byte SER_RECORD_TYPE_TAG = ATypeTag.RECORD.serialize();
+
+    @SuppressWarnings("unchecked")
+    private static ISerializerDeserializer<ANull> nullSerde = AqlSerializerDeserializerProvider.INSTANCE
+            .getSerializerDeserializer(BuiltinType.ANULL);
+
+    @SuppressWarnings("unchecked")
+    public static void getFieldsAbvs(ArrayBackedValueStorage[] abvsFields, DataOutput[] doFields,
+            List<String> fieldPaths) throws AlgebricksException {
+        AString as;
+        for (int i = 0; i < fieldPaths.size(); i++) {
+            abvsFields[i] = new ArrayBackedValueStorage();
+            doFields[i] = abvsFields[i].getDataOutput();
+            as = new AString(fieldPaths.get(i));
+            try {
+                AqlSerializerDeserializerProvider.INSTANCE.getSerializerDeserializer(as.getType()).serialize(as,
+                        doFields[i]);
+            } catch (HyracksDataException e) {
+                throw new AlgebricksException(e);
+            }
+        }
+    }
+
+    public static boolean checkType(byte tagId, DataOutput out) throws AlgebricksException {
+        if (tagId == SER_NULL_TYPE_TAG) {
+            try {
+                nullSerde.serialize(ANull.NULL, out);
+            } catch (HyracksDataException e) {
+                throw new AlgebricksException(e);
+            }
+            return true;
+        }
+
+        if (tagId != SER_RECORD_TYPE_TAG) {
+            throw new AlgebricksException("Field accessor is not defined for values of type "
+                    + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(tagId));
+        }
+        return false;
+    }
+
+    public static void evaluate(IFrameTupleReference tuple, DataOutput out, ICopyEvaluator eval0,
+            ArrayBackedValueStorage[] abvsFields, ArrayBackedValueStorage abvsRecord,
+            ByteArrayAccessibleOutputStream subRecordTmpStream, ARecordType recordType) throws AlgebricksException {
+
+        try {
+            abvsRecord.reset();
+            eval0.evaluate(tuple);
+
+            int subFieldIndex = -1;
+            int subFieldOffset = -1;
+            int subFieldLength = -1;
+            int nullBitmapSize = -1;
+            IAType subType = recordType;
+            ATypeTag subTypeTag = ATypeTag.NULL;
+            byte[] subRecord = abvsRecord.getByteArray();
+            boolean openField = false;
+            int i = 0;
+
+            if (checkType(subRecord[0], out)) {
+                return;
+            }
+
+            //Moving through closed fields
+            for (; i < abvsFields.length; i++) {
+                if (subType.getTypeTag().equals(ATypeTag.UNION)) {
+                    //enforced SubType
+                    subType = ((AUnionType) subType).getUnionList().get(AUnionType.OPTIONAL_TYPE_INDEX_IN_UNION_LIST);
+                    if (subType.getTypeTag().serialize() != SER_RECORD_TYPE_TAG) {
+                        throw new AlgebricksException("Field accessor is not defined for values of type " + subTypeTag);
+                    }
+
+                }
+                subFieldIndex = ((ARecordType) subType).findFieldPosition(abvsFields[i].getByteArray(),
+                        abvsFields[i].getStartOffset() + 1, abvsFields[i].getLength());
+                if (subFieldIndex == -1) {
+                    break;
+                }
+                nullBitmapSize = ARecordType.computeNullBitmapSize((ARecordType) subType);
+                subFieldOffset = ARecordSerializerDeserializer.getFieldOffsetById(subRecord, subFieldIndex,
+                        nullBitmapSize, ((ARecordType) subType).isOpen());
+                if (subFieldOffset == 0) {
+                    // the field is null, we checked the null bit map
+                    out.writeByte(SER_NULL_TYPE_TAG);
+                    return;
+                }
+                subType = ((ARecordType) subType).getFieldTypes()[subFieldIndex];
+                if (subType.getTypeTag().equals(ATypeTag.UNION)) {
+                    if (NonTaggedFormatUtil.isOptionalField((AUnionType) subType)) {
+                        subTypeTag = ((AUnionType) subType).getUnionList()
+                                .get(AUnionType.OPTIONAL_TYPE_INDEX_IN_UNION_LIST).getTypeTag();
+                        subFieldLength = NonTaggedFormatUtil.getFieldValueLength(subRecord, subFieldOffset, subTypeTag,
+                                false);
+                    } else {
+                        // union .. the general case
+                        throw new NotImplementedException();
+                    }
+                } else {
+                    subTypeTag = subType.getTypeTag();
+                    subFieldLength = NonTaggedFormatUtil.getFieldValueLength(subRecord, subFieldOffset, subTypeTag,
+                            false);
+                }
+
+                if (i < abvsFields.length - 1) {
+                    //setup next iteration
+                    subRecordTmpStream.reset();
+                    subRecordTmpStream.write(subTypeTag.serialize());
+                    subRecordTmpStream.write(subRecord, subFieldOffset, subFieldLength);
+                    subRecord = subRecordTmpStream.getByteArray();
+
+                    if (checkType(subRecord[0], out)) {
+                        return;
+                    }
+                }
+            }
+
+            //Moving through open fields
+            for (; i < abvsFields.length; i++) {
+                openField = true;
+                subFieldOffset = ARecordSerializerDeserializer.getFieldOffsetByName(subRecord,
+                        abvsFields[i].getByteArray());
+                if (subFieldOffset < 0) {
+                    out.writeByte(SER_NULL_TYPE_TAG);
+                    return;
+                }
+
+                subTypeTag = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(subRecord[subFieldOffset]);
+                subFieldLength = NonTaggedFormatUtil.getFieldValueLength(subRecord, subFieldOffset, subTypeTag, true) + 1;
+
+                if (i < abvsFields.length - 1) {
+                    //setup next iteration
+                    subRecord = Arrays.copyOfRange(subRecord, subFieldOffset, subFieldOffset + subFieldLength);
+
+                    if (checkType(subRecord[0], out)) {
+                        return;
+                    }
+                }
+            }
+            if (!openField) {
+                out.writeByte(subTypeTag.serialize());
+            }
+            out.write(subRecord, subFieldOffset, subFieldLength);
+
+        } catch (IOException e) {
+            throw new AlgebricksException(e);
+        } catch (AsterixException e) {
+            throw new AlgebricksException(e);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/records/GetRecordFieldValueDescriptor.java
----------------------------------------------------------------------
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/records/GetRecordFieldValueDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/records/GetRecordFieldValueDescriptor.java
new file mode 100644
index 0000000..dfd8db0
--- /dev/null
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/records/GetRecordFieldValueDescriptor.java
@@ -0,0 +1,50 @@
+/*
+ * Copyright 2009-2013 by The Regents of the University of California
+ * Licensed 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 from
+ * 
+ *     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.
+ */
+package edu.uci.ics.asterix.runtime.evaluators.functions.records;
+
+import edu.uci.ics.asterix.om.functions.AsterixBuiltinFunctions;
+import edu.uci.ics.asterix.om.functions.IFunctionDescriptor;
+import edu.uci.ics.asterix.om.functions.IFunctionDescriptorFactory;
+import edu.uci.ics.asterix.om.types.ARecordType;
+import edu.uci.ics.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
+import edu.uci.ics.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+
+public class GetRecordFieldValueDescriptor extends AbstractScalarFunctionDynamicDescriptor {
+
+    private static final long serialVersionUID = 1L;
+    public static final IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() {
+        public IFunctionDescriptor createFunctionDescriptor() {
+            return new GetRecordFieldValueDescriptor();
+        }
+    };
+
+    private ARecordType recType;
+
+    public void reset(ARecordType recType) {
+        this.recType = recType;
+    }
+
+    @Override
+    public FunctionIdentifier getIdentifier() {
+        return AsterixBuiltinFunctions.GET_RECORD_FIELD_VALUE;
+    }
+
+    @Override
+    public ICopyEvaluatorFactory createEvaluatorFactory(ICopyEvaluatorFactory[] args) {
+        return new GetRecordFieldValueEvalFactory(args[0], args[1], recType);
+    }
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/records/GetRecordFieldValueEvalFactory.java
----------------------------------------------------------------------
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/records/GetRecordFieldValueEvalFactory.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/records/GetRecordFieldValueEvalFactory.java
new file mode 100644
index 0000000..b07049a
--- /dev/null
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/records/GetRecordFieldValueEvalFactory.java
@@ -0,0 +1,98 @@
+/*
+ * Copyright 2009-2013 by The Regents of the University of California
+ * Licensed 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 from
+ *
+ *     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.
+ */
+package edu.uci.ics.asterix.runtime.evaluators.functions.records;
+
+import java.io.DataOutput;
+import java.io.IOException;
+
+import edu.uci.ics.asterix.formats.nontagged.AqlSerializerDeserializerProvider;
+import edu.uci.ics.asterix.om.base.ANull;
+import edu.uci.ics.asterix.om.types.ARecordType;
+import edu.uci.ics.asterix.om.types.ATypeTag;
+import edu.uci.ics.asterix.om.types.BuiltinType;
+import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluator;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import edu.uci.ics.hyracks.api.dataflow.value.ISerializerDeserializer;
+import edu.uci.ics.hyracks.data.std.api.IDataOutputProvider;
+import edu.uci.ics.hyracks.data.std.util.ArrayBackedValueStorage;
+import edu.uci.ics.hyracks.data.std.util.ByteArrayAccessibleOutputStream;
+import edu.uci.ics.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
+
+public class GetRecordFieldValueEvalFactory implements ICopyEvaluatorFactory {
+
+    private static final long serialVersionUID = 1L;
+
+    private ICopyEvaluatorFactory recordEvalFactory;
+    private ICopyEvaluatorFactory fldNameEvalFactory;
+    private ARecordType recordType;
+
+    private final static byte SER_STRING_TYPE_TAG = ATypeTag.STRING.serialize();
+
+    public GetRecordFieldValueEvalFactory(ICopyEvaluatorFactory recordEvalFactory,
+            ICopyEvaluatorFactory fldNameEvalFactory, ARecordType recordType) {
+        this.recordEvalFactory = recordEvalFactory;
+        this.fldNameEvalFactory = fldNameEvalFactory;
+        this.recordType = recordType;
+    }
+
+    @Override
+    public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
+        return new ICopyEvaluator() {
+
+            private DataOutput out = output.getDataOutput();
+            private ByteArrayAccessibleOutputStream subRecordTmpStream = new ByteArrayAccessibleOutputStream();
+
+            private ArrayBackedValueStorage outInput0 = new ArrayBackedValueStorage();
+            private ArrayBackedValueStorage outInput1 = new ArrayBackedValueStorage();
+            private ICopyEvaluator eval0 = recordEvalFactory.createEvaluator(outInput0);
+            private ICopyEvaluator eval1 = fldNameEvalFactory.createEvaluator(outInput1);
+
+            int size = 1;
+            private ArrayBackedValueStorage abvsFields[] = new ArrayBackedValueStorage[size];
+            private DataOutput[] doFields = new DataOutput[size];
+
+            @SuppressWarnings("unchecked")
+            private ISerializerDeserializer<ANull> nullSerde = AqlSerializerDeserializerProvider.INSTANCE
+                    .getSerializerDeserializer(BuiltinType.ANULL);
+
+            {
+                abvsFields[0] = new ArrayBackedValueStorage();
+                doFields[0] = abvsFields[0].getDataOutput();
+                recordType = recordType.deepCopy(recordType);
+            }
+
+            @Override
+            public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
+                try {
+                    outInput1.reset();
+                    eval1.evaluate(tuple);
+
+                    byte[] serFldName = outInput1.getByteArray();
+                    if (serFldName[0] != SER_STRING_TYPE_TAG) {
+                        nullSerde.serialize(ANull.NULL, out);
+                        return;
+                    }
+                    abvsFields[0].reset();
+                    doFields[0].write(serFldName);
+
+                    FieldAccessUtil.evaluate(tuple, out, eval0, abvsFields, outInput0, subRecordTmpStream, recordType);
+                } catch (IOException e) {
+                    throw new AlgebricksException(e);
+                }
+            }
+        };
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/records/GetRecordFieldsDescriptor.java
----------------------------------------------------------------------
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/records/GetRecordFieldsDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/records/GetRecordFieldsDescriptor.java
new file mode 100644
index 0000000..98abc61
--- /dev/null
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/records/GetRecordFieldsDescriptor.java
@@ -0,0 +1,50 @@
+/*
+ * Copyright 2009-2013 by The Regents of the University of California
+ * Licensed 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 from
+ * 
+ *     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.
+ */
+package edu.uci.ics.asterix.runtime.evaluators.functions.records;
+
+import edu.uci.ics.asterix.om.functions.AsterixBuiltinFunctions;
+import edu.uci.ics.asterix.om.functions.IFunctionDescriptor;
+import edu.uci.ics.asterix.om.functions.IFunctionDescriptorFactory;
+import edu.uci.ics.asterix.om.types.ARecordType;
+import edu.uci.ics.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
+import edu.uci.ics.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+
+public class GetRecordFieldsDescriptor extends AbstractScalarFunctionDynamicDescriptor {
+
+    private static final long serialVersionUID = 1L;
+    public static final IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() {
+        public IFunctionDescriptor createFunctionDescriptor() {
+            return new GetRecordFieldsDescriptor();
+        }
+    };
+
+    private ARecordType recType;
+
+    public void reset(ARecordType recType) {
+        this.recType = recType;
+    }
+
+    @Override
+    public FunctionIdentifier getIdentifier() {
+        return AsterixBuiltinFunctions.GET_RECORD_FIELDS;
+    }
+
+    @Override
+    public ICopyEvaluatorFactory createEvaluatorFactory(ICopyEvaluatorFactory[] args) {
+        return new GetRecordFieldsEvalFactory(args[0], recType);
+    }
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/records/GetRecordFieldsEvalFactory.java
----------------------------------------------------------------------
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/records/GetRecordFieldsEvalFactory.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/records/GetRecordFieldsEvalFactory.java
new file mode 100644
index 0000000..c0c77a3
--- /dev/null
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/records/GetRecordFieldsEvalFactory.java
@@ -0,0 +1,101 @@
+/*
+ * Copyright 2009-2013 by The Regents of the University of California
+ * Licensed 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 from
+ *
+ *     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.
+ */
+package edu.uci.ics.asterix.runtime.evaluators.functions.records;
+
+import java.io.DataOutput;
+import java.io.IOException;
+
+import edu.uci.ics.asterix.common.exceptions.AsterixException;
+import edu.uci.ics.asterix.formats.nontagged.AqlSerializerDeserializerProvider;
+import edu.uci.ics.asterix.om.base.ANull;
+import edu.uci.ics.asterix.om.pointables.nonvisitor.ARecordPointable;
+import edu.uci.ics.asterix.om.types.ARecordType;
+import edu.uci.ics.asterix.om.types.ATypeTag;
+import edu.uci.ics.asterix.om.types.BuiltinType;
+import edu.uci.ics.asterix.om.types.EnumDeserializer;
+import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluator;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import edu.uci.ics.hyracks.api.dataflow.value.ISerializerDeserializer;
+import edu.uci.ics.hyracks.api.exceptions.HyracksDataException;
+import edu.uci.ics.hyracks.data.std.api.IDataOutputProvider;
+import edu.uci.ics.hyracks.data.std.util.ArrayBackedValueStorage;
+import edu.uci.ics.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
+
+public class GetRecordFieldsEvalFactory implements ICopyEvaluatorFactory {
+
+    private static final long serialVersionUID = 1L;
+
+    private ICopyEvaluatorFactory recordEvalFactory;
+    private ARecordType recordType;
+
+    private final byte SER_NULL_TYPE_TAG = ATypeTag.NULL.serialize();
+    private final byte SER_RECORD_TYPE_TAG = ATypeTag.RECORD.serialize();
+
+    public GetRecordFieldsEvalFactory(ICopyEvaluatorFactory recordEvalFactory, ARecordType recordType) {
+        this.recordEvalFactory = recordEvalFactory;
+        this.recordType = recordType;
+    }
+
+    @Override
+    public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
+        return new ICopyEvaluator() {
+
+            @SuppressWarnings("unchecked")
+            private final ISerializerDeserializer<ANull> nullSerde = AqlSerializerDeserializerProvider.INSTANCE
+                    .getSerializerDeserializer(BuiltinType.ANULL);
+
+            private final ARecordPointable recordPointable = (ARecordPointable) ARecordPointable.FACTORY
+                    .createPointable();
+
+            private ArrayBackedValueStorage outInput0 = new ArrayBackedValueStorage();
+            private ICopyEvaluator eval0 = recordEvalFactory.createEvaluator(outInput0);
+            private DataOutput out = output.getDataOutput();
+            private RecordFieldsUtil rfu = new RecordFieldsUtil();
+
+            {
+                recordType = recordType.deepCopy(recordType);
+            }
+
+            public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
+                outInput0.reset();
+                eval0.evaluate(tuple);
+
+                if (outInput0.getByteArray()[0] == SER_NULL_TYPE_TAG) {
+                    try {
+                        nullSerde.serialize(ANull.NULL, out);
+                    } catch (HyracksDataException e) {
+                        throw new AlgebricksException(e);
+                    }
+                }
+
+                if (outInput0.getByteArray()[0] != SER_RECORD_TYPE_TAG) {
+                    throw new AlgebricksException("Field accessor is not defined for values of type "
+                            + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(outInput0.getByteArray()[0]));
+                }
+
+                recordPointable.set(outInput0.getByteArray(), outInput0.getStartOffset(), outInput0.getLength());
+
+                try {
+                    rfu.processRecord(recordPointable, recordType, out, 0);
+                } catch (IOException e) {
+                    e.printStackTrace();
+                } catch (AsterixException e) {
+                    e.printStackTrace();
+                }
+            }
+        };
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/records/RecordFieldsUtil.java
----------------------------------------------------------------------
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/records/RecordFieldsUtil.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/records/RecordFieldsUtil.java
new file mode 100644
index 0000000..fbb9a1b
--- /dev/null
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/records/RecordFieldsUtil.java
@@ -0,0 +1,303 @@
+/*
+ * Copyright 2009-2013 by The Regents of the University of California
+ * Licensed 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 from
+ *
+ *     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.
+ */
+package edu.uci.ics.asterix.runtime.evaluators.functions.records;
+
+import java.io.DataOutput;
+import java.io.IOException;
+
+import edu.uci.ics.asterix.builders.AbvsBuilderFactory;
+import edu.uci.ics.asterix.builders.IARecordBuilder;
+import edu.uci.ics.asterix.builders.IAsterixListBuilder;
+import edu.uci.ics.asterix.builders.ListBuilderFactory;
+import edu.uci.ics.asterix.builders.OrderedListBuilder;
+import edu.uci.ics.asterix.builders.RecordBuilder;
+import edu.uci.ics.asterix.builders.RecordBuilderFactory;
+import edu.uci.ics.asterix.common.exceptions.AsterixException;
+import edu.uci.ics.asterix.formats.nontagged.AqlSerializerDeserializerProvider;
+import edu.uci.ics.asterix.om.base.ABoolean;
+import edu.uci.ics.asterix.om.base.AMutableString;
+import edu.uci.ics.asterix.om.base.AString;
+import edu.uci.ics.asterix.om.pointables.base.DefaultOpenFieldType;
+import edu.uci.ics.asterix.om.pointables.nonvisitor.AListPointable;
+import edu.uci.ics.asterix.om.pointables.nonvisitor.ARecordPointable;
+import edu.uci.ics.asterix.om.types.AOrderedListType;
+import edu.uci.ics.asterix.om.types.ARecordType;
+import edu.uci.ics.asterix.om.types.ATypeTag;
+import edu.uci.ics.asterix.om.types.AbstractCollectionType;
+import edu.uci.ics.asterix.om.types.BuiltinType;
+import edu.uci.ics.asterix.om.types.EnumDeserializer;
+import edu.uci.ics.asterix.om.types.IAType;
+import edu.uci.ics.asterix.om.util.container.IObjectPool;
+import edu.uci.ics.asterix.om.util.container.ListObjectPool;
+import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
+import edu.uci.ics.hyracks.api.dataflow.value.ISerializerDeserializer;
+import edu.uci.ics.hyracks.api.exceptions.HyracksDataException;
+import edu.uci.ics.hyracks.data.std.api.IMutableValueStorage;
+import edu.uci.ics.hyracks.data.std.api.IPointable;
+import edu.uci.ics.hyracks.data.std.api.IValueReference;
+import edu.uci.ics.hyracks.data.std.util.ArrayBackedValueStorage;
+
+public class RecordFieldsUtil {
+
+    private final static byte SER_RECORD_TYPE_TAG = ATypeTag.RECORD.serialize();
+    private final static byte SER_ORDERED_LIST_TYPE_TAG = ATypeTag.ORDEREDLIST.serialize();
+    private final static byte SER_UNORDERED_LIST_TYPE_TAG = ATypeTag.UNORDEREDLIST.serialize();
+
+    private final static AString fieldName = new AString("field-name");
+    private final static AString typeName = new AString("field-type");
+    private final static AString isOpenName = new AString("is-open");
+    private final static AString nestedName = new AString("nested");
+    private final static AString listName = new AString("list");
+
+    private IObjectPool<IARecordBuilder, String> recordBuilderPool = new ListObjectPool<IARecordBuilder, String>(
+            new RecordBuilderFactory());
+    private IObjectPool<IAsterixListBuilder, String> listBuilderPool = new ListObjectPool<IAsterixListBuilder, String>(
+            new ListBuilderFactory());
+    private IObjectPool<IMutableValueStorage, String> abvsBuilderPool = new ListObjectPool<IMutableValueStorage, String>(
+            new AbvsBuilderFactory());
+    private IObjectPool<IPointable, String> recordPointablePool = new ListObjectPool<IPointable, String>(
+            ARecordPointable.ALLOCATOR);
+    private IObjectPool<IPointable, String> listPointablePool = new ListObjectPool<IPointable, String>(
+            AListPointable.ALLOCATOR);
+
+    private final static AOrderedListType listType = new AOrderedListType(BuiltinType.ANY, "fields");
+    @SuppressWarnings("unchecked")
+    protected final static ISerializerDeserializer<AString> stringSerde = AqlSerializerDeserializerProvider.INSTANCE
+            .getSerializerDeserializer(BuiltinType.ASTRING);
+    @SuppressWarnings("unchecked")
+    protected final static ISerializerDeserializer<ABoolean> booleanSerde = AqlSerializerDeserializerProvider.INSTANCE
+            .getSerializerDeserializer(BuiltinType.ABOOLEAN);
+
+    private final static ARecordType openType = DefaultOpenFieldType.NESTED_OPEN_RECORD_TYPE;
+
+    public  void processRecord(ARecordPointable recordAccessor, ARecordType recType, DataOutput out, int level)
+            throws IOException, AsterixException, AlgebricksException {
+        ArrayBackedValueStorage itemValue = getTempBuffer();
+        ArrayBackedValueStorage fieldName = getTempBuffer();
+
+        OrderedListBuilder orderedListBuilder = getOrderedListBuilder();
+        orderedListBuilder.reset(listType);
+        IARecordBuilder fieldRecordBuilder = getRecordBuilder();
+        fieldRecordBuilder.reset(null);
+
+        int schemeFieldCount = recordAccessor.getSchemeFieldCount(recType);
+        for (int i = 0; i < schemeFieldCount; ++i) {
+            itemValue.reset();
+            fieldRecordBuilder.init();
+
+            // write name
+            fieldName.reset();
+            recordAccessor.getClosedFieldName(recType, i, fieldName.getDataOutput());
+            addNameField(fieldName, fieldRecordBuilder);
+
+            // write type
+            byte tag = recordAccessor.getClosedFieldTag(recType, i);
+            addFieldType(tag, fieldRecordBuilder);
+
+            // write open
+            addIsOpenField(false, fieldRecordBuilder);
+
+            // write nested or list types
+            if (tag == SER_RECORD_TYPE_TAG || tag == SER_ORDERED_LIST_TYPE_TAG || tag == SER_UNORDERED_LIST_TYPE_TAG) {
+                if (!recordAccessor.isClosedFieldNull(recType, i)) {
+                    IAType fieldType = recordAccessor.getClosedFieldType(recType, i);
+                    ArrayBackedValueStorage tmpValue = getTempBuffer();
+                    tmpValue.reset();
+                    recordAccessor.getClosedFieldValue(recType, i, tmpValue.getDataOutput());
+                    if (tag == SER_RECORD_TYPE_TAG) {
+                        addNestedField(tmpValue, fieldType, fieldRecordBuilder, level + 1);
+                    } else if (tag == SER_ORDERED_LIST_TYPE_TAG || tag == SER_UNORDERED_LIST_TYPE_TAG) {
+                        addListField(tmpValue, fieldType, fieldRecordBuilder, level + 1);
+                    }
+                }
+            }
+
+            // write record
+            fieldRecordBuilder.write(itemValue.getDataOutput(), true);
+
+            // add item to the list of fields
+            orderedListBuilder.addItem(itemValue);
+        }
+        for (int i = recordAccessor.getOpenFieldCount(recType) - 1; i >= 0; --i) {
+            itemValue.reset();
+            fieldRecordBuilder.init();
+
+            // write name
+            fieldName.reset();
+            recordAccessor.getOpenFieldName(recType, i, fieldName.getDataOutput());
+            addNameField(fieldName, fieldRecordBuilder);
+
+            // write type
+            byte tag = recordAccessor.getOpenFieldTag(recType, i);
+            addFieldType(tag, fieldRecordBuilder);
+
+            // write open
+            addIsOpenField(true, fieldRecordBuilder);
+
+            // write nested or list types
+            if (tag == SER_RECORD_TYPE_TAG || tag == SER_ORDERED_LIST_TYPE_TAG || tag == SER_UNORDERED_LIST_TYPE_TAG) {
+                IAType fieldType = null;
+                ArrayBackedValueStorage tmpValue = getTempBuffer();
+                tmpValue.reset();
+                recordAccessor.getOpenFieldValue(recType, i, tmpValue.getDataOutput());
+                if (tag == SER_RECORD_TYPE_TAG) {
+                    addNestedField(tmpValue, fieldType, fieldRecordBuilder, level + 1);
+                } else if (tag == SER_ORDERED_LIST_TYPE_TAG || tag == SER_UNORDERED_LIST_TYPE_TAG) {
+                    addListField(tmpValue, fieldType, fieldRecordBuilder, level + 1);
+                }
+            }
+
+            // write record
+            fieldRecordBuilder.write(itemValue.getDataOutput(), true);
+
+            // add item to the list of fields
+            orderedListBuilder.addItem(itemValue);
+        }
+        orderedListBuilder.write(out, true);
+    }
+
+    public  void addNameField(IValueReference nameArg, IARecordBuilder fieldRecordBuilder)
+            throws HyracksDataException, AsterixException {
+        ArrayBackedValueStorage fieldAbvs = getTempBuffer();
+
+        fieldAbvs.reset();
+        stringSerde.serialize(fieldName, fieldAbvs.getDataOutput());
+        fieldRecordBuilder.addField(fieldAbvs, nameArg);
+    }
+
+    public  void addFieldType(byte tagId, IARecordBuilder fieldRecordBuilder) throws HyracksDataException,
+            AsterixException {
+        ArrayBackedValueStorage fieldAbvs = getTempBuffer();
+        ArrayBackedValueStorage valueAbvs = getTempBuffer();
+
+        // Name
+        fieldAbvs.reset();
+        stringSerde.serialize(typeName, fieldAbvs.getDataOutput());
+        // Value
+        valueAbvs.reset();
+        ATypeTag tag = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(tagId);
+        AMutableString aString = new AMutableString("");
+        aString.setValue(tag.toString());
+        stringSerde.serialize(aString, valueAbvs.getDataOutput());
+        fieldRecordBuilder.addField(fieldAbvs, valueAbvs);
+    }
+
+    public  void addIsOpenField(boolean isOpen, IARecordBuilder fieldRecordBuilder) throws HyracksDataException,
+            AsterixException {
+        ArrayBackedValueStorage fieldAbvs = getTempBuffer();
+        ArrayBackedValueStorage valueAbvs = getTempBuffer();
+
+        // Name
+        fieldAbvs.reset();
+        stringSerde.serialize(isOpenName, fieldAbvs.getDataOutput());
+        // Value
+        valueAbvs.reset();
+        if (isOpen) {
+            booleanSerde.serialize(ABoolean.TRUE, valueAbvs.getDataOutput());
+        } else {
+            booleanSerde.serialize(ABoolean.FALSE, valueAbvs.getDataOutput());
+        }
+        fieldRecordBuilder.addField(fieldAbvs, valueAbvs);
+    }
+
+    public  void addListField(IValueReference listArg, IAType fieldType, IARecordBuilder fieldRecordBuilder,
+            int level) throws AsterixException, IOException, AlgebricksException {
+        ArrayBackedValueStorage fieldAbvs = getTempBuffer();
+        ArrayBackedValueStorage valueAbvs = getTempBuffer();
+
+        // Name
+        fieldAbvs.reset();
+        stringSerde.serialize(listName, fieldAbvs.getDataOutput());
+        // Value
+        valueAbvs.reset();
+        processListValue(listArg, fieldType, valueAbvs.getDataOutput(), level);
+        fieldRecordBuilder.addField(fieldAbvs, valueAbvs);
+    }
+
+    public  void addNestedField(IValueReference recordArg, IAType fieldType, IARecordBuilder fieldRecordBuilder,
+            int level) throws HyracksDataException, AlgebricksException, IOException, AsterixException {
+        ArrayBackedValueStorage fieldAbvs = getTempBuffer();
+        ArrayBackedValueStorage valueAbvs = getTempBuffer();
+
+        // Name
+        fieldAbvs.reset();
+        stringSerde.serialize(nestedName, fieldAbvs.getDataOutput());
+        // Value
+        valueAbvs.reset();
+        ARecordType newType;
+        if (fieldType == null) {
+            newType = openType.deepCopy(openType);
+        } else {
+            newType = ((ARecordType) fieldType).deepCopy((ARecordType) fieldType);
+        }
+        ARecordPointable recordP = getRecordPointable();
+        recordP.set(recordArg);
+        processRecord(recordP, (ARecordType) newType, valueAbvs.getDataOutput(), level);
+        fieldRecordBuilder.addField(fieldAbvs, valueAbvs);
+    }
+
+    public  void processListValue(IValueReference listArg, IAType fieldType, DataOutput out, int level)
+            throws AsterixException, IOException, AlgebricksException {
+        ArrayBackedValueStorage itemValue = getTempBuffer();
+        IARecordBuilder listRecordBuilder = getRecordBuilder();
+
+        AListPointable list = getListPointable();
+        list.set(listArg);
+
+        OrderedListBuilder innerListBuilder = getOrderedListBuilder();
+        innerListBuilder.reset(listType);
+
+        listRecordBuilder.reset(null);
+        AbstractCollectionType act = (AbstractCollectionType) fieldType;
+        int itemCount = list.getItemCount();
+        for (int l = 0; l < itemCount; l++) {
+            itemValue.reset();
+            listRecordBuilder.init();
+
+            byte tagId = list.getItemTag(act, l);
+            addFieldType(tagId, listRecordBuilder);
+
+            if (tagId == SER_RECORD_TYPE_TAG) {
+                ArrayBackedValueStorage tmpAbvs = getTempBuffer();
+                list.getItemValue(act, l, tmpAbvs.getDataOutput());
+                addNestedField(tmpAbvs, act.getItemType(), listRecordBuilder, level + 1);
+            }
+
+            listRecordBuilder.write(itemValue.getDataOutput(), true);
+            innerListBuilder.addItem(itemValue);
+        }
+        innerListBuilder.write(out, true);
+    }
+
+    private  ARecordPointable getRecordPointable() {
+        return (ARecordPointable) recordPointablePool.allocate("record");
+    }
+
+    private  AListPointable getListPointable() {
+        return (AListPointable) listPointablePool.allocate("list");
+    }
+
+    private  IARecordBuilder getRecordBuilder() {
+        return (RecordBuilder) recordBuilderPool.allocate("record");
+    }
+
+    private  OrderedListBuilder getOrderedListBuilder() {
+        return (OrderedListBuilder) listBuilderPool.allocate("ordered");
+    }
+
+    private  ArrayBackedValueStorage getTempBuffer() {
+        return (ArrayBackedValueStorage) abvsBuilderPool.allocate("buffer");
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/records/RecordMergeDescriptor.java
----------------------------------------------------------------------
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/records/RecordMergeDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/records/RecordMergeDescriptor.java
new file mode 100644
index 0000000..dfe9200
--- /dev/null
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/records/RecordMergeDescriptor.java
@@ -0,0 +1,257 @@
+/*
+ * Copyright 2009-2013 by The Regents of the University of California
+ * Licensed 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 from
+ *
+ *     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.
+ */
+package edu.uci.ics.asterix.runtime.evaluators.functions.records;
+
+import java.io.ByteArrayInputStream;
+import java.io.DataInputStream;
+import java.io.IOException;
+import java.util.Stack;
+
+import edu.uci.ics.asterix.builders.RecordBuilder;
+import edu.uci.ics.asterix.common.exceptions.AsterixException;
+import edu.uci.ics.asterix.dataflow.data.nontagged.serde.AStringSerializerDeserializer;
+import edu.uci.ics.asterix.formats.nontagged.AqlSerializerDeserializerProvider;
+import edu.uci.ics.asterix.om.base.ANull;
+import edu.uci.ics.asterix.om.functions.AsterixBuiltinFunctions;
+import edu.uci.ics.asterix.om.functions.IFunctionDescriptor;
+import edu.uci.ics.asterix.om.functions.IFunctionDescriptorFactory;
+import edu.uci.ics.asterix.om.pointables.ARecordVisitablePointable;
+import edu.uci.ics.asterix.om.pointables.PointableAllocator;
+import edu.uci.ics.asterix.om.pointables.base.IVisitablePointable;
+import edu.uci.ics.asterix.om.typecomputer.impl.RecordMergeTypeComputer;
+import edu.uci.ics.asterix.om.types.ARecordType;
+import edu.uci.ics.asterix.om.types.ATypeTag;
+import edu.uci.ics.asterix.om.types.BuiltinType;
+import edu.uci.ics.asterix.om.types.IAType;
+import edu.uci.ics.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
+import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
+import edu.uci.ics.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluator;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import edu.uci.ics.hyracks.api.dataflow.value.ISerializerDeserializer;
+import edu.uci.ics.hyracks.api.exceptions.HyracksDataException;
+import edu.uci.ics.hyracks.data.std.api.IDataOutputProvider;
+import edu.uci.ics.hyracks.data.std.util.ArrayBackedValueStorage;
+import edu.uci.ics.hyracks.data.std.util.ByteArrayAccessibleOutputStream;
+import edu.uci.ics.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
+
+//The record merge evaluator is used to combine two records with no matching fieldnames
+//If both records have the same fieldname for a non-record field anywhere in the schema, the merge will fail
+//This function is performed on a recursive level, meaning that nested records can be combined
+//for instance if both records have a nested field called "metadata"
+//where metadata from A is {"comments":"this rocks"}
+//and metadata from B is {"index":7, "priority":5}
+//Records A and B can be combined yielding a nested record called "metadata"
+//That will have all three fields
+public class RecordMergeDescriptor extends AbstractScalarFunctionDynamicDescriptor {
+
+    private static final long serialVersionUID = 1L;
+
+    private static final byte SER_NULL_TYPE_TAG = ATypeTag.NULL.serialize();
+
+    public static final IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() {
+        public IFunctionDescriptor createFunctionDescriptor() {
+            return new RecordMergeDescriptor();
+        }
+    };
+
+    private ARecordType outRecType;
+    private ARecordType inRecType0;
+    private ARecordType inRecType1;
+
+    public void reset(IAType outType, IAType inType0, IAType inType1) {
+        outRecType = RecordMergeTypeComputer.extractRecordType(outType);
+        inRecType0 = RecordMergeTypeComputer.extractRecordType(inType0);
+        inRecType1 = RecordMergeTypeComputer.extractRecordType(inType1);
+    }
+
+    @Override
+    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
+        return new ICopyEvaluatorFactory() {
+
+            private static final long serialVersionUID = 1L;
+
+            @SuppressWarnings("unchecked")
+            private final ISerializerDeserializer<ANull> nullSerDe = AqlSerializerDeserializerProvider.INSTANCE
+                    .getSerializerDeserializer(BuiltinType.ANULL);
+
+            @Override
+            public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
+                final ARecordType recType;
+                try {
+                    recType = new ARecordType(outRecType.getTypeName(), outRecType.getFieldNames(),
+                            outRecType.getFieldTypes(), outRecType.isOpen());
+                } catch (AsterixException | HyracksDataException e) {
+                    throw new IllegalStateException();
+                }
+
+                final PointableAllocator pa = new PointableAllocator();
+                final IVisitablePointable vp0 = pa.allocateRecordValue(inRecType0);
+                final IVisitablePointable vp1 = pa.allocateRecordValue(inRecType1);
+
+                final ArrayBackedValueStorage abvs0 = new ArrayBackedValueStorage();
+                final ArrayBackedValueStorage abvs1 = new ArrayBackedValueStorage();
+
+                final ICopyEvaluator eval0 = args[0].createEvaluator(abvs0);
+                final ICopyEvaluator eval1 = args[1].createEvaluator(abvs1);
+
+                final Stack<RecordBuilder> rbStack = new Stack<RecordBuilder>();
+
+                final ArrayBackedValueStorage tabvs = new ArrayBackedValueStorage();
+
+                final ByteArrayAccessibleOutputStream nameOutputStream = new ByteArrayAccessibleOutputStream();
+                final ByteArrayInputStream namebais = new ByteArrayInputStream(nameOutputStream.getByteArray());
+                final DataInputStream namedis = new DataInputStream(namebais);
+
+                return new ICopyEvaluator() {
+
+                    @Override
+                    public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
+                        abvs0.reset();
+                        abvs1.reset();
+
+                        eval0.evaluate(tuple);
+                        eval1.evaluate(tuple);
+
+                        if (abvs0.getByteArray()[0] == SER_NULL_TYPE_TAG
+                                || abvs1.getByteArray()[0] == SER_NULL_TYPE_TAG) {
+                            try {
+                                nullSerDe.serialize(ANull.NULL, output.getDataOutput());
+                            } catch (HyracksDataException e) {
+                                throw new AlgebricksException(e);
+                            }
+                            return;
+                        }
+
+                        vp0.set(abvs0);
+                        vp1.set(abvs1);
+
+                        ARecordVisitablePointable rp0 = (ARecordVisitablePointable) vp0;
+                        ARecordVisitablePointable rp1 = (ARecordVisitablePointable) vp1;
+
+                        try {
+                            mergeFields(recType, rp0, rp1, true, 0);
+
+                            rbStack.get(0).write(output.getDataOutput(), true);
+                        } catch (IOException | AsterixException e) {
+                            throw new AlgebricksException(e);
+                        }
+                    }
+
+                    private void mergeFields(ARecordType combinedType, ARecordVisitablePointable leftRecord,
+                            ARecordVisitablePointable rightRecord, boolean openFromParent, int nestedLevel) throws IOException,
+                            AsterixException, AlgebricksException {
+                        if (rbStack.size() < (nestedLevel + 1)) {
+                            rbStack.push(new RecordBuilder());
+                        }
+
+                        rbStack.get(nestedLevel).reset(combinedType);
+                        rbStack.get(nestedLevel).init();
+                        //Add all fields from left record
+                        for (int i = 0; i < leftRecord.getFieldNames().size(); i++) {
+                            IVisitablePointable leftName = leftRecord.getFieldNames().get(i);
+                            IVisitablePointable leftValue = leftRecord.getFieldValues().get(i);
+                            boolean foundMatch = false;
+                            for (int j = 0; j < rightRecord.getFieldNames().size(); j++) {
+                                IVisitablePointable rightName = rightRecord.getFieldNames().get(j);
+                                IVisitablePointable rightValue = rightRecord.getFieldValues().get(j);
+                                if (rightName.equals(leftName)) {
+                                    //Field was found on the right. Merge Sub Records
+                                    if (rightValue.getByteArray()[0] != ATypeTag.RECORD.serialize()
+                                            || leftValue.getByteArray()[0] != ATypeTag.RECORD.serialize()) {
+                                        //The fields need to be records in order to merge
+                                        throw new AlgebricksException("Duplicate field found");
+                                    } else {
+                                        //We are merging two sub records
+                                        addFieldToSubRecord(combinedType, leftName, leftValue, rightValue,
+                                                openFromParent, nestedLevel);
+                                    }
+                                    foundMatch = true;
+                                }
+                            }
+                            if (!foundMatch) {
+                                addFieldToSubRecord(combinedType, leftName, leftValue, null, openFromParent,
+                                        nestedLevel);
+                            }
+                        }
+                        //Repeat for right side (ignoring duplicates this time)
+                        for (int j = 0; j < rightRecord.getFieldNames().size(); j++) {
+                            IVisitablePointable rightName = rightRecord.getFieldNames().get(j);
+                            IVisitablePointable rightValue = rightRecord.getFieldValues().get(j);
+                            boolean foundMatch = false;
+                            for (int i = 0; i < leftRecord.getFieldNames().size(); i++) {
+                                IVisitablePointable leftName = leftRecord.getFieldNames().get(i);
+                                if (rightName.equals(leftName)) {
+                                    foundMatch = true;
+                                }
+                            }
+                            if (!foundMatch) {
+                                addFieldToSubRecord(combinedType, rightName, rightValue, null, openFromParent,
+                                        nestedLevel);
+                            }
+                        }
+                    }
+
+                    //Takes in a record type, field name, and the field values (which are record) from two records
+                    //Merges them into one record of combinedType
+                    //And adds that record as a field to the Record in subrb
+                    //the second value can be null, indicated that you just add the value of left as a field to subrb
+                    private void addFieldToSubRecord(ARecordType combinedType, IVisitablePointable fieldNamePointable,
+                            IVisitablePointable leftValue, IVisitablePointable rightValue, boolean openFromParent,
+                            int nestedLevel) throws IOException, AsterixException, AlgebricksException {
+
+                        nameOutputStream.reset();
+                        nameOutputStream.write(fieldNamePointable.getByteArray(),
+                                fieldNamePointable.getStartOffset() + 1, fieldNamePointable.getLength());
+                        namedis.reset();
+                        String fieldName = AStringSerializerDeserializer.INSTANCE.deserialize(namedis).getStringValue();
+
+                        //Add the merged field
+                        if (combinedType.isClosedField(fieldName)) {
+                            int pos = combinedType.findFieldPosition(fieldName);
+                            if (rightValue == null) {
+                                rbStack.get(nestedLevel).addField(pos, leftValue);
+                            } else {
+                                mergeFields((ARecordType) combinedType.getFieldType(fieldName),
+                                        (ARecordVisitablePointable) leftValue, (ARecordVisitablePointable) rightValue, false,
+                                        nestedLevel + 1);
+                                tabvs.reset();
+                                rbStack.get(nestedLevel + 1).write(tabvs.getDataOutput(), true);
+                                rbStack.get(nestedLevel).addField(pos, tabvs);
+                            }
+                        } else {
+                            if (rightValue == null) {
+                                rbStack.get(nestedLevel).addField(fieldNamePointable, leftValue);
+                            } else {
+                                mergeFields((ARecordType) combinedType.getFieldType(fieldName),
+                                        (ARecordVisitablePointable) leftValue, (ARecordVisitablePointable) rightValue, false,
+                                        nestedLevel + 1);
+                                tabvs.reset();
+                                rbStack.get(nestedLevel + 1).write(tabvs.getDataOutput(), true);
+                                rbStack.get(nestedLevel).addField(fieldNamePointable, tabvs);
+                            }
+                        }
+                    }
+
+                };
+            }
+        };
+    }
+
+    @Override
+    public FunctionIdentifier getIdentifier() {
+        return AsterixBuiltinFunctions.RECORD_MERGE;
+    }
+}


[8/9] incubator-asterixdb git commit: Adding introspection for getting record details.

Posted by im...@apache.org.
Adding introspection for getting record details.

Change-Id: Iba15acff0f6830cffbc33d9dac3b5f0c417be844
Reviewed-on: https://asterix-gerrit.ics.uci.edu/313
Tested-by: Jenkins <je...@fulliautomatix.ics.uci.edu>
Reviewed-by: Steven Jacobs <sj...@ucr.edu>


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

Branch: refs/heads/master
Commit: 900bf1345410264e9b48469da93ccbd831920d2e
Parents: 032a178
Author: Preston Carman <pr...@apache.org>
Authored: Wed Jul 8 23:44:13 2015 -0700
Committer: Steven Jacobs <sj...@ucr.edu>
Committed: Mon Jul 13 10:43:48 2015 -0700

----------------------------------------------------------------------
 asterix-app/data/classifications/animals.adm    |   4 +
 asterix-app/pom.xml                             | 409 ++++++++++---------
 .../common/AsterixHyracksIntegrationUtil.java   |  86 ++--
 .../ics/asterix/test/metadata/MetadataTest.java |   4 +-
 .../asterix/test/optimizer/OptimizerTest.java   |   2 +-
 .../ics/asterix/test/runtime/ExecutionTest.java |  21 +-
 .../ics/asterix/test/runtime/RepeatedTest.java  | 105 +++++
 .../queries/records/RecordsQueries.xml          | 127 ++++++
 .../access-nested-fields.1.ddl.aql              |  60 +++
 .../access-nested-fields.10.query.aql           |  11 +
 .../access-nested-fields.11.query.aql           |  11 +
 .../access-nested-fields.12.query.aql           |  11 +
 .../access-nested-fields.2.update.aql           |  10 +
 .../access-nested-fields.3.query.aql            |  12 +
 .../access-nested-fields.4.query.aql            |  12 +
 .../access-nested-fields.5.query.aql            |  12 +
 .../access-nested-fields.6.query.aql            |  12 +
 .../access-nested-fields.7.query.aql            |  12 +
 .../access-nested-fields.8.query.aql            |  11 +
 .../access-nested-fields.9.query.aql            |  11 +
 .../documentation-example.1.query.aql           |  10 +
 .../documentation-example.2.query.aql           |  10 +
 .../documentation-example.3.query.aql           |  10 +
 .../highly-nested-open.1.ddl.aql                |  63 +++
 .../highly-nested-open.2.update.aql             |   9 +
 .../highly-nested-open.3.query.aql              |  11 +
 .../highly-nested-mixed.1.ddl.aql               |  59 +++
 .../highly-nested-mixed.2.update.aql            |   9 +
 .../highly-nested-mixed.3.query.aql             |  11 +
 .../highly-nested-open.1.ddl.aql                |  54 +++
 .../highly-nested-open.2.update.aql             |   9 +
 .../highly-nested-open.3.query.aql              |  11 +
 .../tiny-social-example.1.ddl.aql               |  49 +++
 .../tiny-social-example.2.ddl.aql               |  24 ++
 .../tiny-social-example.3.update.aql            |  18 +
 .../tiny-social-example.4.query.aql             |  13 +
 .../documentation-example.1.query.aql           |  10 +
 ...ny-social-example-no-complex-types.1.ddl.aql |  83 ++++
 ...ny-social-example-no-complex-types.2.ddl.aql |  38 ++
 ...social-example-no-complex-types.3.update.aql |  61 +++
 ...-social-example-no-complex-types.4.query.aql |  10 +
 ...-social-example-no-complex-types.5.query.aql |  10 +
 ...-social-example-no-complex-types.6.query.aql |  10 +
 ...-social-example-no-complex-types.7.query.aql |  10 +
 ...-social-example-no-complex-types.8.query.aql |  10 +
 ...-social-example-no-complex-types.9.query.aql |  13 +
 .../tiny-social-example-only-lists.1.ddl.aql    |  85 ++++
 .../tiny-social-example-only-lists.2.ddl.aql    |  38 ++
 .../tiny-social-example-only-lists.3.update.aql |  63 +++
 .../tiny-social-example-only-lists.4.query.aql  |  10 +
 .../tiny-social-example-only-lists.5.query.aql  |  10 +
 .../tiny-social-example-only-lists.6.query.aql  |  10 +
 .../tiny-social-example-only-lists.7.query.aql  |  10 +
 .../tiny-social-example-only-lists.8.query.aql  |  10 +
 .../tiny-social-example-only-lists.9.query.aql  |  13 +
 .../tiny-social-example-only-records.1.ddl.aql  |  85 ++++
 .../tiny-social-example-only-records.2.ddl.aql  |  38 ++
 ...iny-social-example-only-records.3.update.aql |  63 +++
 ...tiny-social-example-only-records.4.query.aql |  10 +
 ...tiny-social-example-only-records.5.query.aql |  10 +
 ...tiny-social-example-only-records.6.query.aql |  10 +
 ...tiny-social-example-only-records.7.query.aql |  10 +
 ...tiny-social-example-only-records.8.query.aql |  10 +
 ...tiny-social-example-only-records.9.query.aql |  13 +
 .../tiny-social-example.1.ddl.aql               |  47 +++
 .../tiny-social-example.2.ddl.aql               |  24 ++
 .../tiny-social-example.3.update.aql            |  18 +
 .../tiny-social-example.4.query.aql             |  10 +
 .../tiny-social-example.5.query.aql             |  10 +
 .../tiny-social-example.6.query.aql             |  10 +
 .../tiny-social-example.7.query.aql             |  10 +
 .../tiny-social-example.8.query.aql             |  10 +
 .../tiny-social-example.9.query.aql             |  13 +
 .../resources/runtimets/repeatedtestsuite.xml   |  31 ++
 .../access-nested-fields.10.adm                 |   5 +
 .../access-nested-fields.11.adm                 |   5 +
 .../access-nested-fields.12.adm                 |   5 +
 .../access-nested-fields.3.adm                  |   5 +
 .../access-nested-fields.4.adm                  |   5 +
 .../access-nested-fields.5.adm                  |   5 +
 .../access-nested-fields.6.adm                  |   5 +
 .../access-nested-fields.7.adm                  |   5 +
 .../access-nested-fields.8.adm                  |   5 +
 .../access-nested-fields.9.adm                  |   5 +
 .../documentation-example.1.adm                 |   2 +
 .../documentation-example.2.adm                 |   2 +
 .../documentation-example.3.adm                 |   2 +
 .../highly-nested-closed.3.adm                  |   5 +
 .../highly-nested-mixed.3.adm                   |   5 +
 .../highly-nested-open/highly-nested-open.3.adm |   5 +
 .../tiny-social-example.4.adm                   |  25 ++
 .../documentation-example.1.adm                 |   2 +
 .../tiny-social-example-no-complex-types.4.adm  |   2 +
 .../tiny-social-example-no-complex-types.5.adm  |  11 +
 .../tiny-social-example-no-complex-types.6.adm  |  16 +
 .../tiny-social-example-no-complex-types.7.adm  |   5 +
 .../tiny-social-example-no-complex-types.8.adm  |  13 +
 .../tiny-social-example-no-complex-types.9.adm  |   5 +
 .../tiny-social-example-only-lists.4.adm        |   2 +
 .../tiny-social-example-only-lists.5.adm        |  11 +
 .../tiny-social-example-only-lists.6.adm        |  16 +
 .../tiny-social-example-only-lists.7.adm        |   5 +
 .../tiny-social-example-only-lists.8.adm        |  13 +
 .../tiny-social-example-only-lists.9.adm        |   6 +
 .../tiny-social-example-only-records.4.adm      |   2 +
 .../tiny-social-example-only-records.5.adm      |  11 +
 .../tiny-social-example-only-records.6.adm      |  16 +
 .../tiny-social-example-only-records.7.adm      |   5 +
 .../tiny-social-example-only-records.8.adm      |  13 +
 .../tiny-social-example-only-records.9.adm      |   6 +
 .../tiny-social-example.4.adm                   |   2 +
 .../tiny-social-example.5.adm                   |  11 +
 .../tiny-social-example.6.adm                   |  16 +
 .../tiny-social-example.7.adm                   |   5 +
 .../tiny-social-example.8.adm                   |  13 +
 .../tiny-social-example.9.adm                   |   7 +
 .../src/test/resources/runtimets/testsuite.xml  |  65 +--
 .../src/main/resources/schema/asterix-conf.xsd  | 178 ++++----
 .../src/main/resources/schema/yarn_cluster.xsd  | 254 ++++++++----
 asterix-doc/src/site/markdown/aql/functions.md  |  61 +++
 .../indexing/input/AbstractHDFSReader.java      |  23 +-
 .../external/library/JavaFunctionHelper.java    |   8 +-
 .../external/library/java/IJListAccessor.java   |   4 +-
 .../external/library/java/IJRecordAccessor.java |   4 +-
 .../external/library/java/JObjectAccessors.java |  19 +-
 .../library/java/JObjectPointableVisitor.java   |   8 +-
 .../metadata/declared/PKGeneratingAdapter.java  |   6 +-
 .../asterix/builders/AbvsBuilderFactory.java    |  27 ++
 .../asterix/builders/ListBuilderFactory.java    |  29 ++
 .../asterix/builders/RecordBuilderFactory.java  |  25 ++
 .../data/nontagged/printers/ADatePrinter.java   |   8 +-
 .../nontagged/printers/ADateTimePrinter.java    |  10 +-
 .../printers/ADayTimeDurationPrinter.java       |   1 -
 .../data/nontagged/printers/AObjectPrinter.java |  19 +-
 .../data/nontagged/printers/ATimePrinter.java   |  10 +-
 .../data/nontagged/printers/PrintTools.java     |   5 +-
 .../nontagged/printers/csv/ADatePrinter.java    |   1 -
 .../printers/csv/ADateTimePrinter.java          |   1 -
 .../printers/csv/AIntervalPrinter.java          |   2 -
 .../nontagged/printers/csv/AObjectPrinter.java  |  25 +-
 .../printers/json/ADayTimeDurationPrinter.java  |   1 -
 .../printers/json/ADurationPrinter.java         |   2 +-
 .../nontagged/printers/json/AObjectPrinter.java |  26 +-
 .../nontagged/AqlCSVPrinterFactoryProvider.java |  19 +-
 .../AqlJSONPrinterFactoryProvider.java          |  19 +-
 .../nontagged/AqlPrinterFactoryProvider.java    |  21 +-
 .../om/functions/AsterixBuiltinFunctions.java   | 115 ++----
 .../asterix/om/pointables/AListPointable.java   | 181 --------
 .../om/pointables/AListVisitablePointable.java  | 181 ++++++++
 .../asterix/om/pointables/ARecordPointable.java | 288 -------------
 .../pointables/ARecordVisitablePointable.java   | 288 +++++++++++++
 .../om/pointables/PointableAllocator.java       |   4 +-
 .../om/pointables/cast/ACastVisitor.java        |   8 +-
 .../asterix/om/pointables/cast/AListCaster.java |   4 +-
 .../om/pointables/cast/ARecordCaster.java       |   4 +-
 .../pointables/nonvisitor/AListPointable.java   | 193 +++++++++
 .../pointables/nonvisitor/ARecordPointable.java | 335 +++++++++++++++
 .../om/pointables/printer/AListPrinter.java     |   4 +-
 .../om/pointables/printer/APrintVisitor.java    |   8 +-
 .../om/pointables/printer/ARecordPrinter.java   |   4 +-
 .../pointables/printer/csv/APrintVisitor.java   |   8 +-
 .../pointables/printer/csv/ARecordPrinter.java  |   4 +-
 .../pointables/printer/json/AListPrinter.java   |   4 +-
 .../pointables/printer/json/APrintVisitor.java  |   8 +-
 .../pointables/printer/json/ARecordPrinter.java |   4 +-
 .../visitor/IVisitablePointableVisitor.java     |   8 +-
 .../om/typecomputer/impl/AnyTypeComputer.java   |  38 ++
 .../impl/FieldAccessNestedResultType.java       |  23 +-
 .../impl/SubsetCollectionTypeComputer.java      |  71 ++++
 .../asterix/om/util/NonTaggedFormatUtil.java    |   1 +
 .../common/FieldAccessByIndexEvalFactory.java   | 138 -------
 .../common/FieldAccessNestedEvalFactory.java    | 231 -----------
 .../ClosedRecordConstructorDescriptor.java      |  52 +++
 .../OpenRecordConstructorDescriptor.java        | 113 +++++
 .../ClosedRecordConstructorDescriptor.java      |  52 ---
 .../functions/FieldAccessByIndexDescriptor.java |  51 ---
 .../functions/FieldAccessByNameDescriptor.java  | 137 -------
 .../functions/FieldAccessNestedDescriptor.java  |  55 ---
 .../OpenRecordConstructorDescriptor.java        | 113 -----
 .../functions/RecordMergeDescriptor.java        | 262 ------------
 .../records/FieldAccessByIndexDescriptor.java   |  50 +++
 .../records/FieldAccessByIndexEvalFactory.java  | 138 +++++++
 .../records/FieldAccessByNameDescriptor.java    |  43 ++
 .../records/FieldAccessByNameEvalFactory.java   | 111 +++++
 .../records/FieldAccessNestedDescriptor.java    |  54 +++
 .../records/FieldAccessNestedEvalFactory.java   |  68 +++
 .../functions/records/FieldAccessUtil.java      | 194 +++++++++
 .../records/GetRecordFieldValueDescriptor.java  |  50 +++
 .../records/GetRecordFieldValueEvalFactory.java |  98 +++++
 .../records/GetRecordFieldsDescriptor.java      |  50 +++
 .../records/GetRecordFieldsEvalFactory.java     | 101 +++++
 .../functions/records/RecordFieldsUtil.java     | 303 ++++++++++++++
 .../records/RecordMergeDescriptor.java          | 257 ++++++++++++
 .../runtime/formats/NonTaggedDataFormat.java    |  51 ++-
 .../runtime/operators/file/ADMDataParser.java   |  70 +---
 .../testframework/context/TestCaseContext.java  |   1 +
 pom.xml                                         | 126 +++---
 197 files changed, 5855 insertions(+), 2340 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-app/data/classifications/animals.adm
----------------------------------------------------------------------
diff --git a/asterix-app/data/classifications/animals.adm b/asterix-app/data/classifications/animals.adm
new file mode 100644
index 0000000..953f083
--- /dev/null
+++ b/asterix-app/data/classifications/animals.adm
@@ -0,0 +1,4 @@
+{ "id": 1, "class": { "id": 1, "fullClassification": { "id": 1, "Kingdom": "Animalia", "lower": { "id": 1, "Phylum": "Chordata", "lower": { "id": 1, "Class": "Mammalia", "lower": { "id": 1, "Order": "Carnivora", "lower": { "id": 1, "Family": "Mustelinae", "lower": { "id": 1, "Genus": "Gulo", "lower": { "id": 1, "Species": "Gulo" } } } } } } } } }
+{ "id": 2, "class": { "id": 2, "fullClassification": { "id": 2, "Kingdom": "Animalia", "lower": { "id": 2, "Phylum": "Chordata", "lower": { "id": 2, "Class": "Mammalia", "lower": { "id": 2, "Order": "Artiodactyla", "lower": { "id": 2, "Family": "Giraffidae", "lower": { "id": 2, "Genus": "Okapia", "lower": { "id": 2, "Species": "Johnstoni" } } } } } } } } }
+{ "id": 3, "class": { "id": 3, "fullClassification": { "id": 3, "Kingdom": "Animalia", "lower": { "id": 3, "Phylum": "Chordata", "lower": { "id": 3, "Class": "Mammalia", "lower": { "id": 3, "Order": "Atlantogenata", "lower": { "id": 3, "Family": "Afrotheria", "lower": { "id": 3, "Genus": "Paenungulata", "lower": { "id": 3, "Species": "Hyracoidea" } } } } } } } } }
+{ "id": 4, "class": { "id": 4, "fullClassification": { "id": 4, "Kingdom": "Animalia", "lower": { "id": 4, "Phylum": "Chordata", "lower": { "id": 4, "Class": "Aves", "lower": { "id": 4, "Order": "Accipitriformes", "lower": { "id": 4, "Family": "Accipitridae", "lower": { "id": 4, "Genus": "Buteo", "lower": { "id": 4, "Species": "Jamaicensis" } } } } } } } } }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-app/pom.xml
----------------------------------------------------------------------
diff --git a/asterix-app/pom.xml b/asterix-app/pom.xml
index 2db0974..cad13ce 100644
--- a/asterix-app/pom.xml
+++ b/asterix-app/pom.xml
@@ -7,221 +7,224 @@
 	WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ! See the 
 	License for the specific language governing permissions and ! limitations 
 	under the License. ! -->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-  <modelVersion>4.0.0</modelVersion>
-  <parent>
-    <artifactId>asterix</artifactId>
-    <groupId>edu.uci.ics.asterix</groupId>
-    <version>0.8.7-SNAPSHOT</version>
-  </parent>
-  <artifactId>asterix-app</artifactId>
- 
-  <licenses>
-    <license>
-      <name>Apache License, Version 2.0</name>
-      <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
-      <distribution>repo</distribution>
-      <comments>A business-friendly OSS license</comments>
-    </license>
-  </licenses>
- 
-	<build>
-		<plugins>
-			<plugin>
-				<groupId>org.apache.maven.plugins</groupId>
-				<artifactId>maven-compiler-plugin</artifactId>
-				<version>2.3.2</version>
-				<configuration>
-					<source>1.7</source>
-					<target>1.7</target>
-					<fork>true</fork>
-				</configuration>
-			</plugin>
-			<plugin>
-				<groupId>org.codehaus.mojo</groupId>
-				<artifactId>appassembler-maven-plugin</artifactId>
-				<version>1.0</version>
-				<executions>
-					<execution>
-						<configuration>
-							<programs>
-								<program>
-									<mainClass>edu.uci.ics.asterix.drivers.AsterixWebServer</mainClass>
-									<name>asterix-web</name>
-								</program>
-								<program>
-									<mainClass>edu.uci.ics.asterix.drivers.AsterixClientDriver</mainClass>
-									<name>asterix-cmd</name>
-								</program>
-								<program>
-									<mainClass>edu.uci.ics.asterix.drivers.AsterixCLI</mainClass>
-									<name>asterix-cli</name>
-								</program>
-							</programs>
-							<repositoryLayout>flat</repositoryLayout>
-							<repositoryName>lib</repositoryName>
-						</configuration>
-						<phase>package</phase>
-						<goals>
-							<goal>assemble</goal>
-						</goals>
-					</execution>
-				</executions>
-			</plugin>
-			<plugin>
-				<artifactId>maven-assembly-plugin</artifactId>
-				<version>2.2-beta-5</version>
-				<executions>
-					<execution>
-						<configuration>
-							<descriptors>
-								<descriptor>src/main/assembly/binary-assembly.xml</descriptor>
-							</descriptors>
-						</configuration>
-						<phase>package</phase>
-						<goals>
-							<goal>attached</goal>
-						</goals>
-					</execution>
-				</executions>
-			</plugin>
-		</plugins>
-	</build>
+<project
+    xmlns="http://maven.apache.org/POM/4.0.0"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <artifactId>asterix</artifactId>
+        <groupId>edu.uci.ics.asterix</groupId>
+        <version>0.8.7-SNAPSHOT</version>
+    </parent>
+    <artifactId>asterix-app</artifactId>
 
-	<dependencies>
-		<dependency>
-			<groupId>javax.servlet</groupId>
-			<artifactId>servlet-api</artifactId>
-			<type>jar</type>
-		</dependency>
-		<dependency>
-			<groupId>org.eclipse.jetty</groupId>
-			<artifactId>jetty-server</artifactId>
-			<version>8.0.0.M2</version>
-			<type>jar</type>
-			<scope>compile</scope>
-		</dependency>
-		<dependency>
-			<groupId>org.eclipse.jetty</groupId>
-			<artifactId>jetty-servlet</artifactId>
-			<version>8.0.0.M2</version>
-			<type>jar</type>
-			<scope>compile</scope>
-		</dependency>
-		<dependency>
-			<groupId>edu.uci.ics.hyracks</groupId>
-			<artifactId>hyracks-control-cc</artifactId>
-		</dependency>
-		<dependency>
-			<groupId>edu.uci.ics.hyracks</groupId>
-			<artifactId>hyracks-control-nc</artifactId>
-		</dependency>
-		<dependency>
-			<groupId>edu.uci.ics.hyracks</groupId>
-			<artifactId>algebricks-compiler</artifactId>
-		</dependency>
-		<dependency>
-			<groupId>edu.uci.ics.hyracks</groupId>
-			<artifactId>hyracks-client</artifactId>
-		</dependency>
-		<dependency>
-			<groupId>edu.uci.ics.asterix</groupId>
-			<artifactId>asterix-algebra</artifactId>
-			<version>0.8.7-SNAPSHOT</version>
-			<scope>compile</scope>
-		</dependency>
-		<dependency>
-			<groupId>edu.uci.ics.asterix</groupId>
-			<artifactId>asterix-aql</artifactId>
-			<version>0.8.7-SNAPSHOT</version>
-			<type>jar</type>
-			<scope>compile</scope>
-		</dependency>
-		<dependency>
-			<groupId>edu.uci.ics.asterix</groupId>
-			<artifactId>asterix-om</artifactId>
-			<version>0.8.7-SNAPSHOT</version>
-			<type>jar</type>
-			<scope>compile</scope>
-		</dependency>
-		<dependency>
-			<groupId>edu.uci.ics.asterix</groupId>
-			<artifactId>asterix-metadata</artifactId>
-			<version>0.8.7-SNAPSHOT</version>
-			<type>jar</type>
-			<scope>compile</scope>
-		</dependency>
-		<dependency>
-			<groupId>edu.uci.ics.asterix</groupId>
-			<artifactId>asterix-tools</artifactId>
-			<version>0.8.7-SNAPSHOT</version>
-			<type>jar</type>
-			<scope>compile</scope>
-		</dependency>
-		<dependency>
-			<groupId>edu.uci.ics.asterix</groupId>
-			<artifactId>asterix-common</artifactId>
-			<version>0.8.7-SNAPSHOT</version>
-			<type>jar</type>
-			<scope>compile</scope>
-		</dependency>
-		<dependency>
-			<groupId>edu.uci.ics.asterix</groupId>
-			<artifactId>asterix-common</artifactId>
-			<version>0.8.7-SNAPSHOT</version>
-			<type>test-jar</type>
-			<scope>test</scope>
-		</dependency>
+    <licenses>
+        <license>
+            <name>Apache License, Version 2.0</name>
+            <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
+            <distribution>repo</distribution>
+            <comments>A business-friendly OSS license</comments>
+        </license>
+    </licenses>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-compiler-plugin</artifactId>
+                <version>2.3.2</version>
+                <configuration>
+                    <source>1.7</source>
+                    <target>1.7</target>
+                    <fork>true</fork>
+                </configuration>
+            </plugin>
+            <plugin>
+                <groupId>org.codehaus.mojo</groupId>
+                <artifactId>appassembler-maven-plugin</artifactId>
+                <version>1.0</version>
+                <executions>
+                    <execution>
+                        <configuration>
+                            <programs>
+                                <program>
+                                    <mainClass>edu.uci.ics.asterix.drivers.AsterixWebServer</mainClass>
+                                    <name>asterix-web</name>
+                                </program>
+                                <program>
+                                    <mainClass>edu.uci.ics.asterix.drivers.AsterixClientDriver</mainClass>
+                                    <name>asterix-cmd</name>
+                                </program>
+                                <program>
+                                    <mainClass>edu.uci.ics.asterix.drivers.AsterixCLI</mainClass>
+                                    <name>asterix-cli</name>
+                                </program>
+                            </programs>
+                            <repositoryLayout>flat</repositoryLayout>
+                            <repositoryName>lib</repositoryName>
+                        </configuration>
+                        <phase>package</phase>
+                        <goals>
+                            <goal>assemble</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+            <plugin>
+                <artifactId>maven-assembly-plugin</artifactId>
+                <version>2.2-beta-5</version>
+                <executions>
+                    <execution>
+                        <configuration>
+                            <descriptors>
+                                <descriptor>src/main/assembly/binary-assembly.xml</descriptor>
+                            </descriptors>
+                        </configuration>
+                        <phase>package</phase>
+                        <goals>
+                            <goal>attached</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+        </plugins>
+    </build>
+
+    <dependencies>
+        <dependency>
+            <groupId>javax.servlet</groupId>
+            <artifactId>servlet-api</artifactId>
+            <type>jar</type>
+        </dependency>
+        <dependency>
+            <groupId>org.eclipse.jetty</groupId>
+            <artifactId>jetty-server</artifactId>
+            <version>8.0.0.M2</version>
+            <type>jar</type>
+            <scope>compile</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.eclipse.jetty</groupId>
+            <artifactId>jetty-servlet</artifactId>
+            <version>8.0.0.M2</version>
+            <type>jar</type>
+            <scope>compile</scope>
+        </dependency>
+        <dependency>
+            <groupId>edu.uci.ics.hyracks</groupId>
+            <artifactId>hyracks-control-cc</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>edu.uci.ics.hyracks</groupId>
+            <artifactId>hyracks-control-nc</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>edu.uci.ics.hyracks</groupId>
+            <artifactId>algebricks-compiler</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>edu.uci.ics.hyracks</groupId>
+            <artifactId>hyracks-client</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>edu.uci.ics.asterix</groupId>
+            <artifactId>asterix-algebra</artifactId>
+            <version>0.8.7-SNAPSHOT</version>
+            <scope>compile</scope>
+        </dependency>
+        <dependency>
+            <groupId>edu.uci.ics.asterix</groupId>
+            <artifactId>asterix-aql</artifactId>
+            <version>0.8.7-SNAPSHOT</version>
+            <type>jar</type>
+            <scope>compile</scope>
+        </dependency>
+        <dependency>
+            <groupId>edu.uci.ics.asterix</groupId>
+            <artifactId>asterix-om</artifactId>
+            <version>0.8.7-SNAPSHOT</version>
+            <type>jar</type>
+            <scope>compile</scope>
+        </dependency>
+        <dependency>
+            <groupId>edu.uci.ics.asterix</groupId>
+            <artifactId>asterix-metadata</artifactId>
+            <version>0.8.7-SNAPSHOT</version>
+            <type>jar</type>
+            <scope>compile</scope>
+        </dependency>
+        <dependency>
+            <groupId>edu.uci.ics.asterix</groupId>
+            <artifactId>asterix-tools</artifactId>
+            <version>0.8.7-SNAPSHOT</version>
+            <type>jar</type>
+            <scope>compile</scope>
+        </dependency>
+        <dependency>
+            <groupId>edu.uci.ics.asterix</groupId>
+            <artifactId>asterix-common</artifactId>
+            <version>0.8.7-SNAPSHOT</version>
+            <type>jar</type>
+            <scope>compile</scope>
+        </dependency>
+        <dependency>
+            <groupId>edu.uci.ics.asterix</groupId>
+            <artifactId>asterix-common</artifactId>
+            <version>0.8.7-SNAPSHOT</version>
+            <type>test-jar</type>
+            <scope>test</scope>
+        </dependency>
 		<!-- posssible remove this <dependency> <groupId>com.kenai.nbpwr</groupId> 
 			<artifactId>org-apache-commons-io</artifactId> <version>1.3.1-201002241208</version> 
 			<scope>test</scope> </dependency> -->
-		<dependency>
-			<groupId>edu.uci.ics.asterix</groupId>
-			<artifactId>asterix-transactions</artifactId>
-			<version>0.8.7-SNAPSHOT</version>
-			<scope>compile</scope>
-		</dependency>
-		<dependency>
-			<groupId>org.apache.hadoop</groupId>
-			<artifactId>hadoop-client</artifactId>
-			<type>jar</type>
-		</dependency>
-		<dependency>
-			<groupId>org.apache.hadoop</groupId>
-			<artifactId>hadoop-hdfs</artifactId>
-			<type>jar</type>
-			<scope>test</scope>
-		</dependency>
-		<dependency>
-			<groupId>xerces</groupId>
-			<artifactId>xercesImpl</artifactId>
-			<version>2.9.1</version>
-			<type>jar</type>
-			<scope>compile</scope>
-		</dependency>
-		<dependency>
-			<groupId>xalan</groupId>
-			<artifactId>xalan</artifactId>
-			<version>2.7.1</version>
-			<type>jar</type>
-			<scope>test</scope>
-		</dependency>
-		<dependency>
-			<groupId>edu.uci.ics.asterix</groupId>
-			<artifactId>asterix-test-framework</artifactId>
-			<version>0.8.7-SNAPSHOT</version>
-			<scope>test</scope>
-		</dependency>
+        <dependency>
+            <groupId>edu.uci.ics.asterix</groupId>
+            <artifactId>asterix-transactions</artifactId>
+            <version>0.8.7-SNAPSHOT</version>
+            <scope>compile</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.hadoop</groupId>
+            <artifactId>hadoop-client</artifactId>
+            <type>jar</type>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.hadoop</groupId>
+            <artifactId>hadoop-hdfs</artifactId>
+            <type>jar</type>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>xerces</groupId>
+            <artifactId>xercesImpl</artifactId>
+            <version>2.9.1</version>
+            <type>jar</type>
+            <scope>compile</scope>
+        </dependency>
+        <dependency>
+            <groupId>xalan</groupId>
+            <artifactId>xalan</artifactId>
+            <version>2.7.1</version>
+            <type>jar</type>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>edu.uci.ics.asterix</groupId>
+            <artifactId>asterix-test-framework</artifactId>
+            <version>0.8.7-SNAPSHOT</version>
+            <scope>test</scope>
+        </dependency>
         <dependency>
             <groupId>org.mockito</groupId>
             <artifactId>mockito-all</artifactId>
             <version>1.10.19</version>
         </dependency>
         <dependency>
-        <groupId>com.e-movimento.tinytools</groupId>
+            <groupId>com.e-movimento.tinytools</groupId>
             <artifactId>privilegedaccessor</artifactId>
             <version>1.2.2</version>
         </dependency>
-	</dependencies>
+    </dependencies>
 
 </project>

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-app/src/main/java/edu/uci/ics/asterix/api/common/AsterixHyracksIntegrationUtil.java
----------------------------------------------------------------------
diff --git a/asterix-app/src/main/java/edu/uci/ics/asterix/api/common/AsterixHyracksIntegrationUtil.java b/asterix-app/src/main/java/edu/uci/ics/asterix/api/common/AsterixHyracksIntegrationUtil.java
index a1c5348..91aa897 100644
--- a/asterix-app/src/main/java/edu/uci/ics/asterix/api/common/AsterixHyracksIntegrationUtil.java
+++ b/asterix-app/src/main/java/edu/uci/ics/asterix/api/common/AsterixHyracksIntegrationUtil.java
@@ -32,16 +32,15 @@ import edu.uci.ics.hyracks.control.nc.NodeControllerService;
 
 public class AsterixHyracksIntegrationUtil {
 
-    public static final String[] NC_IDS = { "nc1", "nc2" };
-    public static final String[] ASTERIX_DATA_DIRS = new String[] { "nc1data", "nc2data" };
+    public static final int NODES = 2;
+    public static final int PARTITONS = 2;
 
     public static final int DEFAULT_HYRACKS_CC_CLIENT_PORT = 1098;
 
     public static final int DEFAULT_HYRACKS_CC_CLUSTER_PORT = 1099;
 
     private static ClusterControllerService cc;
-    private static NodeControllerService nc1;
-    private static NodeControllerService nc2;
+    private static NodeControllerService[] ncs = new NodeControllerService[NODES];
     private static IHyracksClientConnection hcc;
 
     public static void init() throws Exception {
@@ -58,48 +57,61 @@ public class AsterixHyracksIntegrationUtil {
         cc = new ClusterControllerService(ccConfig);
         cc.start();
 
-        NCConfig ncConfig1 = new NCConfig();
-        ncConfig1.ccHost = "localhost";
-        ncConfig1.ccPort = DEFAULT_HYRACKS_CC_CLUSTER_PORT;
-        ncConfig1.clusterNetIPAddress = "127.0.0.1";
-        ncConfig1.dataIPAddress = "127.0.0.1";
-        ncConfig1.resultIPAddress = "127.0.0.1";
-        ncConfig1.nodeId = NC_IDS[0];
-        ncConfig1.resultTTL = 30000;
-        ncConfig1.resultSweepThreshold = 1000;
-        ncConfig1.ioDevices = System.getProperty("java.io.tmpdir") + File.separator + "nc1/iodevice0" + ","
-                + System.getProperty("java.io.tmpdir") + File.separator + "nc1/iodevice1";
-        ncConfig1.appNCMainClass = NCApplicationEntryPoint.class.getName();
-        nc1 = new NodeControllerService(ncConfig1);
-        nc1.start();
-
-        NCConfig ncConfig2 = new NCConfig();
-        ncConfig2.ccHost = "localhost";
-        ncConfig2.ccPort = DEFAULT_HYRACKS_CC_CLUSTER_PORT;
-        ncConfig2.clusterNetIPAddress = "127.0.0.1";
-        ncConfig2.dataIPAddress = "127.0.0.1";
-        ncConfig2.resultIPAddress = "127.0.0.1";
-        ncConfig2.nodeId = NC_IDS[1];
-        ncConfig2.resultTTL = 30000;
-        ncConfig2.resultSweepThreshold = 1000;
-        ncConfig2.ioDevices = System.getProperty("java.io.tmpdir") + File.separator + "nc2/iodevice0" + ","
-                + System.getProperty("java.io.tmpdir") + File.separator + "nc2/iodevice1";
-        ncConfig2.appNCMainClass = NCApplicationEntryPoint.class.getName();
-        nc2 = new NodeControllerService(ncConfig2);
-        nc2.start();
+        int n = 0;
+        for (String ncName : getNcNames()) {
+            NCConfig ncConfig1 = new NCConfig();
+            ncConfig1.ccHost = "localhost";
+            ncConfig1.ccPort = DEFAULT_HYRACKS_CC_CLUSTER_PORT;
+            ncConfig1.clusterNetIPAddress = "127.0.0.1";
+            ncConfig1.dataIPAddress = "127.0.0.1";
+            ncConfig1.resultIPAddress = "127.0.0.1";
+            ncConfig1.nodeId = ncName;
+            ncConfig1.resultTTL = 30000;
+            ncConfig1.resultSweepThreshold = 1000;
+            for (int p = 0; p < PARTITONS; ++p) {
+                if (p == 0) {
+                    ncConfig1.ioDevices = System.getProperty("java.io.tmpdir") + File.separator + ncConfig1.nodeId
+                            + "/iodevice" + p;
+                } else {
+                    ncConfig1.ioDevices += "," + System.getProperty("java.io.tmpdir") + File.separator
+                            + ncConfig1.nodeId + "/iodevice" + p;
+                }
+            }
+            ncConfig1.appNCMainClass = NCApplicationEntryPoint.class.getName();
+            ncs[n] = new NodeControllerService(ncConfig1);
+            ncs[n].start();
+            ++n;
+        }
 
         hcc = new HyracksConnection(cc.getConfig().clientNetIpAddress, cc.getConfig().clientNetPort);
     }
 
+    public static String[] getNcNames() {
+        String[] names = new String[NODES];
+        for (int n = 0; n < NODES; ++n) {
+            names[n] = "nc" + (n + 1);
+        }
+        return names;
+    }
+
+    public static String[] getDataDirs() {
+        String[] names = new String[NODES];
+        for (int n = 0; n < NODES; ++n) {
+            names[n] = "nc" + (n + 1) + "data";
+        }
+        return names;
+    }
+
     public static IHyracksClientConnection getHyracksClientConnection() {
         return hcc;
     }
 
     public static void deinit() throws Exception {
-        if (nc2 != null)
-            nc2.stop();
-        if (nc1 != null)
-            nc1.stop();
+        for (int n = 0; n < ncs.length; ++n) {
+            if (ncs[n] != null)
+                ncs[n].stop();
+
+        }
         if (cc != null)
             cc.stop();
     }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-app/src/test/java/edu/uci/ics/asterix/test/metadata/MetadataTest.java
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/java/edu/uci/ics/asterix/test/metadata/MetadataTest.java b/asterix-app/src/test/java/edu/uci/ics/asterix/test/metadata/MetadataTest.java
index 0197d4a..069c5aa 100644
--- a/asterix-app/src/test/java/edu/uci/ics/asterix/test/metadata/MetadataTest.java
+++ b/asterix-app/src/test/java/edu/uci/ics/asterix/test/metadata/MetadataTest.java
@@ -73,13 +73,13 @@ public class MetadataTest {
         }
 
         // clean up the files written by the ASTERIX storage manager
-        for (String d : AsterixHyracksIntegrationUtil.ASTERIX_DATA_DIRS) {
+        for (String d : AsterixHyracksIntegrationUtil.getDataDirs()) {
             TestsUtils.deleteRec(new File(d));
         }
     }
 
     private static void deleteTransactionLogs() throws Exception {
-        for (String ncId : AsterixHyracksIntegrationUtil.NC_IDS) {
+        for (String ncId : AsterixHyracksIntegrationUtil.getNcNames()) {
             File log = new File(txnProperties.getLogDirectory(ncId));
             if (log.exists()) {
                 FileUtils.deleteDirectory(log);

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-app/src/test/java/edu/uci/ics/asterix/test/optimizer/OptimizerTest.java
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/java/edu/uci/ics/asterix/test/optimizer/OptimizerTest.java b/asterix-app/src/test/java/edu/uci/ics/asterix/test/optimizer/OptimizerTest.java
index 7171642..58531aa 100644
--- a/asterix-app/src/test/java/edu/uci/ics/asterix/test/optimizer/OptimizerTest.java
+++ b/asterix-app/src/test/java/edu/uci/ics/asterix/test/optimizer/OptimizerTest.java
@@ -89,7 +89,7 @@ public class OptimizerTest {
     }
 
     private static void deleteTransactionLogs() throws Exception {
-        for (String ncId : AsterixHyracksIntegrationUtil.NC_IDS) {
+        for (String ncId : AsterixHyracksIntegrationUtil.getNcNames()) {
             File log = new File(txnProperties.getLogDirectory(ncId));
             if (log.exists()) {
                 FileUtils.deleteDirectory(log);

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-app/src/test/java/edu/uci/ics/asterix/test/runtime/ExecutionTest.java
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/java/edu/uci/ics/asterix/test/runtime/ExecutionTest.java b/asterix-app/src/test/java/edu/uci/ics/asterix/test/runtime/ExecutionTest.java
index 3e5b734..8547eb0 100644
--- a/asterix-app/src/test/java/edu/uci/ics/asterix/test/runtime/ExecutionTest.java
+++ b/asterix-app/src/test/java/edu/uci/ics/asterix/test/runtime/ExecutionTest.java
@@ -44,16 +44,15 @@ import edu.uci.ics.asterix.testframework.context.TestCaseContext;
 @RunWith(Parameterized.class)
 public class ExecutionTest {
 
-    private static final Logger LOGGER = Logger.getLogger(ExecutionTest.class.getName());
+    protected static final Logger LOGGER = Logger.getLogger(ExecutionTest.class.getName());
 
-    private static final String PATH_ACTUAL = "rttest" + File.separator;
-    private static final String PATH_BASE = StringUtils.join(new String[] { "src", "test", "resources", "runtimets" },
-            File.separator);
+    protected static final String PATH_ACTUAL = "rttest" + File.separator;
+    protected static final String PATH_BASE = StringUtils.join(
+            new String[] { "src", "test", "resources", "runtimets" }, File.separator);
 
-    private static final String TEST_CONFIG_FILE_NAME = "asterix-build-configuration.xml";
-    private static final String[] ASTERIX_DATA_DIRS = new String[] { "nc1data", "nc2data" };
+    protected static final String TEST_CONFIG_FILE_NAME = "asterix-build-configuration.xml";
 
-    private static AsterixTransactionProperties txnProperties;
+    protected static AsterixTransactionProperties txnProperties;
 
     @BeforeClass
     public static void setUp() throws Exception {
@@ -96,14 +95,14 @@ public class ExecutionTest {
             outdir.delete();
         }
         // clean up the files written by the ASTERIX storage manager
-        for (String d : ASTERIX_DATA_DIRS) {
+        for (String d : AsterixHyracksIntegrationUtil.getDataDirs()) {
             TestsUtils.deleteRec(new File(d));
         }
         HDFSCluster.getInstance().cleanup();
     }
 
     private static void deleteTransactionLogs() throws Exception {
-        for (String ncId : AsterixHyracksIntegrationUtil.NC_IDS) {
+        for (String ncId : AsterixHyracksIntegrationUtil.getNcNames()) {
             File log = new File(txnProperties.getLogDirectory(ncId));
             if (log.exists()) {
                 FileUtils.deleteDirectory(log);
@@ -120,7 +119,7 @@ public class ExecutionTest {
         return testArgs;
     }
 
-    private static Collection<Object[]> buildTestsInXml(String xmlfile) throws Exception {
+    protected static Collection<Object[]> buildTestsInXml(String xmlfile) throws Exception {
         Collection<Object[]> testArgs = new ArrayList<Object[]>();
         TestCaseContext.Builder b = new TestCaseContext.Builder();
         for (TestCaseContext ctx : b.build(new File(PATH_BASE), xmlfile)) {
@@ -130,7 +129,7 @@ public class ExecutionTest {
 
     }
 
-    private TestCaseContext tcCtx;
+    protected TestCaseContext tcCtx;
 
     public ExecutionTest(TestCaseContext tcCtx) {
         this.tcCtx = tcCtx;

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-app/src/test/java/edu/uci/ics/asterix/test/runtime/RepeatedTest.java
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/java/edu/uci/ics/asterix/test/runtime/RepeatedTest.java b/asterix-app/src/test/java/edu/uci/ics/asterix/test/runtime/RepeatedTest.java
new file mode 100644
index 0000000..faeb688
--- /dev/null
+++ b/asterix-app/src/test/java/edu/uci/ics/asterix/test/runtime/RepeatedTest.java
@@ -0,0 +1,105 @@
+/*
+ * Copyright 2009-2013 by The Regents of the University of California
+ * Licensed 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 from
+ *
+ *     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.
+ */
+package edu.uci.ics.asterix.test.runtime;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+import java.util.Collection;
+
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.MethodRule;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+import org.junit.runners.Parameterized.Parameters;
+import org.junit.runners.model.FrameworkMethod;
+import org.junit.runners.model.Statement;
+
+import edu.uci.ics.asterix.test.aql.TestsUtils;
+import edu.uci.ics.asterix.test.runtime.RepeatRule.Repeat;
+import edu.uci.ics.asterix.testframework.context.TestCaseContext;
+
+/**
+ * Runs runtime test cases that have been identified in the repeatedtestsuite.xml.
+ * 
+ * Each test is run 10000 times.
+ */
+class RepeatRule implements MethodRule {
+
+    @Retention(RetentionPolicy.RUNTIME)
+    @Target({ java.lang.annotation.ElementType.METHOD })
+    public @interface Repeat {
+        public abstract int times();
+
+    }
+
+    private static class RepeatStatement extends Statement {
+
+        private final int times;
+        private final Statement statement;
+
+        private RepeatStatement(int times, Statement statement) {
+            this.times = times;
+            this.statement = statement;
+        }
+
+        @Override
+        public void evaluate() throws Throwable {
+            for (int i = 0; i < times; i++) {
+                statement.evaluate();
+            }
+        }
+    }
+
+    @Override
+    public Statement apply(Statement statement, FrameworkMethod method, Object target) {
+        Statement result = statement;
+        Repeat repeat = method.getAnnotation(Repeat.class);
+        if (repeat != null) {
+            int times = repeat.times();
+            result = new RepeatStatement(times, statement);
+        }
+        return result;
+
+    }
+}
+
+@RunWith(Parameterized.class)
+public class RepeatedTest extends ExecutionTest {
+
+    private int count;
+    
+    @Parameters
+    public static Collection<Object[]> tests() throws Exception {
+        Collection<Object[]> testArgs = buildTestsInXml(TestCaseContext.DEFAULT_REPEADED_TESTSUITE_XML_NAME);
+        return testArgs;
+    }
+
+    public RepeatedTest(TestCaseContext tcCtx) {
+        super(tcCtx);
+        count = 0;
+    }
+
+    @Rule
+    public RepeatRule repeatRule = new RepeatRule();
+
+    @Test
+    @Repeat(times = 10000)
+    public void test() throws Exception {
+        System.err.println("***** Test Count: " + (++count) + " ******");
+        TestsUtils.executeTest(PATH_ACTUAL, tcCtx, null, false);
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/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
new file mode 100644
index 0000000..283cdea
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/records/RecordsQueries.xml
@@ -0,0 +1,127 @@
+<!--
+ ! Copyright 2009-2013 by The Regents of the University of California
+ ! Licensed 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 from
+ !
+ !     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="records">
+            <compilation-unit name="access-nested-fields">
+                <output-dir compare="Text">access-nested-fields</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="records">
+            <compilation-unit name="closed-record-constructor_01">
+                <output-dir compare="Text">closed-record-constructor_01</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="records">
+            <compilation-unit name="closed-record-constructor_02">
+                <output-dir compare="Text">closed-record-constructor_02</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="records">
+            <compilation-unit name="closed-record-constructor_03">
+                <output-dir compare="Text">closed-record-constructor_03</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="records">
+            <compilation-unit name="expFieldName">
+                <output-dir compare="Text">expFieldName</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="records">
+            <compilation-unit name="field-access-by-index_01">
+                <output-dir compare="Text">field-access-by-index_01</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="records">
+            <compilation-unit name="field-access-on-open-field">
+                <output-dir compare="Text">field-access-on-open-field</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="records/get-record-fields">
+            <compilation-unit name="documentation-example">
+                <output-dir compare="Text">documentation-example</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="records/get-record-fields">
+            <compilation-unit name="tiny-social-example">
+                <output-dir compare="Text">tiny-social-example</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="records/get-record-fields">
+            <compilation-unit name="tiny-social-example-no-complex-types">
+                <output-dir compare="Text">tiny-social-example-no-complex-types</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="records/get-record-fields">
+            <compilation-unit name="tiny-social-example-only-lists">
+                <output-dir compare="Text">tiny-social-example-only-lists</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="records/get-record-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/get-record-field-value">
+            <compilation-unit name="documentation-example">
+                <output-dir compare="Text">documentation-example</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="records/get-record-field-value">
+            <compilation-unit name="highly-nested-closed">
+                <output-dir compare="Text">highly-nested-closed</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="records/get-record-field-value">
+            <compilation-unit name="highly-nested-mixed">
+                <output-dir compare="Text">highly-nested-mixed</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="records/get-record-field-value">
+            <compilation-unit name="highly-nested-open">
+                <output-dir compare="Text">highly-nested-open</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="records/get-record-field-value">
+            <compilation-unit name="tiny-social-example">
+                <output-dir compare="Text">tiny-social-example</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="records">
+            <compilation-unit name="open-record-constructor_01">
+                <output-dir compare="Text">open-record-constructor_01</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="records">
+            <compilation-unit name="open-record-constructor_02">
+                <output-dir compare="Text">open-record-constructor_02</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="records">
+            <compilation-unit name="closed-closed-fieldname-conflict_issue173">
+                <output-dir compare="Text">closed-closed-fieldname-conflict_issue173</output-dir>
+                <expected-error>edu.uci.ics.asterix.common.exceptions.AsterixException</expected-error>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="records">
+            <compilation-unit name="open-closed-fieldname-conflict_issue173">
+                <output-dir compare="Text">open-closed-fieldname-conflict_issue173</output-dir>
+                <expected-error>edu.uci.ics.asterix.common.exceptions.AsterixException</expected-error>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="records">
+            <compilation-unit name="open-open-fieldname-conflict_issue173">
+                <output-dir compare="Text">open-open-fieldname-conflict_issue173</output-dir>
+                <expected-error>edu.uci.ics.asterix.common.exceptions.AsterixException</expected-error>
+            </compilation-unit>
+        </test-case>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-app/src/test/resources/runtimets/queries/records/access-nested-fields/access-nested-fields.1.ddl.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/records/access-nested-fields/access-nested-fields.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/records/access-nested-fields/access-nested-fields.1.ddl.aql
new file mode 100644
index 0000000..6681a75
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/records/access-nested-fields/access-nested-fields.1.ddl.aql
@@ -0,0 +1,60 @@
+/*
+* Description  : Access a records nested records at each level.
+* 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 closed{
+	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/incubator-asterixdb/blob/900bf134/asterix-app/src/test/resources/runtimets/queries/records/access-nested-fields/access-nested-fields.10.query.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/records/access-nested-fields/access-nested-fields.10.query.aql b/asterix-app/src/test/resources/runtimets/queries/records/access-nested-fields/access-nested-fields.10.query.aql
new file mode 100644
index 0000000..f7198ce
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/records/access-nested-fields/access-nested-fields.10.query.aql
@@ -0,0 +1,11 @@
+/*
+* Description  : Access a records nested records at each level.
+* Expected Res : Success
+* Date         : 04 Jun 2015
+*/
+use dataverse test;
+
+for $test in dataset Animals
+let $result := $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/900bf134/asterix-app/src/test/resources/runtimets/queries/records/access-nested-fields/access-nested-fields.11.query.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/records/access-nested-fields/access-nested-fields.11.query.aql b/asterix-app/src/test/resources/runtimets/queries/records/access-nested-fields/access-nested-fields.11.query.aql
new file mode 100644
index 0000000..262bee1
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/records/access-nested-fields/access-nested-fields.11.query.aql
@@ -0,0 +1,11 @@
+/*
+* Description  : Access a records nested records at each level.
+* Expected Res : Success
+* Date         : 04 Jun 2015
+*/
+use dataverse test;
+
+for $test in dataset Animals
+let $result := $test.class
+order by $result.id
+return $result;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-app/src/test/resources/runtimets/queries/records/access-nested-fields/access-nested-fields.12.query.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/records/access-nested-fields/access-nested-fields.12.query.aql b/asterix-app/src/test/resources/runtimets/queries/records/access-nested-fields/access-nested-fields.12.query.aql
new file mode 100644
index 0000000..2b28594
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/records/access-nested-fields/access-nested-fields.12.query.aql
@@ -0,0 +1,11 @@
+/*
+* Description  : Access a records nested records at each level.
+* Expected Res : Success
+* Date         : 04 Jun 2015
+*/
+use dataverse test;
+
+for $test in dataset Animals
+let $result := $test
+order by $result.id
+return $result;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-app/src/test/resources/runtimets/queries/records/access-nested-fields/access-nested-fields.2.update.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/records/access-nested-fields/access-nested-fields.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/records/access-nested-fields/access-nested-fields.2.update.aql
new file mode 100644
index 0000000..73ce6f5
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/records/access-nested-fields/access-nested-fields.2.update.aql
@@ -0,0 +1,10 @@
+/*
+* Description  : Access a records nested records at each level.
+* Expected Res : Success
+* Date         : 04 Jun 2015
+*/
+
+use dataverse test;
+
+load dataset Animals using localfs
+(("path"="nc1://data/classifications/animals.adm"),("format"="adm"));

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-app/src/test/resources/runtimets/queries/records/access-nested-fields/access-nested-fields.3.query.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/records/access-nested-fields/access-nested-fields.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/records/access-nested-fields/access-nested-fields.3.query.aql
new file mode 100644
index 0000000..e92f44e
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/records/access-nested-fields/access-nested-fields.3.query.aql
@@ -0,0 +1,12 @@
+/*
+* Description  : Access a records nested records at each level.
+* Expected Res : Success
+* Date         : 04 Jun 2015
+*/
+
+use dataverse test;
+
+for $test in dataset Animals
+let $result := $test.class.fullClassification.lower.lower.lower.lower.lower.lower.Species
+order by $result
+return $result;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-app/src/test/resources/runtimets/queries/records/access-nested-fields/access-nested-fields.4.query.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/records/access-nested-fields/access-nested-fields.4.query.aql b/asterix-app/src/test/resources/runtimets/queries/records/access-nested-fields/access-nested-fields.4.query.aql
new file mode 100644
index 0000000..6e8e9c8
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/records/access-nested-fields/access-nested-fields.4.query.aql
@@ -0,0 +1,12 @@
+/*
+* Description  : Access a records nested records at each level.
+* Expected Res : Success
+* Date         : 04 Jun 2015
+*/
+
+use dataverse test;
+
+for $test in dataset Animals
+let $result := $test.class.fullClassification.lower.lower.lower.lower.lower.lower
+order by $result.id
+return $result;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-app/src/test/resources/runtimets/queries/records/access-nested-fields/access-nested-fields.5.query.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/records/access-nested-fields/access-nested-fields.5.query.aql b/asterix-app/src/test/resources/runtimets/queries/records/access-nested-fields/access-nested-fields.5.query.aql
new file mode 100644
index 0000000..718129a
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/records/access-nested-fields/access-nested-fields.5.query.aql
@@ -0,0 +1,12 @@
+/*
+* Description  : Access a records nested records at each level.
+* Expected Res : Success
+* Date         : 04 Jun 2015
+*/
+
+use dataverse test;
+
+for $test in dataset Animals
+let $result := $test.class.fullClassification.lower.lower.lower.lower.lower
+order by $result.id
+return $result;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-app/src/test/resources/runtimets/queries/records/access-nested-fields/access-nested-fields.6.query.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/records/access-nested-fields/access-nested-fields.6.query.aql b/asterix-app/src/test/resources/runtimets/queries/records/access-nested-fields/access-nested-fields.6.query.aql
new file mode 100644
index 0000000..5ee7ad6
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/records/access-nested-fields/access-nested-fields.6.query.aql
@@ -0,0 +1,12 @@
+/*
+* Description  : Access a records nested records at each level.
+* Expected Res : Success
+* Date         : 04 Jun 2015
+*/
+
+use dataverse test;
+
+for $test in dataset Animals
+let $result := $test.class.fullClassification.lower.lower.lower.lower
+order by $result.id
+return $result;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-app/src/test/resources/runtimets/queries/records/access-nested-fields/access-nested-fields.7.query.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/records/access-nested-fields/access-nested-fields.7.query.aql b/asterix-app/src/test/resources/runtimets/queries/records/access-nested-fields/access-nested-fields.7.query.aql
new file mode 100644
index 0000000..30d6496
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/records/access-nested-fields/access-nested-fields.7.query.aql
@@ -0,0 +1,12 @@
+/*
+* Description  : Access a records nested records at each level.
+* Expected Res : Success
+* Date         : 04 Jun 2015
+*/
+
+use dataverse test;
+
+for $test in dataset Animals
+let $result := $test.class.fullClassification.lower.lower.lower
+order by $result.id
+return $result;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-app/src/test/resources/runtimets/queries/records/access-nested-fields/access-nested-fields.8.query.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/records/access-nested-fields/access-nested-fields.8.query.aql b/asterix-app/src/test/resources/runtimets/queries/records/access-nested-fields/access-nested-fields.8.query.aql
new file mode 100644
index 0000000..fd9c55d
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/records/access-nested-fields/access-nested-fields.8.query.aql
@@ -0,0 +1,11 @@
+/*
+* Description  : Access a records nested records at each level.
+* Expected Res : Success
+* Date         : 04 Jun 2015
+*/
+use dataverse test;
+
+for $test in dataset Animals
+let $result := $test.class.fullClassification.lower.lower
+order by $result.id
+return $result;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-app/src/test/resources/runtimets/queries/records/access-nested-fields/access-nested-fields.9.query.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/records/access-nested-fields/access-nested-fields.9.query.aql b/asterix-app/src/test/resources/runtimets/queries/records/access-nested-fields/access-nested-fields.9.query.aql
new file mode 100644
index 0000000..a4fff3d
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/records/access-nested-fields/access-nested-fields.9.query.aql
@@ -0,0 +1,11 @@
+/*
+* Description  : Access a records nested records at each level.
+* Expected Res : Success
+* Date         : 04 Jun 2015
+*/
+use dataverse test;
+
+for $test in dataset Animals
+let $result := $test.class.fullClassification.lower
+order by $result.id
+return $result;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-app/src/test/resources/runtimets/queries/records/get-record-field-value/documentation-example/documentation-example.1.query.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/records/get-record-field-value/documentation-example/documentation-example.1.query.aql b/asterix-app/src/test/resources/runtimets/queries/records/get-record-field-value/documentation-example/documentation-example.1.query.aql
new file mode 100644
index 0000000..2876ebf
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/records/get-record-field-value/documentation-example/documentation-example.1.query.aql
@@ -0,0 +1,10 @@
+/*
+* Description  : Testing get-record-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-record-field-value($r1, "project")

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-app/src/test/resources/runtimets/queries/records/get-record-field-value/documentation-example/documentation-example.2.query.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/records/get-record-field-value/documentation-example/documentation-example.2.query.aql b/asterix-app/src/test/resources/runtimets/queries/records/get-record-field-value/documentation-example/documentation-example.2.query.aql
new file mode 100644
index 0000000..c1d2b5d
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/records/get-record-field-value/documentation-example/documentation-example.2.query.aql
@@ -0,0 +1,10 @@
+/*
+* Description  : Testing get-record-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-record-field-value($r1, "address")

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-app/src/test/resources/runtimets/queries/records/get-record-field-value/documentation-example/documentation-example.3.query.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/records/get-record-field-value/documentation-example/documentation-example.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/records/get-record-field-value/documentation-example/documentation-example.3.query.aql
new file mode 100644
index 0000000..6be3409
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/records/get-record-field-value/documentation-example/documentation-example.3.query.aql
@@ -0,0 +1,10 @@
+/*
+* Description  : Testing get-record-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-record-field-value($r1, "related")

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-app/src/test/resources/runtimets/queries/records/get-record-field-value/highly-nested-closed/highly-nested-open.1.ddl.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/records/get-record-field-value/highly-nested-closed/highly-nested-open.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/records/get-record-field-value/highly-nested-closed/highly-nested-open.1.ddl.aql
new file mode 100644
index 0000000..f36f1bc
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/records/get-record-field-value/highly-nested-closed/highly-nested-open.1.ddl.aql
@@ -0,0 +1,63 @@
+/*
+* Description  : Testing get-record-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/incubator-asterixdb/blob/900bf134/asterix-app/src/test/resources/runtimets/queries/records/get-record-field-value/highly-nested-closed/highly-nested-open.2.update.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/records/get-record-field-value/highly-nested-closed/highly-nested-open.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/records/get-record-field-value/highly-nested-closed/highly-nested-open.2.update.aql
new file mode 100644
index 0000000..7b270b9
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/records/get-record-field-value/highly-nested-closed/highly-nested-open.2.update.aql
@@ -0,0 +1,9 @@
+/*
+* Description  : Testing get-record-field-value under different queries.
+* Expected Res : Success
+* Date         : 04 Jun 2015
+*/
+use dataverse test;
+
+load dataset Animals using localfs
+(("path"="nc1://data/classifications/animals.adm"),("format"="adm"));

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-app/src/test/resources/runtimets/queries/records/get-record-field-value/highly-nested-closed/highly-nested-open.3.query.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/records/get-record-field-value/highly-nested-closed/highly-nested-open.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/records/get-record-field-value/highly-nested-closed/highly-nested-open.3.query.aql
new file mode 100644
index 0000000..8634bde
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/records/get-record-field-value/highly-nested-closed/highly-nested-open.3.query.aql
@@ -0,0 +1,11 @@
+/*
+* Description  : Testing get-record-field-value under different queries.
+* Expected Res : Success
+* Date         : 04 Jun 2015
+*/
+use dataverse test;
+
+for $test in dataset Animals
+let $result := get-record-field-value($test, "class")
+order by $result.id
+return $result;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-app/src/test/resources/runtimets/queries/records/get-record-field-value/highly-nested-mixed/highly-nested-mixed.1.ddl.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/records/get-record-field-value/highly-nested-mixed/highly-nested-mixed.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/records/get-record-field-value/highly-nested-mixed/highly-nested-mixed.1.ddl.aql
new file mode 100644
index 0000000..eff94c8
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/records/get-record-field-value/highly-nested-mixed/highly-nested-mixed.1.ddl.aql
@@ -0,0 +1,59 @@
+/*
+* Description  : Testing get-record-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/incubator-asterixdb/blob/900bf134/asterix-app/src/test/resources/runtimets/queries/records/get-record-field-value/highly-nested-mixed/highly-nested-mixed.2.update.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/records/get-record-field-value/highly-nested-mixed/highly-nested-mixed.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/records/get-record-field-value/highly-nested-mixed/highly-nested-mixed.2.update.aql
new file mode 100644
index 0000000..7b270b9
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/records/get-record-field-value/highly-nested-mixed/highly-nested-mixed.2.update.aql
@@ -0,0 +1,9 @@
+/*
+* Description  : Testing get-record-field-value under different queries.
+* Expected Res : Success
+* Date         : 04 Jun 2015
+*/
+use dataverse test;
+
+load dataset Animals using localfs
+(("path"="nc1://data/classifications/animals.adm"),("format"="adm"));

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-app/src/test/resources/runtimets/queries/records/get-record-field-value/highly-nested-mixed/highly-nested-mixed.3.query.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/records/get-record-field-value/highly-nested-mixed/highly-nested-mixed.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/records/get-record-field-value/highly-nested-mixed/highly-nested-mixed.3.query.aql
new file mode 100644
index 0000000..8634bde
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/records/get-record-field-value/highly-nested-mixed/highly-nested-mixed.3.query.aql
@@ -0,0 +1,11 @@
+/*
+* Description  : Testing get-record-field-value under different queries.
+* Expected Res : Success
+* Date         : 04 Jun 2015
+*/
+use dataverse test;
+
+for $test in dataset Animals
+let $result := get-record-field-value($test, "class")
+order by $result.id
+return $result;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-app/src/test/resources/runtimets/queries/records/get-record-field-value/highly-nested-open/highly-nested-open.1.ddl.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/records/get-record-field-value/highly-nested-open/highly-nested-open.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/records/get-record-field-value/highly-nested-open/highly-nested-open.1.ddl.aql
new file mode 100644
index 0000000..32a8aaa
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/records/get-record-field-value/highly-nested-open/highly-nested-open.1.ddl.aql
@@ -0,0 +1,54 @@
+/*
+* Description  : Testing get-record-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/incubator-asterixdb/blob/900bf134/asterix-app/src/test/resources/runtimets/queries/records/get-record-field-value/highly-nested-open/highly-nested-open.2.update.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/records/get-record-field-value/highly-nested-open/highly-nested-open.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/records/get-record-field-value/highly-nested-open/highly-nested-open.2.update.aql
new file mode 100644
index 0000000..7b270b9
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/records/get-record-field-value/highly-nested-open/highly-nested-open.2.update.aql
@@ -0,0 +1,9 @@
+/*
+* Description  : Testing get-record-field-value under different queries.
+* Expected Res : Success
+* Date         : 04 Jun 2015
+*/
+use dataverse test;
+
+load dataset Animals using localfs
+(("path"="nc1://data/classifications/animals.adm"),("format"="adm"));

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-app/src/test/resources/runtimets/queries/records/get-record-field-value/highly-nested-open/highly-nested-open.3.query.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/records/get-record-field-value/highly-nested-open/highly-nested-open.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/records/get-record-field-value/highly-nested-open/highly-nested-open.3.query.aql
new file mode 100644
index 0000000..8634bde
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/records/get-record-field-value/highly-nested-open/highly-nested-open.3.query.aql
@@ -0,0 +1,11 @@
+/*
+* Description  : Testing get-record-field-value under different queries.
+* Expected Res : Success
+* Date         : 04 Jun 2015
+*/
+use dataverse test;
+
+for $test in dataset Animals
+let $result := get-record-field-value($test, "class")
+order by $result.id
+return $result;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-app/src/test/resources/runtimets/queries/records/get-record-field-value/tiny-social-example/tiny-social-example.1.ddl.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/records/get-record-field-value/tiny-social-example/tiny-social-example.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/records/get-record-field-value/tiny-social-example/tiny-social-example.1.ddl.aql
new file mode 100644
index 0000000..b167657
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/records/get-record-field-value/tiny-social-example/tiny-social-example.1.ddl.aql
@@ -0,0 +1,49 @@
+/*
+* Description  : Testing get-record-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/incubator-asterixdb/blob/900bf134/asterix-app/src/test/resources/runtimets/queries/records/get-record-field-value/tiny-social-example/tiny-social-example.2.ddl.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/records/get-record-field-value/tiny-social-example/tiny-social-example.2.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/records/get-record-field-value/tiny-social-example/tiny-social-example.2.ddl.aql
new file mode 100644
index 0000000..dfc09cc
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/records/get-record-field-value/tiny-social-example/tiny-social-example.2.ddl.aql
@@ -0,0 +1,24 @@
+/*
+* Description  : Testing get-record-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;

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-app/src/test/resources/runtimets/queries/records/get-record-field-value/tiny-social-example/tiny-social-example.3.update.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/records/get-record-field-value/tiny-social-example/tiny-social-example.3.update.aql b/asterix-app/src/test/resources/runtimets/queries/records/get-record-field-value/tiny-social-example/tiny-social-example.3.update.aql
new file mode 100644
index 0000000..f45cfa7
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/records/get-record-field-value/tiny-social-example/tiny-social-example.3.update.aql
@@ -0,0 +1,18 @@
+/*
+* Description  : Testing get-record-field-value 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"));

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-app/src/test/resources/runtimets/queries/records/get-record-field-value/tiny-social-example/tiny-social-example.4.query.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/records/get-record-field-value/tiny-social-example/tiny-social-example.4.query.aql b/asterix-app/src/test/resources/runtimets/queries/records/get-record-field-value/tiny-social-example/tiny-social-example.4.query.aql
new file mode 100644
index 0000000..1a560e5
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/records/get-record-field-value/tiny-social-example/tiny-social-example.4.query.aql
@@ -0,0 +1,13 @@
+/*
+* Description  : Testing get-record-field-value under different queries.
+* Expected Res : Success
+* Date         : 04 Jun 2015
+*/
+use dataverse TinySocial;
+
+for $r in dataset TweetMessages
+for $f in get-record-fields($r)
+where $f.field-type = "STRING"
+let $result := get-record-field-value($r, $f.field-name)
+order by $result
+return $result

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-app/src/test/resources/runtimets/queries/records/get-record-fields/documentation-example/documentation-example.1.query.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/records/get-record-fields/documentation-example/documentation-example.1.query.aql b/asterix-app/src/test/resources/runtimets/queries/records/get-record-fields/documentation-example/documentation-example.1.query.aql
new file mode 100644
index 0000000..84df51e
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/records/get-record-fields/documentation-example/documentation-example.1.query.aql
@@ -0,0 +1,10 @@
+/*
+* Description  : Testing get-record-fields 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-record-fields($r1)
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-app/src/test/resources/runtimets/queries/records/get-record-fields/tiny-social-example-no-complex-types/tiny-social-example-no-complex-types.1.ddl.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/records/get-record-fields/tiny-social-example-no-complex-types/tiny-social-example-no-complex-types.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/records/get-record-fields/tiny-social-example-no-complex-types/tiny-social-example-no-complex-types.1.ddl.aql
new file mode 100644
index 0000000..4ae62c8
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/records/get-record-fields/tiny-social-example-no-complex-types/tiny-social-example-no-complex-types.1.ddl.aql
@@ -0,0 +1,83 @@
+/*
+* Description  : Testing get-record-fields 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
+}
+
+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
+}
+
+// Alternate datasets
+create type TwitterUserAlternateType as open {
+        screen-name: string,
+        lang: string,
+        friends_count: int64,
+        statuses_count: int64
+}
+
+create type TweetMessageAlternateType as closed {
+        tweetid: string,
+        sender-location: point?,
+        send-time: datetime,
+        message-text: string
+}
+
+create type EmploymentAlternateType as open {
+        organization-name: string,
+        start-date: date,
+        end-date: date?
+}
+
+create type FacebookUserAlternateType as closed {
+        id: int64,
+        alias: string,
+        name: string,
+        user-since: datetime
+}
+
+create type FacebookMessageAlternateType as closed {
+        message-id: int64,
+        author-id: int64,
+        in-response-to: int64?,
+        sender-location: point?,
+        message: string
+}



[7/9] incubator-asterixdb git commit: Adding introspection for getting record details.

Posted by im...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-app/src/test/resources/runtimets/queries/records/get-record-fields/tiny-social-example-no-complex-types/tiny-social-example-no-complex-types.2.ddl.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/records/get-record-fields/tiny-social-example-no-complex-types/tiny-social-example-no-complex-types.2.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/records/get-record-fields/tiny-social-example-no-complex-types/tiny-social-example-no-complex-types.2.ddl.aql
new file mode 100644
index 0000000..023bd60
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/records/get-record-fields/tiny-social-example-no-complex-types/tiny-social-example-no-complex-types.2.ddl.aql
@@ -0,0 +1,38 @@
+/*
+* Description  : Testing get-record-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;
+
+
+// Alternate datasets
+create dataset FacebookUsersAlternate(FacebookUserAlternateType)
+primary key id;
+
+create dataset FacebookMessagesAlternate(FacebookMessageAlternateType)
+primary key message-id;
+
+create dataset TwitterUsersAlternate(TwitterUserAlternateType)
+primary key screen-name;
+
+create dataset TweetMessagesAlternate(TweetMessageAlternateType)
+primary key tweetid; 

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-app/src/test/resources/runtimets/queries/records/get-record-fields/tiny-social-example-no-complex-types/tiny-social-example-no-complex-types.3.update.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/records/get-record-fields/tiny-social-example-no-complex-types/tiny-social-example-no-complex-types.3.update.aql b/asterix-app/src/test/resources/runtimets/queries/records/get-record-fields/tiny-social-example-no-complex-types/tiny-social-example-no-complex-types.3.update.aql
new file mode 100644
index 0000000..8207681
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/records/get-record-fields/tiny-social-example-no-complex-types/tiny-social-example-no-complex-types.3.update.aql
@@ -0,0 +1,61 @@
+/*
+* Description  : Testing get-record-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"));
+
+
+// Alternate datasets
+insert into dataset TwitterUsersAlternate(
+    for $r in dataset TwitterUsers
+    return {
+        "screen-name" : $r.screen-name,
+        "lang" : $r.lang,
+        "friends_count" : $r.friends_count,
+        "statuses_count" : $r.statuses_count
+    }
+);
+
+insert into dataset TweetMessagesAlternate(
+    for $r in dataset TweetMessages
+    return {
+        "tweetid" : $r.tweetid,
+        "sender-location" : $r.sender-location,
+        "send-time" : $r.send-time,
+        "message-text" : $r.message-text
+    }
+);
+
+insert into dataset FacebookUsersAlternate(
+    for $r in dataset FacebookUsers
+    return {
+        "id" : $r.id,
+        "alias" : $r.alias,
+        "name" : $r.name,
+        "user-since" : $r.user-since
+    }
+);
+
+insert into dataset FacebookMessagesAlternate(
+    for $r in dataset FacebookMessages
+    return {
+        "message-id" : $r.message-id,
+        "author-id" : $r.author-id,
+        "in-response-to" : $r.in-response-to,
+        "sender-location" : $r.sender-location,
+        "message" : $r.message
+    }
+);
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-app/src/test/resources/runtimets/queries/records/get-record-fields/tiny-social-example-no-complex-types/tiny-social-example-no-complex-types.4.query.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/records/get-record-fields/tiny-social-example-no-complex-types/tiny-social-example-no-complex-types.4.query.aql b/asterix-app/src/test/resources/runtimets/queries/records/get-record-fields/tiny-social-example-no-complex-types/tiny-social-example-no-complex-types.4.query.aql
new file mode 100644
index 0000000..5bdc255
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/records/get-record-fields/tiny-social-example-no-complex-types/tiny-social-example-no-complex-types.4.query.aql
@@ -0,0 +1,10 @@
+/*
+* Description  : Testing get-record-fields under different queries.
+* Expected Res : Success
+* Date         : 04 Jun 2015
+*/
+use dataverse TinySocial;
+
+for $user in dataset FacebookUsersAlternate
+where $user.id = 8
+return get-record-fields($user);

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-app/src/test/resources/runtimets/queries/records/get-record-fields/tiny-social-example-no-complex-types/tiny-social-example-no-complex-types.5.query.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/records/get-record-fields/tiny-social-example-no-complex-types/tiny-social-example-no-complex-types.5.query.aql b/asterix-app/src/test/resources/runtimets/queries/records/get-record-fields/tiny-social-example-no-complex-types/tiny-social-example-no-complex-types.5.query.aql
new file mode 100644
index 0000000..0af5656
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/records/get-record-fields/tiny-social-example-no-complex-types/tiny-social-example-no-complex-types.5.query.aql
@@ -0,0 +1,10 @@
+/*
+* Description  : Testing get-record-fields under different queries.
+* Expected Res : Success
+* Date         : 04 Jun 2015
+*/
+use dataverse TinySocial;
+
+for $r in dataset FacebookUsersAlternate
+order by $r.id
+return get-record-fields($r);

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-app/src/test/resources/runtimets/queries/records/get-record-fields/tiny-social-example-no-complex-types/tiny-social-example-no-complex-types.6.query.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/records/get-record-fields/tiny-social-example-no-complex-types/tiny-social-example-no-complex-types.6.query.aql b/asterix-app/src/test/resources/runtimets/queries/records/get-record-fields/tiny-social-example-no-complex-types/tiny-social-example-no-complex-types.6.query.aql
new file mode 100644
index 0000000..ad5d424
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/records/get-record-fields/tiny-social-example-no-complex-types/tiny-social-example-no-complex-types.6.query.aql
@@ -0,0 +1,10 @@
+/*
+* Description  : Testing get-record-fields under different queries.
+* Expected Res : Success
+* Date         : 04 Jun 2015
+*/
+use dataverse TinySocial;
+
+for $r in dataset FacebookMessagesAlternate
+order by $r.message-id
+return get-record-fields($r);

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-app/src/test/resources/runtimets/queries/records/get-record-fields/tiny-social-example-no-complex-types/tiny-social-example-no-complex-types.7.query.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/records/get-record-fields/tiny-social-example-no-complex-types/tiny-social-example-no-complex-types.7.query.aql b/asterix-app/src/test/resources/runtimets/queries/records/get-record-fields/tiny-social-example-no-complex-types/tiny-social-example-no-complex-types.7.query.aql
new file mode 100644
index 0000000..72d49f0
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/records/get-record-fields/tiny-social-example-no-complex-types/tiny-social-example-no-complex-types.7.query.aql
@@ -0,0 +1,10 @@
+/*
+* Description  : Testing get-record-fields under different queries.
+* Expected Res : Success
+* Date         : 04 Jun 2015
+*/
+use dataverse TinySocial;
+
+for $r in dataset TwitterUsersAlternate
+order by $r.screen-name
+return get-record-fields($r);

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-app/src/test/resources/runtimets/queries/records/get-record-fields/tiny-social-example-no-complex-types/tiny-social-example-no-complex-types.8.query.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/records/get-record-fields/tiny-social-example-no-complex-types/tiny-social-example-no-complex-types.8.query.aql b/asterix-app/src/test/resources/runtimets/queries/records/get-record-fields/tiny-social-example-no-complex-types/tiny-social-example-no-complex-types.8.query.aql
new file mode 100644
index 0000000..698660b
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/records/get-record-fields/tiny-social-example-no-complex-types/tiny-social-example-no-complex-types.8.query.aql
@@ -0,0 +1,10 @@
+/*
+* Description  : Testing get-record-fields under different queries.
+* Expected Res : Success
+* Date         : 04 Jun 2015
+*/
+use dataverse TinySocial;
+
+for $r in dataset TweetMessagesAlternate
+order by $r.tweetid
+return get-record-fields($r);

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-app/src/test/resources/runtimets/queries/records/get-record-fields/tiny-social-example-no-complex-types/tiny-social-example-no-complex-types.9.query.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/records/get-record-fields/tiny-social-example-no-complex-types/tiny-social-example-no-complex-types.9.query.aql b/asterix-app/src/test/resources/runtimets/queries/records/get-record-fields/tiny-social-example-no-complex-types/tiny-social-example-no-complex-types.9.query.aql
new file mode 100644
index 0000000..1c56ca5
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/records/get-record-fields/tiny-social-example-no-complex-types/tiny-social-example-no-complex-types.9.query.aql
@@ -0,0 +1,13 @@
+/*
+* Description  : Testing get-record-fields under different queries.
+* Expected Res : Success
+* Date         : 04 Jun 2015
+*/
+use dataverse TinySocial;
+
+for $r in dataset TweetMessagesAlternate
+  for $f in get-record-fields($r)
+    group by $n:=$f.field-name, $t:=$f.field-type with $r
+    let $count:=count($r)
+    order by $n, $t
+    return {"field-name":$n, "field-type":$t, "count":$count};

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-app/src/test/resources/runtimets/queries/records/get-record-fields/tiny-social-example-only-lists/tiny-social-example-only-lists.1.ddl.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/records/get-record-fields/tiny-social-example-only-lists/tiny-social-example-only-lists.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/records/get-record-fields/tiny-social-example-only-lists/tiny-social-example-only-lists.1.ddl.aql
new file mode 100644
index 0000000..e858f7c
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/records/get-record-fields/tiny-social-example-only-lists/tiny-social-example-only-lists.1.ddl.aql
@@ -0,0 +1,85 @@
+/*
+* Description  : Testing get-record-fields 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
+}
+
+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
+}
+
+// Alternate datasets
+create type TwitterUserAlternateType as open {
+        screen-name: string,
+        lang: string,
+        friends_count: int64,
+        statuses_count: int64
+}
+
+create type TweetMessageAlternateType as closed {
+        tweetid: string,
+        sender-location: point?,
+        send-time: datetime,
+        referred-topics: {{ string }},
+        message-text: string
+}
+
+create type EmploymentAlternateType as open {
+        organization-name: string,
+        start-date: date,
+        end-date: date?
+}
+
+create type FacebookUserAlternateType as closed {
+        id: int64,
+        alias: string,
+        name: string,
+        friend-ids: {{ int64 }},
+        user-since: datetime
+}
+
+create type FacebookMessageAlternateType 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/900bf134/asterix-app/src/test/resources/runtimets/queries/records/get-record-fields/tiny-social-example-only-lists/tiny-social-example-only-lists.2.ddl.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/records/get-record-fields/tiny-social-example-only-lists/tiny-social-example-only-lists.2.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/records/get-record-fields/tiny-social-example-only-lists/tiny-social-example-only-lists.2.ddl.aql
new file mode 100644
index 0000000..023bd60
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/records/get-record-fields/tiny-social-example-only-lists/tiny-social-example-only-lists.2.ddl.aql
@@ -0,0 +1,38 @@
+/*
+* Description  : Testing get-record-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;
+
+
+// Alternate datasets
+create dataset FacebookUsersAlternate(FacebookUserAlternateType)
+primary key id;
+
+create dataset FacebookMessagesAlternate(FacebookMessageAlternateType)
+primary key message-id;
+
+create dataset TwitterUsersAlternate(TwitterUserAlternateType)
+primary key screen-name;
+
+create dataset TweetMessagesAlternate(TweetMessageAlternateType)
+primary key tweetid; 

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-app/src/test/resources/runtimets/queries/records/get-record-fields/tiny-social-example-only-lists/tiny-social-example-only-lists.3.update.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/records/get-record-fields/tiny-social-example-only-lists/tiny-social-example-only-lists.3.update.aql b/asterix-app/src/test/resources/runtimets/queries/records/get-record-fields/tiny-social-example-only-lists/tiny-social-example-only-lists.3.update.aql
new file mode 100644
index 0000000..e4a515b
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/records/get-record-fields/tiny-social-example-only-lists/tiny-social-example-only-lists.3.update.aql
@@ -0,0 +1,63 @@
+/*
+* Description  : Testing get-record-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"));
+
+
+// Alternate datasets
+insert into dataset TwitterUsersAlternate(
+    for $r in dataset TwitterUsers
+    return {
+        "screen-name" : $r.screen-name,
+        "lang" : $r.lang,
+        "friends_count" : $r.friends_count,
+        "statuses_count" : $r.statuses_count
+    }
+);
+
+insert into dataset TweetMessagesAlternate(
+    for $r in dataset TweetMessages
+    return {
+        "tweetid" : $r.tweetid,
+        "sender-location" : $r.sender-location,
+        "send-time" : $r.send-time,
+        "message-text" : $r.message-text,
+        "referred-topics" : $r.referred-topics
+    }
+);
+
+insert into dataset FacebookUsersAlternate(
+    for $r in dataset FacebookUsers
+    return {
+        "id" : $r.id,
+        "alias" : $r.alias,
+        "name" : $r.name,
+        "friend-ids" : $r.friend-ids,
+        "user-since" : $r.user-since
+    }
+);
+
+insert into dataset FacebookMessagesAlternate(
+    for $r in dataset FacebookMessages
+    return {
+        "message-id" : $r.message-id,
+        "author-id" : $r.author-id,
+        "in-response-to" : $r.in-response-to,
+        "sender-location" : $r.sender-location,
+        "message" : $r.message
+    }
+);
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-app/src/test/resources/runtimets/queries/records/get-record-fields/tiny-social-example-only-lists/tiny-social-example-only-lists.4.query.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/records/get-record-fields/tiny-social-example-only-lists/tiny-social-example-only-lists.4.query.aql b/asterix-app/src/test/resources/runtimets/queries/records/get-record-fields/tiny-social-example-only-lists/tiny-social-example-only-lists.4.query.aql
new file mode 100644
index 0000000..5bdc255
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/records/get-record-fields/tiny-social-example-only-lists/tiny-social-example-only-lists.4.query.aql
@@ -0,0 +1,10 @@
+/*
+* Description  : Testing get-record-fields under different queries.
+* Expected Res : Success
+* Date         : 04 Jun 2015
+*/
+use dataverse TinySocial;
+
+for $user in dataset FacebookUsersAlternate
+where $user.id = 8
+return get-record-fields($user);

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-app/src/test/resources/runtimets/queries/records/get-record-fields/tiny-social-example-only-lists/tiny-social-example-only-lists.5.query.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/records/get-record-fields/tiny-social-example-only-lists/tiny-social-example-only-lists.5.query.aql b/asterix-app/src/test/resources/runtimets/queries/records/get-record-fields/tiny-social-example-only-lists/tiny-social-example-only-lists.5.query.aql
new file mode 100644
index 0000000..0af5656
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/records/get-record-fields/tiny-social-example-only-lists/tiny-social-example-only-lists.5.query.aql
@@ -0,0 +1,10 @@
+/*
+* Description  : Testing get-record-fields under different queries.
+* Expected Res : Success
+* Date         : 04 Jun 2015
+*/
+use dataverse TinySocial;
+
+for $r in dataset FacebookUsersAlternate
+order by $r.id
+return get-record-fields($r);

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-app/src/test/resources/runtimets/queries/records/get-record-fields/tiny-social-example-only-lists/tiny-social-example-only-lists.6.query.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/records/get-record-fields/tiny-social-example-only-lists/tiny-social-example-only-lists.6.query.aql b/asterix-app/src/test/resources/runtimets/queries/records/get-record-fields/tiny-social-example-only-lists/tiny-social-example-only-lists.6.query.aql
new file mode 100644
index 0000000..ad5d424
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/records/get-record-fields/tiny-social-example-only-lists/tiny-social-example-only-lists.6.query.aql
@@ -0,0 +1,10 @@
+/*
+* Description  : Testing get-record-fields under different queries.
+* Expected Res : Success
+* Date         : 04 Jun 2015
+*/
+use dataverse TinySocial;
+
+for $r in dataset FacebookMessagesAlternate
+order by $r.message-id
+return get-record-fields($r);

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-app/src/test/resources/runtimets/queries/records/get-record-fields/tiny-social-example-only-lists/tiny-social-example-only-lists.7.query.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/records/get-record-fields/tiny-social-example-only-lists/tiny-social-example-only-lists.7.query.aql b/asterix-app/src/test/resources/runtimets/queries/records/get-record-fields/tiny-social-example-only-lists/tiny-social-example-only-lists.7.query.aql
new file mode 100644
index 0000000..72d49f0
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/records/get-record-fields/tiny-social-example-only-lists/tiny-social-example-only-lists.7.query.aql
@@ -0,0 +1,10 @@
+/*
+* Description  : Testing get-record-fields under different queries.
+* Expected Res : Success
+* Date         : 04 Jun 2015
+*/
+use dataverse TinySocial;
+
+for $r in dataset TwitterUsersAlternate
+order by $r.screen-name
+return get-record-fields($r);

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-app/src/test/resources/runtimets/queries/records/get-record-fields/tiny-social-example-only-lists/tiny-social-example-only-lists.8.query.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/records/get-record-fields/tiny-social-example-only-lists/tiny-social-example-only-lists.8.query.aql b/asterix-app/src/test/resources/runtimets/queries/records/get-record-fields/tiny-social-example-only-lists/tiny-social-example-only-lists.8.query.aql
new file mode 100644
index 0000000..698660b
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/records/get-record-fields/tiny-social-example-only-lists/tiny-social-example-only-lists.8.query.aql
@@ -0,0 +1,10 @@
+/*
+* Description  : Testing get-record-fields under different queries.
+* Expected Res : Success
+* Date         : 04 Jun 2015
+*/
+use dataverse TinySocial;
+
+for $r in dataset TweetMessagesAlternate
+order by $r.tweetid
+return get-record-fields($r);

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-app/src/test/resources/runtimets/queries/records/get-record-fields/tiny-social-example-only-lists/tiny-social-example-only-lists.9.query.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/records/get-record-fields/tiny-social-example-only-lists/tiny-social-example-only-lists.9.query.aql b/asterix-app/src/test/resources/runtimets/queries/records/get-record-fields/tiny-social-example-only-lists/tiny-social-example-only-lists.9.query.aql
new file mode 100644
index 0000000..d7cf8d0
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/records/get-record-fields/tiny-social-example-only-lists/tiny-social-example-only-lists.9.query.aql
@@ -0,0 +1,13 @@
+/*
+* Description  : Testing get-record-fields under different queries.
+* Expected Res : Success
+* Date         : 04 Jun 2015
+*/
+use dataverse TinySocial;
+
+for $r in dataset TweetMessagesAlternate
+for $f in get-record-fields($r)
+group by $n:=$f.field-name, $t:=$f.field-type with $r
+let $count:=count($r)
+order by $n, $t
+return {"field-name":$n, "field-type":$t, "count":$count};

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-app/src/test/resources/runtimets/queries/records/get-record-fields/tiny-social-example-only-records/tiny-social-example-only-records.1.ddl.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/records/get-record-fields/tiny-social-example-only-records/tiny-social-example-only-records.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/records/get-record-fields/tiny-social-example-only-records/tiny-social-example-only-records.1.ddl.aql
new file mode 100644
index 0000000..d87c812
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/records/get-record-fields/tiny-social-example-only-records/tiny-social-example-only-records.1.ddl.aql
@@ -0,0 +1,85 @@
+/*
+* Description  : Testing get-record-fields 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
+}
+
+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
+}
+
+// Alternate datasets
+create type TwitterUserAlternateType as open {
+        screen-name: string,
+        lang: string,
+        friends_count: int64,
+        statuses_count: int64
+}
+
+create type TweetMessageAlternateType as closed {
+        tweetid: string,
+        user: TwitterUserAlternateType,
+        sender-location: point?,
+        send-time: datetime,
+        message-text: string
+}
+
+create type EmploymentAlternateType as open {
+        organization-name: string,
+        start-date: date,
+        end-date: date?
+}
+
+create type FacebookUserAlternateType as closed {
+        id: int64,
+        alias: string,
+        name: string,
+        user-since: datetime,
+        employment: EmploymentAlternateType
+}
+
+create type FacebookMessageAlternateType 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/900bf134/asterix-app/src/test/resources/runtimets/queries/records/get-record-fields/tiny-social-example-only-records/tiny-social-example-only-records.2.ddl.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/records/get-record-fields/tiny-social-example-only-records/tiny-social-example-only-records.2.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/records/get-record-fields/tiny-social-example-only-records/tiny-social-example-only-records.2.ddl.aql
new file mode 100644
index 0000000..023bd60
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/records/get-record-fields/tiny-social-example-only-records/tiny-social-example-only-records.2.ddl.aql
@@ -0,0 +1,38 @@
+/*
+* Description  : Testing get-record-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;
+
+
+// Alternate datasets
+create dataset FacebookUsersAlternate(FacebookUserAlternateType)
+primary key id;
+
+create dataset FacebookMessagesAlternate(FacebookMessageAlternateType)
+primary key message-id;
+
+create dataset TwitterUsersAlternate(TwitterUserAlternateType)
+primary key screen-name;
+
+create dataset TweetMessagesAlternate(TweetMessageAlternateType)
+primary key tweetid; 

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-app/src/test/resources/runtimets/queries/records/get-record-fields/tiny-social-example-only-records/tiny-social-example-only-records.3.update.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/records/get-record-fields/tiny-social-example-only-records/tiny-social-example-only-records.3.update.aql b/asterix-app/src/test/resources/runtimets/queries/records/get-record-fields/tiny-social-example-only-records/tiny-social-example-only-records.3.update.aql
new file mode 100644
index 0000000..a2282f5
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/records/get-record-fields/tiny-social-example-only-records/tiny-social-example-only-records.3.update.aql
@@ -0,0 +1,63 @@
+/*
+* Description  : Testing get-record-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"));
+
+
+// Alternate datasets
+insert into dataset TwitterUsersAlternate(
+    for $r in dataset TwitterUsers
+    return {
+        "screen-name" : $r.screen-name,
+        "lang" : $r.lang,
+        "friends_count" : $r.friends_count,
+        "statuses_count" : $r.statuses_count
+    }
+);
+
+insert into dataset TweetMessagesAlternate(
+    for $r in dataset TweetMessages
+    return {
+        "tweetid" : $r.tweetid,
+        "user" : $r.user,
+        "sender-location" : $r.sender-location,
+        "send-time" : $r.send-time,
+        "message-text" : $r.message-text
+    }
+);
+
+insert into dataset FacebookUsersAlternate(
+    for $r in dataset FacebookUsers
+    return {
+        "id" : $r.id,
+        "alias" : $r.alias,
+        "name" : $r.name,
+        "user-since" : $r.user-since,
+        "employment" : $r.employment[0]
+    }
+);
+
+insert into dataset FacebookMessagesAlternate(
+    for $r in dataset FacebookMessages
+    return {
+        "message-id" : $r.message-id,
+        "author-id" : $r.author-id,
+        "in-response-to" : $r.in-response-to,
+        "sender-location" : $r.sender-location,
+        "message" : $r.message
+    }
+);
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-app/src/test/resources/runtimets/queries/records/get-record-fields/tiny-social-example-only-records/tiny-social-example-only-records.4.query.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/records/get-record-fields/tiny-social-example-only-records/tiny-social-example-only-records.4.query.aql b/asterix-app/src/test/resources/runtimets/queries/records/get-record-fields/tiny-social-example-only-records/tiny-social-example-only-records.4.query.aql
new file mode 100644
index 0000000..5bdc255
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/records/get-record-fields/tiny-social-example-only-records/tiny-social-example-only-records.4.query.aql
@@ -0,0 +1,10 @@
+/*
+* Description  : Testing get-record-fields under different queries.
+* Expected Res : Success
+* Date         : 04 Jun 2015
+*/
+use dataverse TinySocial;
+
+for $user in dataset FacebookUsersAlternate
+where $user.id = 8
+return get-record-fields($user);

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-app/src/test/resources/runtimets/queries/records/get-record-fields/tiny-social-example-only-records/tiny-social-example-only-records.5.query.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/records/get-record-fields/tiny-social-example-only-records/tiny-social-example-only-records.5.query.aql b/asterix-app/src/test/resources/runtimets/queries/records/get-record-fields/tiny-social-example-only-records/tiny-social-example-only-records.5.query.aql
new file mode 100644
index 0000000..0af5656
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/records/get-record-fields/tiny-social-example-only-records/tiny-social-example-only-records.5.query.aql
@@ -0,0 +1,10 @@
+/*
+* Description  : Testing get-record-fields under different queries.
+* Expected Res : Success
+* Date         : 04 Jun 2015
+*/
+use dataverse TinySocial;
+
+for $r in dataset FacebookUsersAlternate
+order by $r.id
+return get-record-fields($r);

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-app/src/test/resources/runtimets/queries/records/get-record-fields/tiny-social-example-only-records/tiny-social-example-only-records.6.query.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/records/get-record-fields/tiny-social-example-only-records/tiny-social-example-only-records.6.query.aql b/asterix-app/src/test/resources/runtimets/queries/records/get-record-fields/tiny-social-example-only-records/tiny-social-example-only-records.6.query.aql
new file mode 100644
index 0000000..ad5d424
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/records/get-record-fields/tiny-social-example-only-records/tiny-social-example-only-records.6.query.aql
@@ -0,0 +1,10 @@
+/*
+* Description  : Testing get-record-fields under different queries.
+* Expected Res : Success
+* Date         : 04 Jun 2015
+*/
+use dataverse TinySocial;
+
+for $r in dataset FacebookMessagesAlternate
+order by $r.message-id
+return get-record-fields($r);

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-app/src/test/resources/runtimets/queries/records/get-record-fields/tiny-social-example-only-records/tiny-social-example-only-records.7.query.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/records/get-record-fields/tiny-social-example-only-records/tiny-social-example-only-records.7.query.aql b/asterix-app/src/test/resources/runtimets/queries/records/get-record-fields/tiny-social-example-only-records/tiny-social-example-only-records.7.query.aql
new file mode 100644
index 0000000..72d49f0
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/records/get-record-fields/tiny-social-example-only-records/tiny-social-example-only-records.7.query.aql
@@ -0,0 +1,10 @@
+/*
+* Description  : Testing get-record-fields under different queries.
+* Expected Res : Success
+* Date         : 04 Jun 2015
+*/
+use dataverse TinySocial;
+
+for $r in dataset TwitterUsersAlternate
+order by $r.screen-name
+return get-record-fields($r);

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-app/src/test/resources/runtimets/queries/records/get-record-fields/tiny-social-example-only-records/tiny-social-example-only-records.8.query.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/records/get-record-fields/tiny-social-example-only-records/tiny-social-example-only-records.8.query.aql b/asterix-app/src/test/resources/runtimets/queries/records/get-record-fields/tiny-social-example-only-records/tiny-social-example-only-records.8.query.aql
new file mode 100644
index 0000000..698660b
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/records/get-record-fields/tiny-social-example-only-records/tiny-social-example-only-records.8.query.aql
@@ -0,0 +1,10 @@
+/*
+* Description  : Testing get-record-fields under different queries.
+* Expected Res : Success
+* Date         : 04 Jun 2015
+*/
+use dataverse TinySocial;
+
+for $r in dataset TweetMessagesAlternate
+order by $r.tweetid
+return get-record-fields($r);

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-app/src/test/resources/runtimets/queries/records/get-record-fields/tiny-social-example-only-records/tiny-social-example-only-records.9.query.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/records/get-record-fields/tiny-social-example-only-records/tiny-social-example-only-records.9.query.aql b/asterix-app/src/test/resources/runtimets/queries/records/get-record-fields/tiny-social-example-only-records/tiny-social-example-only-records.9.query.aql
new file mode 100644
index 0000000..d7cf8d0
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/records/get-record-fields/tiny-social-example-only-records/tiny-social-example-only-records.9.query.aql
@@ -0,0 +1,13 @@
+/*
+* Description  : Testing get-record-fields under different queries.
+* Expected Res : Success
+* Date         : 04 Jun 2015
+*/
+use dataverse TinySocial;
+
+for $r in dataset TweetMessagesAlternate
+for $f in get-record-fields($r)
+group by $n:=$f.field-name, $t:=$f.field-type with $r
+let $count:=count($r)
+order by $n, $t
+return {"field-name":$n, "field-type":$t, "count":$count};

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-app/src/test/resources/runtimets/queries/records/get-record-fields/tiny-social-example/tiny-social-example.1.ddl.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/records/get-record-fields/tiny-social-example/tiny-social-example.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/records/get-record-fields/tiny-social-example/tiny-social-example.1.ddl.aql
new file mode 100644
index 0000000..b9e6a70
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/records/get-record-fields/tiny-social-example/tiny-social-example.1.ddl.aql
@@ -0,0 +1,47 @@
+/*
+* Description  : Testing get-record-fields 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
+}
+
+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/900bf134/asterix-app/src/test/resources/runtimets/queries/records/get-record-fields/tiny-social-example/tiny-social-example.2.ddl.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/records/get-record-fields/tiny-social-example/tiny-social-example.2.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/records/get-record-fields/tiny-social-example/tiny-social-example.2.ddl.aql
new file mode 100644
index 0000000..079f6e2
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/records/get-record-fields/tiny-social-example/tiny-social-example.2.ddl.aql
@@ -0,0 +1,24 @@
+/*
+* Description  : Testing get-record-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/900bf134/asterix-app/src/test/resources/runtimets/queries/records/get-record-fields/tiny-social-example/tiny-social-example.3.update.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/records/get-record-fields/tiny-social-example/tiny-social-example.3.update.aql b/asterix-app/src/test/resources/runtimets/queries/records/get-record-fields/tiny-social-example/tiny-social-example.3.update.aql
new file mode 100644
index 0000000..f2cb06a
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/records/get-record-fields/tiny-social-example/tiny-social-example.3.update.aql
@@ -0,0 +1,18 @@
+/*
+* Description  : Testing get-record-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"));

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-app/src/test/resources/runtimets/queries/records/get-record-fields/tiny-social-example/tiny-social-example.4.query.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/records/get-record-fields/tiny-social-example/tiny-social-example.4.query.aql b/asterix-app/src/test/resources/runtimets/queries/records/get-record-fields/tiny-social-example/tiny-social-example.4.query.aql
new file mode 100644
index 0000000..fb4a402
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/records/get-record-fields/tiny-social-example/tiny-social-example.4.query.aql
@@ -0,0 +1,10 @@
+/*
+* Description  : Testing get-record-fields under different queries.
+* Expected Res : Success
+* Date         : 04 Jun 2015
+*/
+use dataverse TinySocial;
+
+for $user in dataset FacebookUsers
+where $user.id = 8
+return get-record-fields($user);

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-app/src/test/resources/runtimets/queries/records/get-record-fields/tiny-social-example/tiny-social-example.5.query.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/records/get-record-fields/tiny-social-example/tiny-social-example.5.query.aql b/asterix-app/src/test/resources/runtimets/queries/records/get-record-fields/tiny-social-example/tiny-social-example.5.query.aql
new file mode 100644
index 0000000..8f7359e
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/records/get-record-fields/tiny-social-example/tiny-social-example.5.query.aql
@@ -0,0 +1,10 @@
+/*
+* Description  : Testing get-record-fields under different queries.
+* Expected Res : Success
+* Date         : 04 Jun 2015
+*/
+use dataverse TinySocial;
+
+for $r in dataset FacebookUsers
+order by $r.id
+return get-record-fields($r);

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-app/src/test/resources/runtimets/queries/records/get-record-fields/tiny-social-example/tiny-social-example.6.query.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/records/get-record-fields/tiny-social-example/tiny-social-example.6.query.aql b/asterix-app/src/test/resources/runtimets/queries/records/get-record-fields/tiny-social-example/tiny-social-example.6.query.aql
new file mode 100644
index 0000000..b3129e8
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/records/get-record-fields/tiny-social-example/tiny-social-example.6.query.aql
@@ -0,0 +1,10 @@
+/*
+* Description  : Testing get-record-fields under different queries.
+* Expected Res : Success
+* Date         : 04 Jun 2015
+*/
+use dataverse TinySocial;
+
+for $r in dataset FacebookMessages
+order by $r.message-id
+return get-record-fields($r);

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-app/src/test/resources/runtimets/queries/records/get-record-fields/tiny-social-example/tiny-social-example.7.query.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/records/get-record-fields/tiny-social-example/tiny-social-example.7.query.aql b/asterix-app/src/test/resources/runtimets/queries/records/get-record-fields/tiny-social-example/tiny-social-example.7.query.aql
new file mode 100644
index 0000000..b979dd7
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/records/get-record-fields/tiny-social-example/tiny-social-example.7.query.aql
@@ -0,0 +1,10 @@
+/*
+* Description  : Testing get-record-fields under different queries.
+* Expected Res : Success
+* Date         : 04 Jun 2015
+*/
+use dataverse TinySocial;
+
+for $r in dataset TwitterUsers
+order by $r.screen-name
+return get-record-fields($r);

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-app/src/test/resources/runtimets/queries/records/get-record-fields/tiny-social-example/tiny-social-example.8.query.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/records/get-record-fields/tiny-social-example/tiny-social-example.8.query.aql b/asterix-app/src/test/resources/runtimets/queries/records/get-record-fields/tiny-social-example/tiny-social-example.8.query.aql
new file mode 100644
index 0000000..48b8e6e
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/records/get-record-fields/tiny-social-example/tiny-social-example.8.query.aql
@@ -0,0 +1,10 @@
+/*
+* Description  : Testing get-record-fields under different queries.
+* Expected Res : Success
+* Date         : 04 Jun 2015
+*/
+use dataverse TinySocial;
+
+for $r in dataset TweetMessages
+order by $r.tweetid
+return get-record-fields($r);

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-app/src/test/resources/runtimets/queries/records/get-record-fields/tiny-social-example/tiny-social-example.9.query.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/records/get-record-fields/tiny-social-example/tiny-social-example.9.query.aql b/asterix-app/src/test/resources/runtimets/queries/records/get-record-fields/tiny-social-example/tiny-social-example.9.query.aql
new file mode 100644
index 0000000..d30a74e
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/records/get-record-fields/tiny-social-example/tiny-social-example.9.query.aql
@@ -0,0 +1,13 @@
+/*
+* Description  : Testing get-record-fields under different queries.
+* Expected Res : Success
+* Date         : 04 Jun 2015
+*/
+use dataverse TinySocial;
+
+for $r in dataset TweetMessages
+for $f in get-record-fields($r)
+group by $n:=$f.field-name, $t:=$f.field-type with $r
+let $count:=count($r)
+order by $n, $t
+return {"field-name":$n, "field-type":$t, "count":$count};

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-app/src/test/resources/runtimets/repeatedtestsuite.xml
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/repeatedtestsuite.xml b/asterix-app/src/test/resources/runtimets/repeatedtestsuite.xml
new file mode 100644
index 0000000..e4bbc73
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/repeatedtestsuite.xml
@@ -0,0 +1,31 @@
+<!--
+ ! Copyright 2009-2013 by The Regents of the University of California
+ ! Licensed 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 from
+ ! 
+ !     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-suite
+    xmlns="urn:xml.testframework.asterix.ics.uci.edu"
+    ResultOffsetPath="results"
+    QueryOffsetPath="queries"
+    QueryFileExtension=".aql">
+    <!-- By default no test are listed here. This is only for individual testing purposes. -->
+    <!-- The following test case is commented out as an example. -->
+    <test-group name="repeated-tests">
+<!--
+        <test-case FilePath="records/get-record-fields">
+            <compilation-unit name="tiny-social-example">
+                <output-dir compare="Text">tiny-social-example</output-dir>
+            </compilation-unit>
+        </test-case>
+-->
+    </test-group>
+</test-suite>

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-app/src/test/resources/runtimets/results/records/access-nested-fields/access-nested-fields.10.adm
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/results/records/access-nested-fields/access-nested-fields.10.adm b/asterix-app/src/test/resources/runtimets/results/records/access-nested-fields/access-nested-fields.10.adm
new file mode 100644
index 0000000..ba62392
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/records/access-nested-fields/access-nested-fields.10.adm
@@ -0,0 +1,5 @@
+[ { "id": 1, "Kingdom": "Animalia", "lower": { "id": 1, "Phylum": "Chordata", "lower": { "id": 1, "Class": "Mammalia", "lower": { "id": 1, "Order": "Carnivora", "lower": { "id": 1, "Family": "Mustelinae", "lower": { "id": 1, "Genus": "Gulo", "lower": { "id": 1, "Species": "Gulo" } } } } } } }
+, { "id": 2, "Kingdom": "Animalia", "lower": { "id": 2, "Phylum": "Chordata", "lower": { "id": 2, "Class": "Mammalia", "lower": { "id": 2, "Order": "Artiodactyla", "lower": { "id": 2, "Family": "Giraffidae", "lower": { "id": 2, "Genus": "Okapia", "lower": { "id": 2, "Species": "Johnstoni" } } } } } } }
+, { "id": 3, "Kingdom": "Animalia", "lower": { "id": 3, "Phylum": "Chordata", "lower": { "id": 3, "Class": "Mammalia", "lower": { "id": 3, "Order": "Atlantogenata", "lower": { "id": 3, "Family": "Afrotheria", "lower": { "id": 3, "Genus": "Paenungulata", "lower": { "id": 3, "Species": "Hyracoidea" } } } } } } }
+, { "id": 4, "Kingdom": "Animalia", "lower": { "id": 4, "Phylum": "Chordata", "lower": { "id": 4, "Class": "Aves", "lower": { "id": 4, "Order": "Accipitriformes", "lower": { "id": 4, "Family": "Accipitridae", "lower": { "id": 4, "Genus": "Buteo", "lower": { "id": 4, "Species": "Jamaicensis" } } } } } } }
+ ]
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-app/src/test/resources/runtimets/results/records/access-nested-fields/access-nested-fields.11.adm
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/results/records/access-nested-fields/access-nested-fields.11.adm b/asterix-app/src/test/resources/runtimets/results/records/access-nested-fields/access-nested-fields.11.adm
new file mode 100644
index 0000000..e04c4d4
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/records/access-nested-fields/access-nested-fields.11.adm
@@ -0,0 +1,5 @@
+[ { "id": 1, "fullClassification": { "id": 1, "Kingdom": "Animalia", "lower": { "id": 1, "Phylum": "Chordata", "lower": { "id": 1, "Class": "Mammalia", "lower": { "id": 1, "Order": "Carnivora", "lower": { "id": 1, "Family": "Mustelinae", "lower": { "id": 1, "Genus": "Gulo", "lower": { "id": 1, "Species": "Gulo" } } } } } } } }
+, { "id": 2, "fullClassification": { "id": 2, "Kingdom": "Animalia", "lower": { "id": 2, "Phylum": "Chordata", "lower": { "id": 2, "Class": "Mammalia", "lower": { "id": 2, "Order": "Artiodactyla", "lower": { "id": 2, "Family": "Giraffidae", "lower": { "id": 2, "Genus": "Okapia", "lower": { "id": 2, "Species": "Johnstoni" } } } } } } } }
+, { "id": 3, "fullClassification": { "id": 3, "Kingdom": "Animalia", "lower": { "id": 3, "Phylum": "Chordata", "lower": { "id": 3, "Class": "Mammalia", "lower": { "id": 3, "Order": "Atlantogenata", "lower": { "id": 3, "Family": "Afrotheria", "lower": { "id": 3, "Genus": "Paenungulata", "lower": { "id": 3, "Species": "Hyracoidea" } } } } } } } }
+, { "id": 4, "fullClassification": { "id": 4, "Kingdom": "Animalia", "lower": { "id": 4, "Phylum": "Chordata", "lower": { "id": 4, "Class": "Aves", "lower": { "id": 4, "Order": "Accipitriformes", "lower": { "id": 4, "Family": "Accipitridae", "lower": { "id": 4, "Genus": "Buteo", "lower": { "id": 4, "Species": "Jamaicensis" } } } } } } } }
+ ]

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-app/src/test/resources/runtimets/results/records/access-nested-fields/access-nested-fields.12.adm
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/results/records/access-nested-fields/access-nested-fields.12.adm b/asterix-app/src/test/resources/runtimets/results/records/access-nested-fields/access-nested-fields.12.adm
new file mode 100644
index 0000000..57e9e86
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/records/access-nested-fields/access-nested-fields.12.adm
@@ -0,0 +1,5 @@
+[ { "id": 1, "class": { "id": 1, "fullClassification": { "id": 1, "Kingdom": "Animalia", "lower": { "id": 1, "Phylum": "Chordata", "lower": { "id": 1, "Class": "Mammalia", "lower": { "id": 1, "Order": "Carnivora", "lower": { "id": 1, "Family": "Mustelinae", "lower": { "id": 1, "Genus": "Gulo", "lower": { "id": 1, "Species": "Gulo" } } } } } } } } }
+, { "id": 2, "class": { "id": 2, "fullClassification": { "id": 2, "Kingdom": "Animalia", "lower": { "id": 2, "Phylum": "Chordata", "lower": { "id": 2, "Class": "Mammalia", "lower": { "id": 2, "Order": "Artiodactyla", "lower": { "id": 2, "Family": "Giraffidae", "lower": { "id": 2, "Genus": "Okapia", "lower": { "id": 2, "Species": "Johnstoni" } } } } } } } } }
+, { "id": 3, "class": { "id": 3, "fullClassification": { "id": 3, "Kingdom": "Animalia", "lower": { "id": 3, "Phylum": "Chordata", "lower": { "id": 3, "Class": "Mammalia", "lower": { "id": 3, "Order": "Atlantogenata", "lower": { "id": 3, "Family": "Afrotheria", "lower": { "id": 3, "Genus": "Paenungulata", "lower": { "id": 3, "Species": "Hyracoidea" } } } } } } } } }
+, { "id": 4, "class": { "id": 4, "fullClassification": { "id": 4, "Kingdom": "Animalia", "lower": { "id": 4, "Phylum": "Chordata", "lower": { "id": 4, "Class": "Aves", "lower": { "id": 4, "Order": "Accipitriformes", "lower": { "id": 4, "Family": "Accipitridae", "lower": { "id": 4, "Genus": "Buteo", "lower": { "id": 4, "Species": "Jamaicensis" } } } } } } } } }
+ ]
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-app/src/test/resources/runtimets/results/records/access-nested-fields/access-nested-fields.3.adm
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/results/records/access-nested-fields/access-nested-fields.3.adm b/asterix-app/src/test/resources/runtimets/results/records/access-nested-fields/access-nested-fields.3.adm
new file mode 100644
index 0000000..87e1291
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/records/access-nested-fields/access-nested-fields.3.adm
@@ -0,0 +1,5 @@
+[ "Gulo"
+, "Hyracoidea"
+, "Jamaicensis"
+, "Johnstoni"
+ ]
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-app/src/test/resources/runtimets/results/records/access-nested-fields/access-nested-fields.4.adm
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/results/records/access-nested-fields/access-nested-fields.4.adm b/asterix-app/src/test/resources/runtimets/results/records/access-nested-fields/access-nested-fields.4.adm
new file mode 100644
index 0000000..f724405
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/records/access-nested-fields/access-nested-fields.4.adm
@@ -0,0 +1,5 @@
+[ { "id": 1, "Species": "Gulo" }
+, { "id": 2, "Species": "Johnstoni" }
+, { "id": 3, "Species": "Hyracoidea" }
+, { "id": 4, "Species": "Jamaicensis" }
+ ]
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-app/src/test/resources/runtimets/results/records/access-nested-fields/access-nested-fields.5.adm
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/results/records/access-nested-fields/access-nested-fields.5.adm b/asterix-app/src/test/resources/runtimets/results/records/access-nested-fields/access-nested-fields.5.adm
new file mode 100644
index 0000000..f84fa4d
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/records/access-nested-fields/access-nested-fields.5.adm
@@ -0,0 +1,5 @@
+[ { "id": 1, "Genus": "Gulo", "lower": { "id": 1, "Species": "Gulo" } }
+, { "id": 2, "Genus": "Okapia", "lower": { "id": 2, "Species": "Johnstoni" } }
+, { "id": 3, "Genus": "Paenungulata", "lower": { "id": 3, "Species": "Hyracoidea" } }
+, { "id": 4, "Genus": "Buteo", "lower": { "id": 4, "Species": "Jamaicensis" } }
+ ]
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-app/src/test/resources/runtimets/results/records/access-nested-fields/access-nested-fields.6.adm
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/results/records/access-nested-fields/access-nested-fields.6.adm b/asterix-app/src/test/resources/runtimets/results/records/access-nested-fields/access-nested-fields.6.adm
new file mode 100644
index 0000000..656d0c3
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/records/access-nested-fields/access-nested-fields.6.adm
@@ -0,0 +1,5 @@
+[ { "id": 1, "Family": "Mustelinae", "lower": { "id": 1, "Genus": "Gulo", "lower": { "id": 1, "Species": "Gulo" } } }
+, { "id": 2, "Family": "Giraffidae", "lower": { "id": 2, "Genus": "Okapia", "lower": { "id": 2, "Species": "Johnstoni" } } }
+, { "id": 3, "Family": "Afrotheria", "lower": { "id": 3, "Genus": "Paenungulata", "lower": { "id": 3, "Species": "Hyracoidea" } } }
+, { "id": 4, "Family": "Accipitridae", "lower": { "id": 4, "Genus": "Buteo", "lower": { "id": 4, "Species": "Jamaicensis" } } }
+ ]

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-app/src/test/resources/runtimets/results/records/access-nested-fields/access-nested-fields.7.adm
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/results/records/access-nested-fields/access-nested-fields.7.adm b/asterix-app/src/test/resources/runtimets/results/records/access-nested-fields/access-nested-fields.7.adm
new file mode 100644
index 0000000..67b9b86
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/records/access-nested-fields/access-nested-fields.7.adm
@@ -0,0 +1,5 @@
+[ { "id": 1, "Order": "Carnivora", "lower": { "id": 1, "Family": "Mustelinae", "lower": { "id": 1, "Genus": "Gulo", "lower": { "id": 1, "Species": "Gulo" } } } }
+, { "id": 2, "Order": "Artiodactyla", "lower": { "id": 2, "Family": "Giraffidae", "lower": { "id": 2, "Genus": "Okapia", "lower": { "id": 2, "Species": "Johnstoni" } } } }
+, { "id": 3, "Order": "Atlantogenata", "lower": { "id": 3, "Family": "Afrotheria", "lower": { "id": 3, "Genus": "Paenungulata", "lower": { "id": 3, "Species": "Hyracoidea" } } } }
+, { "id": 4, "Order": "Accipitriformes", "lower": { "id": 4, "Family": "Accipitridae", "lower": { "id": 4, "Genus": "Buteo", "lower": { "id": 4, "Species": "Jamaicensis" } } } }
+ ]
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-app/src/test/resources/runtimets/results/records/access-nested-fields/access-nested-fields.8.adm
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/results/records/access-nested-fields/access-nested-fields.8.adm b/asterix-app/src/test/resources/runtimets/results/records/access-nested-fields/access-nested-fields.8.adm
new file mode 100644
index 0000000..99cb0ce
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/records/access-nested-fields/access-nested-fields.8.adm
@@ -0,0 +1,5 @@
+[ { "id": 1, "Class": "Mammalia", "lower": { "id": 1, "Order": "Carnivora", "lower": { "id": 1, "Family": "Mustelinae", "lower": { "id": 1, "Genus": "Gulo", "lower": { "id": 1, "Species": "Gulo" } } } } }
+, { "id": 2, "Class": "Mammalia", "lower": { "id": 2, "Order": "Artiodactyla", "lower": { "id": 2, "Family": "Giraffidae", "lower": { "id": 2, "Genus": "Okapia", "lower": { "id": 2, "Species": "Johnstoni" } } } } }
+, { "id": 3, "Class": "Mammalia", "lower": { "id": 3, "Order": "Atlantogenata", "lower": { "id": 3, "Family": "Afrotheria", "lower": { "id": 3, "Genus": "Paenungulata", "lower": { "id": 3, "Species": "Hyracoidea" } } } } }
+, { "id": 4, "Class": "Aves", "lower": { "id": 4, "Order": "Accipitriformes", "lower": { "id": 4, "Family": "Accipitridae", "lower": { "id": 4, "Genus": "Buteo", "lower": { "id": 4, "Species": "Jamaicensis" } } } } }
+ ]

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-app/src/test/resources/runtimets/results/records/access-nested-fields/access-nested-fields.9.adm
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/results/records/access-nested-fields/access-nested-fields.9.adm b/asterix-app/src/test/resources/runtimets/results/records/access-nested-fields/access-nested-fields.9.adm
new file mode 100644
index 0000000..bdf5ca5
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/records/access-nested-fields/access-nested-fields.9.adm
@@ -0,0 +1,5 @@
+[ { "id": 1, "Phylum": "Chordata", "lower": { "id": 1, "Class": "Mammalia", "lower": { "id": 1, "Order": "Carnivora", "lower": { "id": 1, "Family": "Mustelinae", "lower": { "id": 1, "Genus": "Gulo", "lower": { "id": 1, "Species": "Gulo" } } } } } }
+, { "id": 2, "Phylum": "Chordata", "lower": { "id": 2, "Class": "Mammalia", "lower": { "id": 2, "Order": "Artiodactyla", "lower": { "id": 2, "Family": "Giraffidae", "lower": { "id": 2, "Genus": "Okapia", "lower": { "id": 2, "Species": "Johnstoni" } } } } } }
+, { "id": 3, "Phylum": "Chordata", "lower": { "id": 3, "Class": "Mammalia", "lower": { "id": 3, "Order": "Atlantogenata", "lower": { "id": 3, "Family": "Afrotheria", "lower": { "id": 3, "Genus": "Paenungulata", "lower": { "id": 3, "Species": "Hyracoidea" } } } } } }
+, { "id": 4, "Phylum": "Chordata", "lower": { "id": 4, "Class": "Aves", "lower": { "id": 4, "Order": "Accipitriformes", "lower": { "id": 4, "Family": "Accipitridae", "lower": { "id": 4, "Genus": "Buteo", "lower": { "id": 4, "Species": "Jamaicensis" } } } } } }
+ ]
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-app/src/test/resources/runtimets/results/records/get-record-field-value/documentation-example/documentation-example.1.adm
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/results/records/get-record-field-value/documentation-example/documentation-example.1.adm b/asterix-app/src/test/resources/runtimets/results/records/get-record-field-value/documentation-example/documentation-example.1.adm
new file mode 100644
index 0000000..0616231
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/records/get-record-field-value/documentation-example/documentation-example.1.adm
@@ -0,0 +1,2 @@
+[ "AsterixDB"
+ ]
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-app/src/test/resources/runtimets/results/records/get-record-field-value/documentation-example/documentation-example.2.adm
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/results/records/get-record-field-value/documentation-example/documentation-example.2.adm b/asterix-app/src/test/resources/runtimets/results/records/get-record-field-value/documentation-example/documentation-example.2.adm
new file mode 100644
index 0000000..985b94e
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/records/get-record-field-value/documentation-example/documentation-example.2.adm
@@ -0,0 +1,2 @@
+[ { "city": "Irvine", "state": "CA" }
+ ]
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-app/src/test/resources/runtimets/results/records/get-record-field-value/documentation-example/documentation-example.3.adm
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/results/records/get-record-field-value/documentation-example/documentation-example.3.adm b/asterix-app/src/test/resources/runtimets/results/records/get-record-field-value/documentation-example/documentation-example.3.adm
new file mode 100644
index 0000000..802f510
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/records/get-record-field-value/documentation-example/documentation-example.3.adm
@@ -0,0 +1,2 @@
+[ [ "Hivestrix", "Preglix", "Apache VXQuery" ]
+ ]
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-app/src/test/resources/runtimets/results/records/get-record-field-value/highly-nested-closed/highly-nested-closed.3.adm
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/results/records/get-record-field-value/highly-nested-closed/highly-nested-closed.3.adm b/asterix-app/src/test/resources/runtimets/results/records/get-record-field-value/highly-nested-closed/highly-nested-closed.3.adm
new file mode 100644
index 0000000..67d992c
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/records/get-record-field-value/highly-nested-closed/highly-nested-closed.3.adm
@@ -0,0 +1,5 @@
+[ { "id": 1, "fullClassification": { "id": 1, "Kingdom": "Animalia", "lower": { "id": 1, "Phylum": "Chordata", "lower": { "id": 1, "Class": "Mammalia", "lower": { "id": 1, "Order": "Carnivora", "lower": { "id": 1, "Family": "Mustelinae", "lower": { "id": 1, "Genus": "Gulo", "lower": { "id": 1, "Species": "Gulo" } } } } } } } }
+, { "id": 2, "fullClassification": { "id": 2, "Kingdom": "Animalia", "lower": { "id": 2, "Phylum": "Chordata", "lower": { "id": 2, "Class": "Mammalia", "lower": { "id": 2, "Order": "Artiodactyla", "lower": { "id": 2, "Family": "Giraffidae", "lower": { "id": 2, "Genus": "Okapia", "lower": { "id": 2, "Species": "Johnstoni" } } } } } } } }
+, { "id": 3, "fullClassification": { "id": 3, "Kingdom": "Animalia", "lower": { "id": 3, "Phylum": "Chordata", "lower": { "id": 3, "Class": "Mammalia", "lower": { "id": 3, "Order": "Atlantogenata", "lower": { "id": 3, "Family": "Afrotheria", "lower": { "id": 3, "Genus": "Paenungulata", "lower": { "id": 3, "Species": "Hyracoidea" } } } } } } } }
+, { "id": 4, "fullClassification": { "id": 4, "Kingdom": "Animalia", "lower": { "id": 4, "Phylum": "Chordata", "lower": { "id": 4, "Class": "Aves", "lower": { "id": 4, "Order": "Accipitriformes", "lower": { "id": 4, "Family": "Accipitridae", "lower": { "id": 4, "Genus": "Buteo", "lower": { "id": 4, "Species": "Jamaicensis" } } } } } } } }
+ ]
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-app/src/test/resources/runtimets/results/records/get-record-field-value/highly-nested-mixed/highly-nested-mixed.3.adm
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/results/records/get-record-field-value/highly-nested-mixed/highly-nested-mixed.3.adm b/asterix-app/src/test/resources/runtimets/results/records/get-record-field-value/highly-nested-mixed/highly-nested-mixed.3.adm
new file mode 100644
index 0000000..67d992c
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/records/get-record-field-value/highly-nested-mixed/highly-nested-mixed.3.adm
@@ -0,0 +1,5 @@
+[ { "id": 1, "fullClassification": { "id": 1, "Kingdom": "Animalia", "lower": { "id": 1, "Phylum": "Chordata", "lower": { "id": 1, "Class": "Mammalia", "lower": { "id": 1, "Order": "Carnivora", "lower": { "id": 1, "Family": "Mustelinae", "lower": { "id": 1, "Genus": "Gulo", "lower": { "id": 1, "Species": "Gulo" } } } } } } } }
+, { "id": 2, "fullClassification": { "id": 2, "Kingdom": "Animalia", "lower": { "id": 2, "Phylum": "Chordata", "lower": { "id": 2, "Class": "Mammalia", "lower": { "id": 2, "Order": "Artiodactyla", "lower": { "id": 2, "Family": "Giraffidae", "lower": { "id": 2, "Genus": "Okapia", "lower": { "id": 2, "Species": "Johnstoni" } } } } } } } }
+, { "id": 3, "fullClassification": { "id": 3, "Kingdom": "Animalia", "lower": { "id": 3, "Phylum": "Chordata", "lower": { "id": 3, "Class": "Mammalia", "lower": { "id": 3, "Order": "Atlantogenata", "lower": { "id": 3, "Family": "Afrotheria", "lower": { "id": 3, "Genus": "Paenungulata", "lower": { "id": 3, "Species": "Hyracoidea" } } } } } } } }
+, { "id": 4, "fullClassification": { "id": 4, "Kingdom": "Animalia", "lower": { "id": 4, "Phylum": "Chordata", "lower": { "id": 4, "Class": "Aves", "lower": { "id": 4, "Order": "Accipitriformes", "lower": { "id": 4, "Family": "Accipitridae", "lower": { "id": 4, "Genus": "Buteo", "lower": { "id": 4, "Species": "Jamaicensis" } } } } } } } }
+ ]
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-app/src/test/resources/runtimets/results/records/get-record-field-value/highly-nested-open/highly-nested-open.3.adm
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/results/records/get-record-field-value/highly-nested-open/highly-nested-open.3.adm b/asterix-app/src/test/resources/runtimets/results/records/get-record-field-value/highly-nested-open/highly-nested-open.3.adm
new file mode 100644
index 0000000..67d992c
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/records/get-record-field-value/highly-nested-open/highly-nested-open.3.adm
@@ -0,0 +1,5 @@
+[ { "id": 1, "fullClassification": { "id": 1, "Kingdom": "Animalia", "lower": { "id": 1, "Phylum": "Chordata", "lower": { "id": 1, "Class": "Mammalia", "lower": { "id": 1, "Order": "Carnivora", "lower": { "id": 1, "Family": "Mustelinae", "lower": { "id": 1, "Genus": "Gulo", "lower": { "id": 1, "Species": "Gulo" } } } } } } } }
+, { "id": 2, "fullClassification": { "id": 2, "Kingdom": "Animalia", "lower": { "id": 2, "Phylum": "Chordata", "lower": { "id": 2, "Class": "Mammalia", "lower": { "id": 2, "Order": "Artiodactyla", "lower": { "id": 2, "Family": "Giraffidae", "lower": { "id": 2, "Genus": "Okapia", "lower": { "id": 2, "Species": "Johnstoni" } } } } } } } }
+, { "id": 3, "fullClassification": { "id": 3, "Kingdom": "Animalia", "lower": { "id": 3, "Phylum": "Chordata", "lower": { "id": 3, "Class": "Mammalia", "lower": { "id": 3, "Order": "Atlantogenata", "lower": { "id": 3, "Family": "Afrotheria", "lower": { "id": 3, "Genus": "Paenungulata", "lower": { "id": 3, "Species": "Hyracoidea" } } } } } } } }
+, { "id": 4, "fullClassification": { "id": 4, "Kingdom": "Animalia", "lower": { "id": 4, "Phylum": "Chordata", "lower": { "id": 4, "Class": "Aves", "lower": { "id": 4, "Order": "Accipitriformes", "lower": { "id": 4, "Family": "Accipitridae", "lower": { "id": 4, "Genus": "Buteo", "lower": { "id": 4, "Species": "Jamaicensis" } } } } } } } }
+ ]
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-app/src/test/resources/runtimets/results/records/get-record-field-value/tiny-social-example/tiny-social-example.4.adm
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/results/records/get-record-field-value/tiny-social-example/tiny-social-example.4.adm b/asterix-app/src/test/resources/runtimets/results/records/get-record-field-value/tiny-social-example/tiny-social-example.4.adm
new file mode 100644
index 0000000..0f002f4
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/records/get-record-field-value/tiny-social-example/tiny-social-example.4.adm
@@ -0,0 +1,25 @@
+[ " can't stand iphone its platform is terrible"
+, " can't stand motorola its speed is terrible:("
+, " hate verizon its voice-clarity is OMG:("
+, " like iphone the voice-clarity is good:)"
+, " like motorola the speed is good:)"
+, " like samsung the platform is good"
+, " like samsung the voice-command is amazing:)"
+, " like sprint the voice-command is mind-blowing:)"
+, " like t-mobile the shortcut-menu is awesome:)"
+, " like verizon its shortcut-menu is awesome:)"
+, " love t-mobile its customization is good:)"
+, " love verizon its voicemail-service is awesome"
+, "1"
+, "10"
+, "11"
+, "12"
+, "2"
+, "3"
+, "4"
+, "5"
+, "6"
+, "7"
+, "8"
+, "9"
+ ]
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-app/src/test/resources/runtimets/results/records/get-record-fields/documentation-example/documentation-example.1.adm
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/results/records/get-record-fields/documentation-example/documentation-example.1.adm b/asterix-app/src/test/resources/runtimets/results/records/get-record-fields/documentation-example/documentation-example.1.adm
new file mode 100644
index 0000000..ff67a9e
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/records/get-record-fields/documentation-example/documentation-example.1.adm
@@ -0,0 +1,2 @@
+[ [ { "field-name": "id", "field-type": "INT64", "is-open": false }, { "field-name": "project", "field-type": "STRING", "is-open": false }, { "field-name": "address", "field-type": "RECORD", "is-open": false, "nested": [ { "field-name": "city", "field-type": "STRING", "is-open": false }, { "field-name": "state", "field-type": "STRING", "is-open": false } ] }, { "field-name": "related", "field-type": "ORDEREDLIST", "is-open": false, "list": [ { "field-type": "STRING" }, { "field-type": "STRING" }, { "field-type": "STRING" } ] } ]
+ ]
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-app/src/test/resources/runtimets/results/records/get-record-fields/tiny-social-example-no-complex-types/tiny-social-example-no-complex-types.4.adm
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/results/records/get-record-fields/tiny-social-example-no-complex-types/tiny-social-example-no-complex-types.4.adm b/asterix-app/src/test/resources/runtimets/results/records/get-record-fields/tiny-social-example-no-complex-types/tiny-social-example-no-complex-types.4.adm
new file mode 100644
index 0000000..ea66e8b
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/records/get-record-fields/tiny-social-example-no-complex-types/tiny-social-example-no-complex-types.4.adm
@@ -0,0 +1,2 @@
+[ [ { "field-name": "id", "field-type": "INT64", "is-open": false }, { "field-name": "alias", "field-type": "STRING", "is-open": false }, { "field-name": "name", "field-type": "STRING", "is-open": false }, { "field-name": "user-since", "field-type": "DATETIME", "is-open": false } ]
+ ]
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/900bf134/asterix-app/src/test/resources/runtimets/results/records/get-record-fields/tiny-social-example-no-complex-types/tiny-social-example-no-complex-types.5.adm
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/results/records/get-record-fields/tiny-social-example-no-complex-types/tiny-social-example-no-complex-types.5.adm b/asterix-app/src/test/resources/runtimets/results/records/get-record-fields/tiny-social-example-no-complex-types/tiny-social-example-no-complex-types.5.adm
new file mode 100644
index 0000000..43b6e20
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/records/get-record-fields/tiny-social-example-no-complex-types/tiny-social-example-no-complex-types.5.adm
@@ -0,0 +1,11 @@
+[ [ { "field-name": "id", "field-type": "INT64", "is-open": false }, { "field-name": "alias", "field-type": "STRING", "is-open": false }, { "field-name": "name", "field-type": "STRING", "is-open": false }, { "field-name": "user-since", "field-type": "DATETIME", "is-open": false } ]
+, [ { "field-name": "id", "field-type": "INT64", "is-open": false }, { "field-name": "alias", "field-type": "STRING", "is-open": false }, { "field-name": "name", "field-type": "STRING", "is-open": false }, { "field-name": "user-since", "field-type": "DATETIME", "is-open": false } ]
+, [ { "field-name": "id", "field-type": "INT64", "is-open": false }, { "field-name": "alias", "field-type": "STRING", "is-open": false }, { "field-name": "name", "field-type": "STRING", "is-open": false }, { "field-name": "user-since", "field-type": "DATETIME", "is-open": false } ]
+, [ { "field-name": "id", "field-type": "INT64", "is-open": false }, { "field-name": "alias", "field-type": "STRING", "is-open": false }, { "field-name": "name", "field-type": "STRING", "is-open": false }, { "field-name": "user-since", "field-type": "DATETIME", "is-open": false } ]
+, [ { "field-name": "id", "field-type": "INT64", "is-open": false }, { "field-name": "alias", "field-type": "STRING", "is-open": false }, { "field-name": "name", "field-type": "STRING", "is-open": false }, { "field-name": "user-since", "field-type": "DATETIME", "is-open": false } ]
+, [ { "field-name": "id", "field-type": "INT64", "is-open": false }, { "field-name": "alias", "field-type": "STRING", "is-open": false }, { "field-name": "name", "field-type": "STRING", "is-open": false }, { "field-name": "user-since", "field-type": "DATETIME", "is-open": false } ]
+, [ { "field-name": "id", "field-type": "INT64", "is-open": false }, { "field-name": "alias", "field-type": "STRING", "is-open": false }, { "field-name": "name", "field-type": "STRING", "is-open": false }, { "field-name": "user-since", "field-type": "DATETIME", "is-open": false } ]
+, [ { "field-name": "id", "field-type": "INT64", "is-open": false }, { "field-name": "alias", "field-type": "STRING", "is-open": false }, { "field-name": "name", "field-type": "STRING", "is-open": false }, { "field-name": "user-since", "field-type": "DATETIME", "is-open": false } ]
+, [ { "field-name": "id", "field-type": "INT64", "is-open": false }, { "field-name": "alias", "field-type": "STRING", "is-open": false }, { "field-name": "name", "field-type": "STRING", "is-open": false }, { "field-name": "user-since", "field-type": "DATETIME", "is-open": false } ]
+, [ { "field-name": "id", "field-type": "INT64", "is-open": false }, { "field-name": "alias", "field-type": "STRING", "is-open": false }, { "field-name": "name", "field-type": "STRING", "is-open": false }, { "field-name": "user-since", "field-type": "DATETIME", "is-open": false } ]
+ ]
\ No newline at end of file