[ASTERIXDB-2287][SQL] Support SELECT variable.* in SQL++

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

Details:
- Support SELECT variable.* in SQL++
- Include variables defined by LET clauses in the
  output record created by SELECT *
- Add object_concat() function
- Add tests for these new features
- Fail testcase if its source directory is missing
- Fix testcases that did not run previously because
  their source directories were incorrectly specified

Change-Id: I058dc0f45072a1398f6431e0c73ce680c4d8cdc7
Reviewed-on: https://asterix-gerrit.ics.uci.edu/2394
Sonar-Qube: Jenkins <jenk...@fulliautomatix.ics.uci.edu>
Tested-by: Jenkins <jenk...@fulliautomatix.ics.uci.edu>
Contrib: Jenkins <jenk...@fulliautomatix.ics.uci.edu>
Integration-Tests: Jenkins <jenk...@fulliautomatix.ics.uci.edu>
Reviewed-by: Till Westmann <ti...@apache.org>


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

Branch: refs/heads/master
Commit: 5cdaa5d6a2ad86d0b0cfc9f7c8a4e641c6e162f5
Parents: dba817c
Author: Dmitry Lychagin <dmitry.lycha...@couchbase.com>
Authored: Wed Feb 21 11:11:26 2018 -0800
Committer: Dmitry Lychagin <dmitry.lycha...@couchbase.com>
Committed: Wed Feb 21 20:03:07 2018 -0800

----------------------------------------------------------------------
 .../optimizer/rules/ConstantFoldingRule.java    |  13 +-
 .../SqlppExpressionToPlanTranslator.java        | 174 +++++----
 .../asterix/test/common/TestExecutor.java       |   4 +
 .../builtin_type/meta03_builtin_type.1.adm      |   2 +-
 .../meta03_builtin_type_nullable.1.adm          |   2 +-
 .../ordered_list/meta03_ordered_list.1.adm      |   3 +-
 .../meta03_ordered_list_nullable.1.adm          |   3 +-
 .../complex_type/record/meta03_record.1.adm     |   3 +-
 .../meta03_record_nullable.1.adm                |   3 +-
 .../unordered_list/meta03_unordered_list.1.adm  |   3 +-
 .../meta03_unordered_list_nullable.1.adm        |   3 +-
 .../builtin_type/meta04_builtin_type.1.adm      |   2 +-
 .../meta04_builtin_type_nullable.1.adm          |   2 +-
 .../ordered_list/meta04_ordered_list.1.adm      |   3 +-
 .../meta04_ordered_list_nullable.1.adm          |   3 +-
 .../complex_type/record/meta04_record.1.adm     |   3 +-
 .../meta04_record_nullable.1.adm                |   3 +-
 .../unordered_list/meta04_unordered_list.1.adm  |   3 +-
 .../meta04_unordered_list_nullable.1.adm        |   3 +-
 .../src/test/resources/metadata/testsuite.xml   |  44 +--
 .../queries/objects/ObjectsQueries.xml          |  89 ++---
 .../tiny-social-example.4.query.aql             |   2 +-
 .../tiny-social-example.3.update.aql            |   8 +-
 .../tiny-social-example.3.update.aql            |   8 +-
 .../tiny-social-example.4.query.aql             |   2 +-
 .../object-type-collision.1.ddl.aql             |  29 ++
 .../record-collision.1.ddl.aql                  |  29 --
 .../queries/temporal/TemporalQueries.xml        |   9 +-
 ...s-same-as-pk-but-different-order.1.ddl.sqlpp |  40 ---
 ...s-same-as-pk-but-different-order.1.ddl.sqlpp |  40 +++
 .../keys-same-as-pk-in-same-order.2.ddl.sqlpp   |  40 ---
 .../keys-same-as-pk-in-same-order.1.ddl.sqlpp   |  40 +++
 .../validations/repetitive-keys.3.ddl.sqlpp     |  40 ---
 .../repetitive-keys/repetitive-keys.1.ddl.sqlpp |  40 +++
 ...ram-edit-distance-word-tokens.2.update.sqlpp |   4 +-
 .../queries_sqlpp/objects/ObjectsQueries.xml    |  55 +--
 .../tiny-social-example.4.query.sqlpp           |   2 +-
 .../object_concat/object_concat.1.query.sqlpp   |  33 ++
 .../select-star/from/from.4.query.sqlpp         |  34 ++
 .../select-star/group_by/group_by.4.query.sqlpp |  29 ++
 .../select-star/mixed/mixed.4.query.sqlpp       |  31 ++
 .../select-star/var_star/var_star.1.ddl.sqlpp   |  75 ++++
 .../var_star/var_star.2.update.sqlpp            |  27 ++
 .../select-star/var_star/var_star.3.query.sqlpp |  30 ++
 .../select-star/var_star/var_star.4.query.sqlpp |  30 ++
 .../var_star_2/var_star_2.1.query.sqlpp         |  26 ++
 .../union_orderby_5.1.ddl.sqlpp                 |  39 --
 .../union_orderby_5.2.update.sqlpp              |  26 --
 .../union_orderby_5.3.query.sqlpp               |  30 --
 .../union_orderby_5/union_orderby_5.1.ddl.sqlpp |  39 ++
 .../union_orderby_5.2.update.sqlpp              |  26 ++
 .../union_orderby_5.3.query.sqlpp               |  30 ++
 .../closed-nullable-fields_issue1616.1.adm      |   4 +-
 .../documentation-example.1.adm                 |   2 +-
 .../tiny-social-example-no-complex-types.4.adm  |   2 +-
 .../tiny-social-example-no-complex-types.5.adm  |  20 +-
 .../tiny-social-example-no-complex-types.6.adm  |  30 +-
 .../tiny-social-example-no-complex-types.7.adm  |   8 +-
 .../tiny-social-example-no-complex-types.8.adm  |  24 +-
 .../tiny-social-example-no-complex-types.9.adm  |   8 +-
 .../tiny-social-example-only-lists.4.adm        |   2 +-
 .../tiny-social-example-only-lists.5.adm        |  20 +-
 .../tiny-social-example-only-lists.6.adm        |  30 +-
 .../tiny-social-example-only-lists.7.adm        |   8 +-
 .../tiny-social-example-only-lists.8.adm        |  24 +-
 .../tiny-social-example-only-lists.9.adm        |  10 +-
 .../tiny-social-example-only-records.4.adm      |   2 +-
 .../tiny-social-example-only-records.5.adm      |  20 +-
 .../tiny-social-example-only-records.6.adm      |  30 +-
 .../tiny-social-example-only-records.7.adm      |   8 +-
 .../tiny-social-example-only-records.8.adm      |  24 +-
 .../tiny-social-example-only-records.9.adm      |  10 +-
 .../tiny-social-example.4.adm                   | 188 +++++++++-
 .../tiny-social-example.4.adm                   | 360 +++++++++----------
 .../tiny-social-example.4.adm                   |  22 +-
 .../objects/object_concat/object_concat.1.adm   |   1 +
 .../results/select-star/from/from.2.adm         |   3 +
 .../results/select-star/group_by/group_by.2.adm |   5 +
 .../results/select-star/mixed/mixed.2.adm       |   3 +
 .../results/select-star/var_star/var_star.3.adm |   3 +
 .../results/select-star/var_star/var_star.4.adm |   3 +
 .../results/temporal/agg_max/agg_max.1.adm      |   6 +-
 .../results/temporal/agg_min/agg_min.1.adm      |   6 +-
 .../access-nested-fields.10.ast                 |   2 +-
 .../access-nested-fields.11.ast                 |   2 +-
 .../access-nested-fields.12.ast                 |   2 +-
 .../access-nested-fields.3.ast                  |   2 +-
 .../access-nested-fields.4.ast                  |   2 +-
 .../access-nested-fields.5.ast                  |   2 +-
 .../access-nested-fields.6.ast                  |   2 +-
 .../access-nested-fields.7.ast                  |   2 +-
 .../access-nested-fields.8.ast                  |   2 +-
 .../access-nested-fields.9.ast                  |   2 +-
 .../field-access-on-open-field.3.ast            |   2 +-
 .../highly-nested-open.3.ast                    |   2 +-
 .../highly-nested-mixed.3.ast                   |   2 +-
 .../highly-nested-open/highly-nested-open.3.ast |   2 +-
 .../tiny-social-example.4.ast                   |   4 +-
 .../tiny-social-example-no-complex-types.4.ast  |   2 +-
 .../tiny-social-example-no-complex-types.5.ast  |   2 +-
 .../tiny-social-example-no-complex-types.6.ast  |   2 +-
 .../tiny-social-example-no-complex-types.7.ast  |   2 +-
 .../tiny-social-example-no-complex-types.8.ast  |   2 +-
 .../tiny-social-example-no-complex-types.9.ast  |   2 +-
 .../tiny-social-example-only-lists.4.ast        |   2 +-
 .../tiny-social-example-only-lists.5.ast        |   2 +-
 .../tiny-social-example-only-lists.6.ast        |   2 +-
 .../tiny-social-example-only-lists.7.ast        |   2 +-
 .../tiny-social-example-only-lists.8.ast        |   2 +-
 .../tiny-social-example-only-lists.9.ast        |   2 +-
 .../tiny-social-example-only-records.4.ast      |   2 +-
 .../tiny-social-example-only-records.5.ast      |   2 +-
 .../tiny-social-example-only-records.6.ast      |   2 +-
 .../tiny-social-example-only-records.7.ast      |   2 +-
 .../tiny-social-example-only-records.8.ast      |   2 +-
 .../tiny-social-example-only-records.9.ast      |   2 +-
 ...pen-closed-fieldname-conflict_issue173.3.ast |   2 +-
 .../open-open-fieldname-conflict_issue173.3.ast |   2 +-
 .../src/test/resources/runtimets/testsuite.xml  |  31 +-
 .../resources/runtimets/testsuite_sqlpp.xml     | 118 +++---
 .../runtimets/testsuite_sqlpp_parser.xml        |   4 +-
 .../asterix-lang-aql/src/main/javacc/AQL.jj     |   5 +-
 .../lang/common/expression/FieldBinding.java    |   4 -
 .../lang/common/util/CommonFunctionMapUtil.java |   5 +-
 .../asterix/lang/sqlpp/clause/Projection.java   |  16 +-
 .../visitor/GenerateColumnNameVisitor.java      |   2 +-
 .../visitor/InlineColumnAliasVisitor.java       |   9 +-
 .../visitor/SqlppInlineUdfsVisitor.java         |   2 +-
 .../lang/sqlpp/visitor/DeepCopyVisitor.java     |   2 +-
 .../sqlpp/visitor/SqlppAstPrintVisitor.java     |   2 +-
 ...SqlppCloneAndSubstituteVariablesVisitor.java |   2 +-
 .../sqlpp/visitor/SqlppFormatPrintVisitor.java  |  10 +-
 .../asterix-lang-sqlpp/src/main/javacc/SQLPP.jj |  30 +-
 .../apache/asterix/builders/RecordBuilder.java  |   7 +
 .../asterix/om/functions/BuiltinFunctions.java  |   6 +
 .../records/RecordConcatDescriptor.java         |  67 ++++
 .../records/RecordConcatEvalFactory.java        | 245 +++++++++++++
 .../records/RecordConcatStrictDescriptor.java   |  66 ++++
 .../runtime/functions/FunctionCollection.java   |   6 +-
 .../runtime/functions/FunctionTypeInferers.java |  20 ++
 .../hyracks/util/string/UTF8StringUtil.java     |   2 +-
 141 files changed, 1872 insertions(+), 1008 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5cdaa5d6/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/ConstantFoldingRule.java
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/ConstantFoldingRule.java
 
b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/ConstantFoldingRule.java
index f7695ea..fd66821 100644
--- 
a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/ConstantFoldingRule.java
+++ 
b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/ConstantFoldingRule.java
@@ -40,7 +40,6 @@ import org.apache.asterix.metadata.declared.MetadataProvider;
 import org.apache.asterix.om.base.IAObject;
 import org.apache.asterix.om.constants.AsterixConstantValue;
 import org.apache.asterix.om.functions.BuiltinFunctions;
-import org.apache.asterix.om.functions.IFunctionExtensionManager;
 import org.apache.asterix.om.typecomputer.base.TypeCastUtils;
 import org.apache.asterix.om.types.ARecordType;
 import org.apache.asterix.om.types.ATypeTag;
@@ -87,12 +86,12 @@ public class ConstantFoldingRule implements 
IAlgebraicRewriteRule {
 
     // Function Identifier sets that the ConstantFolding rule should skip to 
apply.
     // Most of them are record-related functions.
-    private static final ImmutableSet<FunctionIdentifier> 
FUNC_ID_SET_THAT_SHOULD_NOT_BE_APPLIED =
-            ImmutableSet.of(BuiltinFunctions.RECORD_MERGE, 
BuiltinFunctions.ADD_FIELDS, BuiltinFunctions.REMOVE_FIELDS,
-                    BuiltinFunctions.GET_RECORD_FIELDS, 
BuiltinFunctions.GET_RECORD_FIELD_VALUE,
-                    BuiltinFunctions.FIELD_ACCESS_NESTED, 
BuiltinFunctions.GET_ITEM,
-                    BuiltinFunctions.OPEN_RECORD_CONSTRUCTOR, 
BuiltinFunctions.FIELD_ACCESS_BY_INDEX,
-                    BuiltinFunctions.CAST_TYPE, BuiltinFunctions.META, 
BuiltinFunctions.META_KEY);
+    private static final ImmutableSet<FunctionIdentifier> 
FUNC_ID_SET_THAT_SHOULD_NOT_BE_APPLIED = ImmutableSet.of(
+            BuiltinFunctions.RECORD_MERGE, BuiltinFunctions.ADD_FIELDS, 
BuiltinFunctions.REMOVE_FIELDS,
+            BuiltinFunctions.GET_RECORD_FIELDS, 
BuiltinFunctions.GET_RECORD_FIELD_VALUE,
+            BuiltinFunctions.FIELD_ACCESS_NESTED, BuiltinFunctions.GET_ITEM, 
BuiltinFunctions.OPEN_RECORD_CONSTRUCTOR,
+            BuiltinFunctions.FIELD_ACCESS_BY_INDEX, 
BuiltinFunctions.CAST_TYPE, BuiltinFunctions.META,
+            BuiltinFunctions.META_KEY, BuiltinFunctions.RECORD_CONCAT, 
BuiltinFunctions.RECORD_CONCAT_STRICT);
 
     /** Throws exceptions in substituiteProducedVariable, setVarType, and one 
getVarType method. */
     private static final IVariableTypeEnvironment _emptyTypeEnv = new 
IVariableTypeEnvironment() {

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5cdaa5d6/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/translator/SqlppExpressionToPlanTranslator.java
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/translator/SqlppExpressionToPlanTranslator.java
 
b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/translator/SqlppExpressionToPlanTranslator.java
index 200cc6f..42e38f9 100644
--- 
a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/translator/SqlppExpressionToPlanTranslator.java
+++ 
b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/translator/SqlppExpressionToPlanTranslator.java
@@ -26,12 +26,14 @@ import java.util.List;
 
 import org.apache.asterix.algebra.base.ILangExpressionToPlanTranslator;
 import org.apache.asterix.common.exceptions.CompilationException;
+import org.apache.asterix.common.functions.FunctionSignature;
 import org.apache.asterix.lang.common.base.Clause.ClauseType;
 import org.apache.asterix.lang.common.base.Expression;
 import org.apache.asterix.lang.common.base.Expression.Kind;
 import org.apache.asterix.lang.common.base.ILangExpression;
 import org.apache.asterix.lang.common.clause.GroupbyClause;
 import org.apache.asterix.lang.common.clause.LetClause;
+import org.apache.asterix.lang.common.expression.CallExpr;
 import org.apache.asterix.lang.common.expression.FieldBinding;
 import org.apache.asterix.lang.common.expression.GbyVariableExpressionPair;
 import org.apache.asterix.lang.common.expression.LiteralExpr;
@@ -76,7 +78,6 @@ import org.apache.hyracks.algebricks.common.utils.Pair;
 import org.apache.hyracks.algebricks.core.algebra.base.ILogicalExpression;
 import org.apache.hyracks.algebricks.core.algebra.base.ILogicalOperator;
 import org.apache.hyracks.algebricks.core.algebra.base.ILogicalPlan;
-import org.apache.hyracks.algebricks.core.algebra.base.LogicalOperatorTag;
 import org.apache.hyracks.algebricks.core.algebra.base.LogicalVariable;
 import 
org.apache.hyracks.algebricks.core.algebra.expressions.AbstractFunctionCallExpression;
 import 
org.apache.hyracks.algebricks.core.algebra.expressions.AggregateFunctionCallExpression;
@@ -89,7 +90,6 @@ import 
org.apache.hyracks.algebricks.core.algebra.operators.logical.AbstractUnne
 import 
org.apache.hyracks.algebricks.core.algebra.operators.logical.AggregateOperator;
 import 
org.apache.hyracks.algebricks.core.algebra.operators.logical.AssignOperator;
 import 
org.apache.hyracks.algebricks.core.algebra.operators.logical.DistinctOperator;
-import 
org.apache.hyracks.algebricks.core.algebra.operators.logical.EmptyTupleSourceOperator;
 import 
org.apache.hyracks.algebricks.core.algebra.operators.logical.InnerJoinOperator;
 import 
org.apache.hyracks.algebricks.core.algebra.operators.logical.LeftOuterUnnestOperator;
 import 
org.apache.hyracks.algebricks.core.algebra.operators.logical.NestedTupleSourceOperator;
@@ -130,10 +130,10 @@ class SqlppExpressionToPlanTranslator extends 
LangExpressionToPlanTranslator imp
         } else {
             LogicalVariable var = context.newVar();
             Pair<ILogicalExpression, Mutable<ILogicalOperator>> eo = 
langExprToAlgExpression(queryBody, tupSource);
-            AssignOperator assignOp = new AssignOperator(var, new 
MutableObject<ILogicalExpression>(eo.first));
+            AssignOperator assignOp = new AssignOperator(var, new 
MutableObject<>(eo.first));
             assignOp.getInputs().add(eo.second);
             ProjectOperator projectOp = new ProjectOperator(var);
-            projectOp.getInputs().add(new 
MutableObject<ILogicalOperator>(assignOp));
+            projectOp.getInputs().add(new MutableObject<>(assignOp));
             return new Pair<>(projectOp, var);
         }
     }
@@ -243,12 +243,10 @@ class SqlppExpressionToPlanTranslator extends 
LangExpressionToPlanTranslator imp
         if (fromTerm.hasPositionalVariable()) {
             LogicalVariable pVar = 
context.newVarFromExpression(fromTerm.getPositionalVariable());
             // We set the positional variable type as BIGINT type.
-            unnestOp =
-                    new UnnestOperator(fromVar, new 
MutableObject<ILogicalExpression>(makeUnnestExpression(eo.first)),
-                            pVar, BuiltinType.AINT64, new PositionWriter());
+            unnestOp = new UnnestOperator(fromVar, new 
MutableObject<>(makeUnnestExpression(eo.first)), pVar,
+                    BuiltinType.AINT64, new PositionWriter());
         } else {
-            unnestOp =
-                    new UnnestOperator(fromVar, new 
MutableObject<ILogicalExpression>(makeUnnestExpression(eo.first)));
+            unnestOp = new UnnestOperator(fromVar, new 
MutableObject<>(makeUnnestExpression(eo.first)));
         }
         unnestOp.getInputs().add(eo.second);
 
@@ -277,23 +275,21 @@ class SqlppExpressionToPlanTranslator extends 
LangExpressionToPlanTranslator imp
             Pair<ILogicalOperator, LogicalVariable> rightBranch =
                     generateUnnestForBinaryCorrelateRightBranch(joinClause, 
inputRef, true);
             // A join operator with condition TRUE.
-            AbstractBinaryJoinOperator joinOperator =
-                    new InnerJoinOperator(new 
MutableObject<ILogicalExpression>(ConstantExpression.TRUE), leftInputRef,
-                            new 
MutableObject<ILogicalOperator>(rightBranch.first));
+            AbstractBinaryJoinOperator joinOperator = new InnerJoinOperator(
+                    new MutableObject<>(ConstantExpression.TRUE), 
leftInputRef, new MutableObject<>(rightBranch.first));
             Mutable<ILogicalOperator> joinOpRef = new 
MutableObject<>(joinOperator);
 
             // Add an additional filter operator.
             Pair<ILogicalExpression, Mutable<ILogicalOperator>> 
conditionExprOpPair =
                     
langExprToAlgExpression(joinClause.getConditionExpression(), joinOpRef);
-            SelectOperator filter =
-                    new SelectOperator(new 
MutableObject<ILogicalExpression>(conditionExprOpPair.first), false, null);
+            SelectOperator filter = new SelectOperator(new 
MutableObject<>(conditionExprOpPair.first), false, null);
             filter.getInputs().add(conditionExprOpPair.second);
             return new Pair<>(filter, rightBranch.second);
         } else {
             // Creates a subplan operator.
             SubplanOperator subplanOp = new SubplanOperator();
             Mutable<ILogicalOperator> ntsRef =
-                    new MutableObject<>(new NestedTupleSourceOperator(new 
MutableObject<ILogicalOperator>(subplanOp)));
+                    new MutableObject<>(new NestedTupleSourceOperator(new 
MutableObject<>(subplanOp)));
             subplanOp.getInputs().add(leftInputRef);
 
             // Enters the translation for a subplan.
@@ -305,10 +301,9 @@ class SqlppExpressionToPlanTranslator extends 
LangExpressionToPlanTranslator imp
             AbstractUnnestNonMapOperator rightUnnestOp = 
(AbstractUnnestNonMapOperator) rightBranch.first;
 
             // Adds an additional filter operator for the join condition.
-            Pair<ILogicalExpression, Mutable<ILogicalOperator>> 
conditionExprOpPair = langExprToAlgExpression(
-                    joinClause.getConditionExpression(), new 
MutableObject<ILogicalOperator>(rightUnnestOp));
-            SelectOperator filter =
-                    new SelectOperator(new 
MutableObject<ILogicalExpression>(conditionExprOpPair.first), false, null);
+            Pair<ILogicalExpression, Mutable<ILogicalOperator>> 
conditionExprOpPair =
+                    
langExprToAlgExpression(joinClause.getConditionExpression(), new 
MutableObject<>(rightUnnestOp));
+            SelectOperator filter = new SelectOperator(new 
MutableObject<>(conditionExprOpPair.first), false, null);
             filter.getInputs().add(conditionExprOpPair.second);
 
             ILogicalOperator currentTopOp = filter;
@@ -319,23 +314,18 @@ class SqlppExpressionToPlanTranslator extends 
LangExpressionToPlanTranslator imp
                 ScalarFunctionCallExpression recordCreationFunc = new 
ScalarFunctionCallExpression(
                         
FunctionUtil.getFunctionInfo(BuiltinFunctions.CLOSED_RECORD_CONSTRUCTOR),
                         // Field name for the listified right unnest var.
-                        new MutableObject<ILogicalExpression>(
-                                new ConstantExpression(new 
AsterixConstantValue(new AString("unnestvar")))),
+                        new MutableObject<>(new ConstantExpression(new 
AsterixConstantValue(new AString("unnestvar")))),
                         // The listified right unnest var
-                        new MutableObject<ILogicalExpression>(
-                                new 
VariableReferenceExpression(rightUnnestOp.getVariable())),
+                        new MutableObject<>(new 
VariableReferenceExpression(rightUnnestOp.getVariable())),
                         // Field name for the listified right unnest 
positional var.
-                        new MutableObject<ILogicalExpression>(
-                                new ConstantExpression(new 
AsterixConstantValue(new AString("posvar")))),
+                        new MutableObject<>(new ConstantExpression(new 
AsterixConstantValue(new AString("posvar")))),
                         // The listified right unnest positional var.
-                        new MutableObject<ILogicalExpression>(
-                                new 
VariableReferenceExpression(rightUnnestOp.getPositionalVariable())));
+                        new MutableObject<>(new 
VariableReferenceExpression(rightUnnestOp.getPositionalVariable())));
 
                 // Assigns the record constructor function to a record 
variable.
                 LogicalVariable recordVar = context.newVar();
-                AssignOperator assignOp =
-                        new AssignOperator(recordVar, new 
MutableObject<ILogicalExpression>(recordCreationFunc));
-                assignOp.getInputs().add(new 
MutableObject<ILogicalOperator>(currentTopOp));
+                AssignOperator assignOp = new AssignOperator(recordVar, new 
MutableObject<>(recordCreationFunc));
+                assignOp.getInputs().add(new MutableObject<>(currentTopOp));
 
                 // Sets currentTopOp and varToListify for later usages.
                 currentTopOp = assignOp;
@@ -346,40 +336,37 @@ class SqlppExpressionToPlanTranslator extends 
LangExpressionToPlanTranslator imp
 
             // Adds an aggregate operator to listfy unnest variables.
             AggregateFunctionCallExpression fListify =
-                    
BuiltinFunctions.makeAggregateFunctionExpression(BuiltinFunctions.LISTIFY, 
mkSingletonArrayList(
-                            new MutableObject<ILogicalExpression>(new 
VariableReferenceExpression(varToListify))));
+                    
BuiltinFunctions.makeAggregateFunctionExpression(BuiltinFunctions.LISTIFY,
+                            mkSingletonArrayList(new MutableObject<>(new 
VariableReferenceExpression(varToListify))));
 
             LogicalVariable aggVar = context.newSubplanOutputVar();
             AggregateOperator aggOp = new 
AggregateOperator(mkSingletonArrayList(aggVar),
-                    mkSingletonArrayList(new 
MutableObject<ILogicalExpression>(fListify)));
-            aggOp.getInputs().add(new 
MutableObject<ILogicalOperator>(currentTopOp));
+                    mkSingletonArrayList(new MutableObject<>(fListify)));
+            aggOp.getInputs().add(new MutableObject<>(currentTopOp));
 
             // Exits the translation of a subplan.
             context.exitSubplan();
 
             // Sets the nested subplan of the subplan operator.
-            ILogicalPlan subplan = new ALogicalPlanImpl(new 
MutableObject<ILogicalOperator>(aggOp));
+            ILogicalPlan subplan = new ALogicalPlanImpl(new 
MutableObject<>(aggOp));
             subplanOp.getNestedPlans().add(subplan);
 
             // Outer unnest the aggregated var from the subplan.
             LogicalVariable outerUnnestVar = context.newVar();
-            LeftOuterUnnestOperator outerUnnestOp =
-                    new LeftOuterUnnestOperator(outerUnnestVar, new 
MutableObject<ILogicalExpression>(
-                            makeUnnestExpression(new 
VariableReferenceExpression(aggVar))));
-            outerUnnestOp.getInputs().add(new 
MutableObject<ILogicalOperator>(subplanOp));
+            LeftOuterUnnestOperator outerUnnestOp = new 
LeftOuterUnnestOperator(outerUnnestVar,
+                    new MutableObject<>(makeUnnestExpression(new 
VariableReferenceExpression(aggVar))));
+            outerUnnestOp.getInputs().add(new MutableObject<>(subplanOp));
             currentTopOp = outerUnnestOp;
 
             if (hasRightPosVar) {
                 ScalarFunctionCallExpression fieldAccessForRightUnnestVar = 
new ScalarFunctionCallExpression(
                         
FunctionUtil.getFunctionInfo(BuiltinFunctions.FIELD_ACCESS_BY_INDEX),
-                        new MutableObject<ILogicalExpression>(new 
VariableReferenceExpression(outerUnnestVar)),
-                        new MutableObject<ILogicalExpression>(
-                                new ConstantExpression(new 
AsterixConstantValue(new AInt32(0)))));
+                        new MutableObject<>(new 
VariableReferenceExpression(outerUnnestVar)),
+                        new MutableObject<>(new ConstantExpression(new 
AsterixConstantValue(new AInt32(0)))));
                 ScalarFunctionCallExpression fieldAccessForRightPosVar = new 
ScalarFunctionCallExpression(
                         
FunctionUtil.getFunctionInfo(BuiltinFunctions.FIELD_ACCESS_BY_INDEX),
-                        new MutableObject<ILogicalExpression>(new 
VariableReferenceExpression(outerUnnestVar)),
-                        new MutableObject<ILogicalExpression>(
-                                new ConstantExpression(new 
AsterixConstantValue(new AInt32(1)))));
+                        new MutableObject<>(new 
VariableReferenceExpression(outerUnnestVar)),
+                        new MutableObject<>(new ConstantExpression(new 
AsterixConstantValue(new AInt32(1)))));
 
                 // Creates variables for assign.
                 LogicalVariable rightUnnestVar = context.newVar();
@@ -396,12 +383,12 @@ class SqlppExpressionToPlanTranslator extends 
LangExpressionToPlanTranslator imp
 
                 // Expressions for assign.
                 List<Mutable<ILogicalExpression>> assignExprs = new 
ArrayList<>();
-                assignExprs.add(new 
MutableObject<ILogicalExpression>(fieldAccessForRightUnnestVar));
-                assignExprs.add(new 
MutableObject<ILogicalExpression>(fieldAccessForRightPosVar));
+                assignExprs.add(new 
MutableObject<>(fieldAccessForRightUnnestVar));
+                assignExprs.add(new 
MutableObject<>(fieldAccessForRightPosVar));
 
                 // Creates the assign operator.
                 AssignOperator assignOp = new AssignOperator(assignVars, 
assignExprs);
-                assignOp.getInputs().add(new 
MutableObject<ILogicalOperator>(currentTopOp));
+                assignOp.getInputs().add(new MutableObject<>(currentTopOp));
                 currentTopOp = assignOp;
             } else {
                 context.setVar(joinClause.getRightVariable(), outerUnnestVar);
@@ -428,7 +415,7 @@ class SqlppExpressionToPlanTranslator extends 
LangExpressionToPlanTranslator imp
             throws CompilationException {
         Pair<ILogicalExpression, Mutable<ILogicalOperator>> p =
                 langExprToAlgExpression(havingClause.getFilterExpression(), 
tupSource);
-        SelectOperator s = new SelectOperator(new 
MutableObject<ILogicalExpression>(p.first), false, null);
+        SelectOperator s = new SelectOperator(new MutableObject<>(p.first), 
false, null);
         s.getInputs().add(p.second);
         return new Pair<>(s, null);
     }
@@ -571,28 +558,12 @@ class SqlppExpressionToPlanTranslator extends 
LangExpressionToPlanTranslator imp
         }
     }
 
-    // Recursively replaces nested tuple source with empty tuple source
-    // in the operator tree under opRef.
-    private void replaceNtsWithEtsTopDown(Mutable<ILogicalOperator> opRef) {
-        ILogicalOperator op = opRef.getValue();
-        if (op.getOperatorTag() == LogicalOperatorTag.NESTEDTUPLESOURCE) {
-            opRef.setValue(new EmptyTupleSourceOperator());
-        }
-        for (Mutable<ILogicalOperator> childRef : op.getInputs()) {
-            replaceNtsWithEtsTopDown(childRef);
-        }
-    }
-
     // Generates the return expression for a select clause.
     private Pair<ILogicalOperator, LogicalVariable> 
processSelectClause(SelectBlock selectBlock,
             Mutable<ILogicalOperator> tupSrc) throws CompilationException {
         SelectClause selectClause = selectBlock.getSelectClause();
-        Expression returnExpr;
-        if (selectClause.selectElement()) {
-            returnExpr = selectClause.getSelectElement().getExpression();
-        } else {
-            returnExpr = generateReturnExpr(selectClause, selectBlock);
-        }
+        Expression returnExpr = selectClause.selectElement() ? 
selectClause.getSelectElement().getExpression()
+                : generateReturnExpr(selectClause.getSelectRegular(), 
selectBlock);
         Pair<ILogicalExpression, Mutable<ILogicalOperator>> eo = 
langExprToAlgExpression(returnExpr, tupSrc);
         LogicalVariable returnVar;
         ILogicalOperator returnOperator;
@@ -606,69 +577,90 @@ class SqlppExpressionToPlanTranslator extends 
LangExpressionToPlanTranslator imp
             returnOperator.getInputs().add(eo.second);
         }
         if (selectClause.distinct()) {
-            DistinctOperator distinctOperator = new 
DistinctOperator(mkSingletonArrayList(
-                    new MutableObject<ILogicalExpression>(new 
VariableReferenceExpression(returnVar))));
-            distinctOperator.getInputs().add(new 
MutableObject<ILogicalOperator>(returnOperator));
+            DistinctOperator distinctOperator = new DistinctOperator(
+                    mkSingletonArrayList(new MutableObject<>(new 
VariableReferenceExpression(returnVar))));
+            distinctOperator.getInputs().add(new 
MutableObject<>(returnOperator));
             return new Pair<>(distinctOperator, returnVar);
         } else {
             return new Pair<>(returnOperator, returnVar);
         }
     }
 
-    // Generates the return expression for a select clause.
-    private Expression generateReturnExpr(SelectClause selectClause, 
SelectBlock selectBlock) {
-        SelectRegular selectRegular = selectClause.getSelectRegular();
+    // Generates the return expression for a regular select clause.
+    private Expression generateReturnExpr(SelectRegular selectRegular, 
SelectBlock selectBlock) {
+        List<Expression> recordExprs = new ArrayList<>();
         List<FieldBinding> fieldBindings = new ArrayList<>();
-        List<Projection> projections = selectRegular.getProjections();
-        for (Projection projection : projections) {
-            if (projection.star()) {
+        for (Projection projection : selectRegular.getProjections()) {
+            if (projection.varStar()) {
+                if (!fieldBindings.isEmpty()) {
+                    recordExprs.add(new RecordConstructor(new 
ArrayList<>(fieldBindings)));
+                    fieldBindings.clear();
+                }
+                recordExprs.add(projection.getExpression());
+            } else if (projection.star()) {
                 if (selectBlock.hasGroupbyClause()) {
-                    
fieldBindings.addAll(getGroupBindings(selectBlock.getGroupbyClause()));
+                    getGroupBindings(selectBlock.getGroupbyClause(), 
fieldBindings);
+                    if (selectBlock.hasLetClausesAfterGroupby()) {
+                        getLetBindings(selectBlock.getLetListAfterGroupby(), 
fieldBindings);
+                    }
                 } else if (selectBlock.hasFromClause()) {
-                    
fieldBindings.addAll(getFromBindings(selectBlock.getFromClause()));
+                    getFromBindings(selectBlock.getFromClause(), 
fieldBindings);
+                    if (selectBlock.hasLetClauses()) {
+                        getLetBindings(selectBlock.getLetList(), 
fieldBindings);
+                    }
+                } else if (selectBlock.hasLetClauses()) {
+                    getLetBindings(selectBlock.getLetList(), fieldBindings);
                 }
             } else {
                 fieldBindings.add(new FieldBinding(new LiteralExpr(new 
StringLiteral(projection.getName())),
                         projection.getExpression()));
             }
         }
-        return new RecordConstructor(fieldBindings);
+        if (!fieldBindings.isEmpty()) {
+            recordExprs.add(new RecordConstructor(fieldBindings));
+        }
+
+        return recordExprs.size() == 1 ? recordExprs.get(0)
+                : new CallExpr(new 
FunctionSignature(BuiltinFunctions.RECORD_CONCAT_STRICT), recordExprs);
     }
 
     // Generates all field bindings according to the from clause.
-    private List<FieldBinding> getFromBindings(FromClause fromClause) {
-        List<FieldBinding> fieldBindings = new ArrayList<>();
+    private void getFromBindings(FromClause fromClause, List<FieldBinding> 
outFieldBindings) {
         for (FromTerm fromTerm : fromClause.getFromTerms()) {
-            fieldBindings.add(getFieldBinding(fromTerm.getLeftVariable()));
+            outFieldBindings.add(getFieldBinding(fromTerm.getLeftVariable()));
             if (fromTerm.hasPositionalVariable()) {
-                
fieldBindings.add(getFieldBinding(fromTerm.getPositionalVariable()));
+                
outFieldBindings.add(getFieldBinding(fromTerm.getPositionalVariable()));
             }
             if (!fromTerm.hasCorrelateClauses()) {
                 continue;
             }
             for (AbstractBinaryCorrelateClause correlateClause : 
fromTerm.getCorrelateClauses()) {
-                
fieldBindings.add(getFieldBinding(correlateClause.getRightVariable()));
+                
outFieldBindings.add(getFieldBinding(correlateClause.getRightVariable()));
                 if (correlateClause.hasPositionalVariable()) {
-                    
fieldBindings.add(getFieldBinding(correlateClause.getPositionalVariable()));
+                    
outFieldBindings.add(getFieldBinding(correlateClause.getPositionalVariable()));
                 }
             }
         }
-        return fieldBindings;
     }
 
     // Generates all field bindings according to the from clause.
-    private List<FieldBinding> getGroupBindings(GroupbyClause groupbyClause) {
-        List<FieldBinding> fieldBindings = new ArrayList<>();
+    private void getGroupBindings(GroupbyClause groupbyClause, 
List<FieldBinding> outFieldBindings) {
         for (GbyVariableExpressionPair pair : groupbyClause.getGbyPairList()) {
-            fieldBindings.add(getFieldBinding(pair.getVar()));
+            outFieldBindings.add(getFieldBinding(pair.getVar()));
         }
         if (groupbyClause.hasGroupVar()) {
-            fieldBindings.add(getFieldBinding(groupbyClause.getGroupVar()));
+            outFieldBindings.add(getFieldBinding(groupbyClause.getGroupVar()));
         }
         if (groupbyClause.hasWithMap()) {
             throw new 
IllegalStateException(groupbyClause.getWithVarMap().values().toString()); // no 
WITH in SQLPP
         }
-        return fieldBindings;
+    }
+
+    // Generates all field bindings according to the let clause.
+    private void getLetBindings(List<LetClause> letClauses, List<FieldBinding> 
outFieldBindings) {
+        for (LetClause letClause : letClauses) {
+            outFieldBindings.add(getFieldBinding(letClause.getVarExpr()));
+        }
     }
 
     // Generates a field binding for a variable.

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5cdaa5d6/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/common/TestExecutor.java
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/common/TestExecutor.java
 
b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/common/TestExecutor.java
index b75df99..e39a9f3 100644
--- 
a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/common/TestExecutor.java
+++ 
b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/common/TestExecutor.java
@@ -1514,6 +1514,10 @@ public class TestExecutor {
                     "Starting [TEST]: " + 
testCaseCtx.getTestCase().getFilePath() + "/" + cUnit.getName() + " ... ");
             Map<String, Object> variableCtx = new HashMap<>();
             List<TestFileContext> testFileCtxs = 
testCaseCtx.getTestFiles(cUnit);
+            if (testFileCtxs.isEmpty()) {
+                Assert.fail("No test files found for test: " + 
testCaseCtx.getTestCase().getFilePath() + "/"
+                        + cUnit.getName());
+            }
             List<TestFileContext> expectedResultFileCtxs = 
testCaseCtx.getExpectedResultFiles(cUnit);
             int[] savedQueryCounts = new int[numOfFiles + testFileCtxs.size()];
             for (ListIterator<TestFileContext> iter = 
testFileCtxs.listIterator(); iter.hasNext();) {

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5cdaa5d6/asterixdb/asterix-app/src/test/resources/metadata/results/basic/meta03/builtin_type/meta03_builtin_type.1.adm
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/metadata/results/basic/meta03/builtin_type/meta03_builtin_type.1.adm
 
b/asterixdb/asterix-app/src/test/resources/metadata/results/basic/meta03/builtin_type/meta03_builtin_type.1.adm
index d95514f..9427035 100644
--- 
a/asterixdb/asterix-app/src/test/resources/metadata/results/basic/meta03/builtin_type/meta03_builtin_type.1.adm
+++ 
b/asterixdb/asterix-app/src/test/resources/metadata/results/basic/meta03/builtin_type/meta03_builtin_type.1.adm
@@ -1 +1 @@
-{ "DataverseName": "testdv", "DatatypeName": "testtype", "Derived": { "Tag": 
"RECORD", "IsAnonymous": false, "Record": { "IsOpen": false, "Fields": [ { 
"FieldName": "id", "FieldType": "int32", "IsNullable": false } ] }, 
"UnorderedList": null, "OrderedList": null }, "Timestamp": "Mon Sep 17 23:18:30 
PDT 2012" }
+{ "DataverseName": "testdv", "DatatypeName": "testtype", "Derived": { "Tag": 
"RECORD", "IsAnonymous": false, "Record": { "IsOpen": false, "Fields": [ { 
"FieldName": "id", "FieldType": "int32", "IsNullable": false } ] } }, 
"Timestamp": "Mon Sep 17 23:18:30 PDT 2012" }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5cdaa5d6/asterixdb/asterix-app/src/test/resources/metadata/results/basic/meta03/builtin_type_nullable/meta03_builtin_type_nullable.1.adm
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/metadata/results/basic/meta03/builtin_type_nullable/meta03_builtin_type_nullable.1.adm
 
b/asterixdb/asterix-app/src/test/resources/metadata/results/basic/meta03/builtin_type_nullable/meta03_builtin_type_nullable.1.adm
index ec567fa..2abeba4 100644
--- 
a/asterixdb/asterix-app/src/test/resources/metadata/results/basic/meta03/builtin_type_nullable/meta03_builtin_type_nullable.1.adm
+++ 
b/asterixdb/asterix-app/src/test/resources/metadata/results/basic/meta03/builtin_type_nullable/meta03_builtin_type_nullable.1.adm
@@ -1 +1 @@
-{ "DataverseName": "testdv", "DatatypeName": "testtype", "Derived": { "Tag": 
"RECORD", "IsAnonymous": false, "Record": { "IsOpen": false, "Fields": [ { 
"FieldName": "id", "FieldType": "int32", "IsNullable": true } ] }, 
"UnorderedList": null, "OrderedList": null }, "Timestamp": "Mon Sep 17 23:18:30 
PDT 2012" }
+{ "DataverseName": "testdv", "DatatypeName": "testtype", "Derived": { "Tag": 
"RECORD", "IsAnonymous": false, "Record": { "IsOpen": false, "Fields": [ { 
"FieldName": "id", "FieldType": "int32", "IsNullable": true } ] } }, 
"Timestamp": "Mon Sep 17 23:18:30 PDT 2012" }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5cdaa5d6/asterixdb/asterix-app/src/test/resources/metadata/results/basic/meta03/complex_type/ordered_list/meta03_ordered_list.1.adm
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/metadata/results/basic/meta03/complex_type/ordered_list/meta03_ordered_list.1.adm
 
b/asterixdb/asterix-app/src/test/resources/metadata/results/basic/meta03/complex_type/ordered_list/meta03_ordered_list.1.adm
index 62c8adf..25d210d 100644
--- 
a/asterixdb/asterix-app/src/test/resources/metadata/results/basic/meta03/complex_type/ordered_list/meta03_ordered_list.1.adm
+++ 
b/asterixdb/asterix-app/src/test/resources/metadata/results/basic/meta03/complex_type/ordered_list/meta03_ordered_list.1.adm
@@ -1,2 +1 @@
-{ "DataverseName": "testdv", "DatatypeName": "testtype", "Derived": { "Tag": 
"RECORD", "IsAnonymous": false, "Record": { "IsOpen": false, "Fields": [ { 
"FieldName": "id", "FieldType": "int32", "IsNullable": false }, { "FieldName": 
"list", "FieldType": "testtype_list", "IsNullable": false } ] }, 
"UnorderedList": null, "OrderedList": null }, "Timestamp": "Mon Sep 17 23:18:30 
PDT 2012" }
-{ "DataverseName": "testdv", "DatatypeName": "testtype_list", "Derived": { 
"Tag": "ORDEREDLIST", "IsAnonymous": false, "Record": null, "UnorderedList": 
null, "OrderedList": string }, "Timestamp": "Sat Nov 24 14:27:13 PST 2012" }
+{ "DataverseName": "testdv", "DatatypeName": "testtype", "Derived": { "Tag": 
"RECORD", "IsAnonymous": false, "Record": { "IsOpen": false, "Fields": [ { 
"FieldName": "id", "FieldType": "int32", "IsNullable": false }, { "FieldName": 
"list", "FieldType": "testtype_list", "IsNullable": false } ] } }, "Timestamp": 
"Thu Feb 15 19:45:50 PST 2018" }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5cdaa5d6/asterixdb/asterix-app/src/test/resources/metadata/results/basic/meta03/complex_type/ordered_list_nullable/meta03_ordered_list_nullable.1.adm
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/metadata/results/basic/meta03/complex_type/ordered_list_nullable/meta03_ordered_list_nullable.1.adm
 
b/asterixdb/asterix-app/src/test/resources/metadata/results/basic/meta03/complex_type/ordered_list_nullable/meta03_ordered_list_nullable.1.adm
index 416d110..0ee413e 100644
--- 
a/asterixdb/asterix-app/src/test/resources/metadata/results/basic/meta03/complex_type/ordered_list_nullable/meta03_ordered_list_nullable.1.adm
+++ 
b/asterixdb/asterix-app/src/test/resources/metadata/results/basic/meta03/complex_type/ordered_list_nullable/meta03_ordered_list_nullable.1.adm
@@ -1,2 +1 @@
-{ "DataverseName": "testdv", "DatatypeName": "testtype", "Derived": { "Tag": 
"RECORD", "IsAnonymous": false, "Record": { "IsOpen": false, "Fields": [ { 
"FieldName": "id", "FieldType": "int32", "IsNullable": false }, { "FieldName": 
"test", "FieldType": "testtype_list", "IsNullable": true } ] }, 
"UnorderedList": null, "OrderedList": null }, "Timestamp": "Mon Sep 17 23:18:30 
PDT 2012" }
-{ "DataverseName": "testdv", "DatatypeName": "testtype_list", "Derived": { 
"Tag": "ORDEREDLIST", "IsAnonymous": false, "Record": null, "UnorderedList": 
null, "OrderedList": string }, "Timestamp": "Sat Nov 24 14:27:13 PST 2012" }
+{ "DataverseName": "testdv", "DatatypeName": "testtype", "Derived": { "Tag": 
"RECORD", "IsAnonymous": false, "Record": { "IsOpen": false, "Fields": [ { 
"FieldName": "id", "FieldType": "int32", "IsNullable": false }, { "FieldName": 
"list", "FieldType": "testtype_list", "IsNullable": true } ] } }, "Timestamp": 
"Thu Feb 15 19:45:50 PST 2018" }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5cdaa5d6/asterixdb/asterix-app/src/test/resources/metadata/results/basic/meta03/complex_type/record/meta03_record.1.adm
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/metadata/results/basic/meta03/complex_type/record/meta03_record.1.adm
 
b/asterixdb/asterix-app/src/test/resources/metadata/results/basic/meta03/complex_type/record/meta03_record.1.adm
index 3f43ba5..feb010d 100644
--- 
a/asterixdb/asterix-app/src/test/resources/metadata/results/basic/meta03/complex_type/record/meta03_record.1.adm
+++ 
b/asterixdb/asterix-app/src/test/resources/metadata/results/basic/meta03/complex_type/record/meta03_record.1.adm
@@ -1,2 +1 @@
-{ "DataverseName": "testdv", "DatatypeName": "testtype", "Derived": { "Tag": 
"RECORD", "IsAnonymous": false, "Record": { "IsOpen": false, "Fields": [ { 
"FieldName": "id", "FieldType": "int32", "IsNullable": false }, { "FieldName": 
"subtype", "FieldType": "testtype_subtype", "IsNullable": false } ] }, 
"UnorderedList": null, "OrderedList": null }, "Timestamp": "Mon Sep 17 23:18:30 
PDT 2012" }
-{ "DataverseName": "testdv", "DatatypeName": "testtype", "Derived": { "Tag": 
"RECORD", "IsAnonymous": false, "Record": { "IsOpen": true, "Fields": [ { 
"FieldName": "sec_id", "FieldType": "int32", "IsNullable": false } ] }, 
"UnorderedList": null, "OrderedList": null }, "Timestamp": "Sat Nov 24 14:27:13 
PST 2012" }
+{ "DataverseName": "testdv", "DatatypeName": "testtype", "Derived": { "Tag": 
"RECORD", "IsAnonymous": false, "Record": { "IsOpen": false, "Fields": [ { 
"FieldName": "id", "FieldType": "int32", "IsNullable": false }, { "FieldName": 
"subtype", "FieldType": "testtype_subtype", "IsNullable": false } ] } }, 
"Timestamp": "Thu Feb 15 19:45:50 PST 2018" }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5cdaa5d6/asterixdb/asterix-app/src/test/resources/metadata/results/basic/meta03/complex_type/record_nullable/meta03_record_nullable.1.adm
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/metadata/results/basic/meta03/complex_type/record_nullable/meta03_record_nullable.1.adm
 
b/asterixdb/asterix-app/src/test/resources/metadata/results/basic/meta03/complex_type/record_nullable/meta03_record_nullable.1.adm
index 9ca20be..eb19c4e 100644
--- 
a/asterixdb/asterix-app/src/test/resources/metadata/results/basic/meta03/complex_type/record_nullable/meta03_record_nullable.1.adm
+++ 
b/asterixdb/asterix-app/src/test/resources/metadata/results/basic/meta03/complex_type/record_nullable/meta03_record_nullable.1.adm
@@ -1,2 +1 @@
-{ "DataverseName": "testdv", "DatatypeName": "testtype", "Derived": { "Tag": 
"RECORD", "IsAnonymous": false, "Record": { "IsOpen": false, "Fields": [ { 
"FieldName": "id", "FieldType": "int32", "IsNullable": false }, { "FieldName": 
"subtype", "FieldType": "testtype_subtype", "IsNullable": true } ] }, 
"UnorderedList": null, "OrderedList": null }, "Timestamp": "Mon Sep 17 23:18:30 
PDT 2012" }
-{ "DataverseName": "testdv", "DatatypeName": "testtype", "Derived": { "Tag": 
"RECORD", "IsAnonymous": false, "Record": { "IsOpen": true, "Fields": [ { 
"FieldName": "sec_id", "FieldType": "int32", "IsNullable": false } ] }, 
"UnorderedList": null, "OrderedList": null }, "Timestamp": "Sat Nov 24 14:27:13 
PST 2012" }
+{ "DataverseName": "testdv", "DatatypeName": "testtype", "Derived": { "Tag": 
"RECORD", "IsAnonymous": false, "Record": { "IsOpen": false, "Fields": [ { 
"FieldName": "id", "FieldType": "int32", "IsNullable": false }, { "FieldName": 
"subtype", "FieldType": "testtype_subtype", "IsNullable": true } ] } }, 
"Timestamp": "Thu Feb 15 19:45:50 PST 2018" }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5cdaa5d6/asterixdb/asterix-app/src/test/resources/metadata/results/basic/meta03/complex_type/unordered_list/meta03_unordered_list.1.adm
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/metadata/results/basic/meta03/complex_type/unordered_list/meta03_unordered_list.1.adm
 
b/asterixdb/asterix-app/src/test/resources/metadata/results/basic/meta03/complex_type/unordered_list/meta03_unordered_list.1.adm
index fc7e72c..25d210d 100644
--- 
a/asterixdb/asterix-app/src/test/resources/metadata/results/basic/meta03/complex_type/unordered_list/meta03_unordered_list.1.adm
+++ 
b/asterixdb/asterix-app/src/test/resources/metadata/results/basic/meta03/complex_type/unordered_list/meta03_unordered_list.1.adm
@@ -1,2 +1 @@
-{ "DataverseName": "testdv", "DatatypeName": "testtype", "Derived": { "Tag": 
"RECORD", "IsAnonymous": false, "Record": { "IsOpen": false, "Fields": [ { 
"FieldName": "id", "FieldType": "int32", "IsNullable": false }, { "FieldName": 
"list", "FieldType": "testtype_list", "IsNullable": false } ] }, 
"UnorderedList": null, "OrderedList": null }, "Timestamp": "Mon Sep 17 23:18:30 
PDT 2012" }
-{ "DataverseName": "testdv", "DatatypeName": "testtype_list", "Derived": { 
"Tag": "UNORDEREDLIST", "IsAnonymous": false, "Record": null, "UnorderedList": 
null, "OrderedList": string }, "Timestamp": "Sat Nov 24 14:27:13 PST 2012" }
+{ "DataverseName": "testdv", "DatatypeName": "testtype", "Derived": { "Tag": 
"RECORD", "IsAnonymous": false, "Record": { "IsOpen": false, "Fields": [ { 
"FieldName": "id", "FieldType": "int32", "IsNullable": false }, { "FieldName": 
"list", "FieldType": "testtype_list", "IsNullable": false } ] } }, "Timestamp": 
"Thu Feb 15 19:45:50 PST 2018" }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5cdaa5d6/asterixdb/asterix-app/src/test/resources/metadata/results/basic/meta03/complex_type/unordered_list_nullable/meta03_unordered_list_nullable.1.adm
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/metadata/results/basic/meta03/complex_type/unordered_list_nullable/meta03_unordered_list_nullable.1.adm
 
b/asterixdb/asterix-app/src/test/resources/metadata/results/basic/meta03/complex_type/unordered_list_nullable/meta03_unordered_list_nullable.1.adm
index 0c73c49..0ee413e 100644
--- 
a/asterixdb/asterix-app/src/test/resources/metadata/results/basic/meta03/complex_type/unordered_list_nullable/meta03_unordered_list_nullable.1.adm
+++ 
b/asterixdb/asterix-app/src/test/resources/metadata/results/basic/meta03/complex_type/unordered_list_nullable/meta03_unordered_list_nullable.1.adm
@@ -1,2 +1 @@
-{ "DataverseName": "testdv", "DatatypeName": "testtype", "Derived": { "Tag": 
"RECORD", "IsAnonymous": false, "Record": { "IsOpen": false, "Fields": [ { 
"FieldName": "id", "FieldType": "int32", "IsNullable": false }, { "FieldName": 
"list", "FieldType": "testtype_list", "IsNullable": true } ] }, 
"UnorderedList": null, "OrderedList": null }, "Timestamp": "Mon Sep 17 23:18:30 
PDT 2012" }
-{ "DataverseName": "testdv", "DatatypeName": "testtype_list", "Derived": { 
"Tag": "UNORDEREDLIST", "IsAnonymous": false, "Record": null, "UnorderedList": 
string, "OrderedList": null }, "Timestamp": "Sat Nov 24 14:27:13 PST 2012" }
+{ "DataverseName": "testdv", "DatatypeName": "testtype", "Derived": { "Tag": 
"RECORD", "IsAnonymous": false, "Record": { "IsOpen": false, "Fields": [ { 
"FieldName": "id", "FieldType": "int32", "IsNullable": false }, { "FieldName": 
"list", "FieldType": "testtype_list", "IsNullable": true } ] } }, "Timestamp": 
"Thu Feb 15 19:45:50 PST 2018" }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5cdaa5d6/asterixdb/asterix-app/src/test/resources/metadata/results/basic/meta04/builtin_type/meta04_builtin_type.1.adm
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/metadata/results/basic/meta04/builtin_type/meta04_builtin_type.1.adm
 
b/asterixdb/asterix-app/src/test/resources/metadata/results/basic/meta04/builtin_type/meta04_builtin_type.1.adm
index 1769180..b28b3c8 100644
--- 
a/asterixdb/asterix-app/src/test/resources/metadata/results/basic/meta04/builtin_type/meta04_builtin_type.1.adm
+++ 
b/asterixdb/asterix-app/src/test/resources/metadata/results/basic/meta04/builtin_type/meta04_builtin_type.1.adm
@@ -1 +1 @@
-{ "DataverseName": "testdv", "DatatypeName": "testtype", "Derived": { "Tag": 
"RECORD", "IsAnonymous": false, "Record": { "IsOpen": true, "Fields": [ { 
"FieldName": "id", "FieldType": "int32", "IsNullable": false } ] }, 
"UnorderedList": null, "OrderedList": null }, "Timestamp": "Sat Nov 24 14:27:13 
PST 2012" }
+{ "DataverseName": "testdv", "DatatypeName": "testtype", "Derived": { "Tag": 
"RECORD", "IsAnonymous": false, "Record": { "IsOpen": true, "Fields": [ { 
"FieldName": "id", "FieldType": "int32", "IsNullable": false } ] } }, 
"Timestamp": "Thu Feb 15 19:45:50 PST 2018" }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5cdaa5d6/asterixdb/asterix-app/src/test/resources/metadata/results/basic/meta04/builtin_type_nullable/meta04_builtin_type_nullable.1.adm
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/metadata/results/basic/meta04/builtin_type_nullable/meta04_builtin_type_nullable.1.adm
 
b/asterixdb/asterix-app/src/test/resources/metadata/results/basic/meta04/builtin_type_nullable/meta04_builtin_type_nullable.1.adm
index 0952c01..e67cbd4 100644
--- 
a/asterixdb/asterix-app/src/test/resources/metadata/results/basic/meta04/builtin_type_nullable/meta04_builtin_type_nullable.1.adm
+++ 
b/asterixdb/asterix-app/src/test/resources/metadata/results/basic/meta04/builtin_type_nullable/meta04_builtin_type_nullable.1.adm
@@ -1 +1 @@
-{ "DataverseName": "testdv", "DatatypeName": "testtype", "Derived": { "Tag": 
"RECORD", "IsAnonymous": false, "Record": { "IsOpen": true, "Fields": [ { 
"FieldName": "id", "FieldType": "int32", "IsNullable": true } ] }, 
"UnorderedList": null, "OrderedList": null }, "Timestamp": "Sat Nov 24 14:27:13 
PST 2012" }
+{ "DataverseName": "testdv", "DatatypeName": "testtype", "Derived": { "Tag": 
"RECORD", "IsAnonymous": false, "Record": { "IsOpen": true, "Fields": [ { 
"FieldName": "id", "FieldType": "int32", "IsNullable": true } ] } }, 
"Timestamp": "Thu Feb 15 19:45:50 PST 2018" }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5cdaa5d6/asterixdb/asterix-app/src/test/resources/metadata/results/basic/meta04/complex_type/ordered_list/meta04_ordered_list.1.adm
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/metadata/results/basic/meta04/complex_type/ordered_list/meta04_ordered_list.1.adm
 
b/asterixdb/asterix-app/src/test/resources/metadata/results/basic/meta04/complex_type/ordered_list/meta04_ordered_list.1.adm
index ba7a401..5c98d74 100644
--- 
a/asterixdb/asterix-app/src/test/resources/metadata/results/basic/meta04/complex_type/ordered_list/meta04_ordered_list.1.adm
+++ 
b/asterixdb/asterix-app/src/test/resources/metadata/results/basic/meta04/complex_type/ordered_list/meta04_ordered_list.1.adm
@@ -1,2 +1 @@
-{ "DataverseName": "testdv", "DatatypeName": "testtype", "Derived": { "Tag": 
"RECORD", "IsAnonymous": false, "Record": { "IsOpen": true, "Fields": [ { 
"FieldName": "id", "FieldType": "int32", "IsNullable": false }, { "FieldName": 
"list", "FieldType": "testtype_list", "IsNullable": false } ] }, 
"UnorderedList": null, "OrderedList": null }, "Timestamp": "Sat Nov 24 14:27:13 
PST 2012" }
-{ "DataverseName": "testdv", "DatatypeName": "testtype_list", "Derived": { 
"Tag": "ORDEREDLIST", "IsAnonymous": false, "Record": null, "UnorderedList": 
null, "OrderedList": string }, "Timestamp": "Sat Nov 24 14:27:13 PST 2012" }
+{ "DataverseName": "testdv", "DatatypeName": "testtype", "Derived": { "Tag": 
"RECORD", "IsAnonymous": false, "Record": { "IsOpen": true, "Fields": [ { 
"FieldName": "id", "FieldType": "int32", "IsNullable": false }, { "FieldName": 
"list", "FieldType": "testtype_list", "IsNullable": false } ] } }, "Timestamp": 
"Thu Feb 15 19:45:51 PST 2018" }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5cdaa5d6/asterixdb/asterix-app/src/test/resources/metadata/results/basic/meta04/complex_type/ordered_list_nullable/meta04_ordered_list_nullable.1.adm
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/metadata/results/basic/meta04/complex_type/ordered_list_nullable/meta04_ordered_list_nullable.1.adm
 
b/asterixdb/asterix-app/src/test/resources/metadata/results/basic/meta04/complex_type/ordered_list_nullable/meta04_ordered_list_nullable.1.adm
index 14611e3..697f652 100644
--- 
a/asterixdb/asterix-app/src/test/resources/metadata/results/basic/meta04/complex_type/ordered_list_nullable/meta04_ordered_list_nullable.1.adm
+++ 
b/asterixdb/asterix-app/src/test/resources/metadata/results/basic/meta04/complex_type/ordered_list_nullable/meta04_ordered_list_nullable.1.adm
@@ -1,2 +1 @@
-{ "DataverseName": "testdv", "DatatypeName": "testtype", "Derived": { "Tag": 
"RECORD", "IsAnonymous": false, "Record": { "IsOpen": true, "Fields": [ { 
"FieldName": "id", "FieldType": "int32", "IsNullable": false }, { "FieldName": 
"test", "FieldType": "testtype_list", "IsNullable": true } ] }, 
"UnorderedList": null, "OrderedList": null }, "Timestamp": "Sat Nov 24 14:27:13 
PST 2012" }
-{ "DataverseName": "testdv", "DatatypeName": "testtype_list", "Derived": { 
"Tag": "ORDEREDLIST", "IsAnonymous": false, "Record": null, "UnorderedList": 
null, "OrderedList": string }, "Timestamp": "Sat Nov 24 14:27:13 PST 2012" }
+{ "DataverseName": "testdv", "DatatypeName": "testtype", "Derived": { "Tag": 
"RECORD", "IsAnonymous": false, "Record": { "IsOpen": true, "Fields": [ { 
"FieldName": "id", "FieldType": "int32", "IsNullable": false }, { "FieldName": 
"list", "FieldType": "testtype_list", "IsNullable": true } ] } }, "Timestamp": 
"Thu Feb 15 19:45:51 PST 2018" }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5cdaa5d6/asterixdb/asterix-app/src/test/resources/metadata/results/basic/meta04/complex_type/record/meta04_record.1.adm
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/metadata/results/basic/meta04/complex_type/record/meta04_record.1.adm
 
b/asterixdb/asterix-app/src/test/resources/metadata/results/basic/meta04/complex_type/record/meta04_record.1.adm
index 46d15c2..620976f 100644
--- 
a/asterixdb/asterix-app/src/test/resources/metadata/results/basic/meta04/complex_type/record/meta04_record.1.adm
+++ 
b/asterixdb/asterix-app/src/test/resources/metadata/results/basic/meta04/complex_type/record/meta04_record.1.adm
@@ -1,2 +1 @@
-{ "DataverseName": "testdv", "DatatypeName": "testtype", "Derived": { "Tag": 
"RECORD", "IsAnonymous": false, "Record": { "IsOpen": true, "Fields": [ { 
"FieldName": "id", "FieldType": "int32", "IsNullable": false }, { "FieldName": 
"subtype", "FieldType": "testtype_subtype", "IsNullable": false } ] }, 
"UnorderedList": null, "OrderedList": null }, "Timestamp": "Sat Nov 24 14:27:13 
PST 2012" }
-{ "DataverseName": "testdv", "DatatypeName": "testtype", "Derived": { "Tag": 
"RECORD", "IsAnonymous": false, "Record": { "IsOpen": true, "Fields": [ { 
"FieldName": "sec_id", "FieldType": "int32", "IsNullable": false } ] }, 
"UnorderedList": null, "OrderedList": null }, "Timestamp": "Sat Nov 24 14:27:13 
PST 2012" }
+{ "DataverseName": "testdv", "DatatypeName": "testtype", "Derived": { "Tag": 
"RECORD", "IsAnonymous": false, "Record": { "IsOpen": true, "Fields": [ { 
"FieldName": "id", "FieldType": "int32", "IsNullable": false }, { "FieldName": 
"subtype", "FieldType": "testtype_subtype", "IsNullable": false } ] } }, 
"Timestamp": "Thu Feb 15 19:45:51 PST 2018" }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5cdaa5d6/asterixdb/asterix-app/src/test/resources/metadata/results/basic/meta04/complex_type/record_nullable/meta04_record_nullable.1.adm
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/metadata/results/basic/meta04/complex_type/record_nullable/meta04_record_nullable.1.adm
 
b/asterixdb/asterix-app/src/test/resources/metadata/results/basic/meta04/complex_type/record_nullable/meta04_record_nullable.1.adm
index 1ec4f87..e95590d 100644
--- 
a/asterixdb/asterix-app/src/test/resources/metadata/results/basic/meta04/complex_type/record_nullable/meta04_record_nullable.1.adm
+++ 
b/asterixdb/asterix-app/src/test/resources/metadata/results/basic/meta04/complex_type/record_nullable/meta04_record_nullable.1.adm
@@ -1,2 +1 @@
-{ "DataverseName": "testdv", "DatatypeName": "testtype", "Derived": { "Tag": 
"RECORD", "IsAnonymous": false, "Record": { "IsOpen": true, "Fields": [ { 
"FieldName": "id", "FieldType": "int32", "IsNullable": false }, { "FieldName": 
"subtype", "FieldType": "testtype_subtype", "IsNullable": true } ] }, 
"UnorderedList": null, "OrderedList": null }, "Timestamp": "Sat Nov 24 14:27:13 
PST 2012" }
-{ "DataverseName": "testdv", "DatatypeName": "testtype", "Derived": { "Tag": 
"RECORD", "IsAnonymous": false, "Record": { "IsOpen": true, "Fields": [ { 
"FieldName": "sec_id", "FieldType": "int32", "IsNullable": false } ] }, 
"UnorderedList": null, "OrderedList": null }, "Timestamp": "Sat Nov 24 14:27:13 
PST 2012" }
+{ "DataverseName": "testdv", "DatatypeName": "testtype", "Derived": { "Tag": 
"RECORD", "IsAnonymous": false, "Record": { "IsOpen": true, "Fields": [ { 
"FieldName": "id", "FieldType": "int32", "IsNullable": false }, { "FieldName": 
"subtype", "FieldType": "testtype_subtype", "IsNullable": true } ] } }, 
"Timestamp": "Thu Feb 15 19:45:51 PST 2018" }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5cdaa5d6/asterixdb/asterix-app/src/test/resources/metadata/results/basic/meta04/complex_type/unordered_list/meta04_unordered_list.1.adm
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/metadata/results/basic/meta04/complex_type/unordered_list/meta04_unordered_list.1.adm
 
b/asterixdb/asterix-app/src/test/resources/metadata/results/basic/meta04/complex_type/unordered_list/meta04_unordered_list.1.adm
index bd1214c..5c98d74 100644
--- 
a/asterixdb/asterix-app/src/test/resources/metadata/results/basic/meta04/complex_type/unordered_list/meta04_unordered_list.1.adm
+++ 
b/asterixdb/asterix-app/src/test/resources/metadata/results/basic/meta04/complex_type/unordered_list/meta04_unordered_list.1.adm
@@ -1,2 +1 @@
-{ "DataverseName": "testdv", "DatatypeName": "testtype", "Derived": { "Tag": 
"RECORD", "IsAnonymous": false, "Record": { "IsOpen": true, "Fields": [ { 
"FieldName": "id", "FieldType": "int32", "IsNullable": false }, { "FieldName": 
"list", "FieldType": "testtype_list", "IsNullable": false } ] }, 
"UnorderedList": null, "OrderedList": null }, "Timestamp": "Sat Nov 24 14:27:13 
PST 2012" }
-{ "DataverseName": "testdv", "DatatypeName": "testtype_list", "Derived": { 
"Tag": "UNORDEREDLIST", "IsAnonymous": false, "Record": null, "UnorderedList": 
string, "OrderedList": null }, "Timestamp": "Sat Nov 24 14:27:13 PST 2012" }
+{ "DataverseName": "testdv", "DatatypeName": "testtype", "Derived": { "Tag": 
"RECORD", "IsAnonymous": false, "Record": { "IsOpen": true, "Fields": [ { 
"FieldName": "id", "FieldType": "int32", "IsNullable": false }, { "FieldName": 
"list", "FieldType": "testtype_list", "IsNullable": false } ] } }, "Timestamp": 
"Thu Feb 15 19:45:51 PST 2018" }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5cdaa5d6/asterixdb/asterix-app/src/test/resources/metadata/results/basic/meta04/complex_type/unordered_list_nullable/meta04_unordered_list_nullable.1.adm
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/metadata/results/basic/meta04/complex_type/unordered_list_nullable/meta04_unordered_list_nullable.1.adm
 
b/asterixdb/asterix-app/src/test/resources/metadata/results/basic/meta04/complex_type/unordered_list_nullable/meta04_unordered_list_nullable.1.adm
index 368f74e..697f652 100644
--- 
a/asterixdb/asterix-app/src/test/resources/metadata/results/basic/meta04/complex_type/unordered_list_nullable/meta04_unordered_list_nullable.1.adm
+++ 
b/asterixdb/asterix-app/src/test/resources/metadata/results/basic/meta04/complex_type/unordered_list_nullable/meta04_unordered_list_nullable.1.adm
@@ -1,2 +1 @@
-{ "DataverseName": "testdv", "DatatypeName": "testtype", "Derived": { "Tag": 
"RECORD", "IsAnonymous": false, "Record": { "IsOpen": true, "Fields": [ { 
"FieldName": "id", "FieldType": "int32", "IsNullable": false }, { "FieldName": 
"list", "FieldType": "testtype_list", "IsNullable": true } ] }, 
"UnorderedList": null, "OrderedList": null }, "Timestamp": "Sat Nov 24 14:27:13 
PST 2012" }
-{ "DataverseName": "testdv", "DatatypeName": "testtype_list", "Derived": { 
"Tag": "UNORDEREDLIST", "IsAnonymous": false, "Record": null, "UnorderedList": 
string, "OrderedList": null }, "Timestamp": "Sat Nov 24 14:27:13 PST 2012" }
+{ "DataverseName": "testdv", "DatatypeName": "testtype", "Derived": { "Tag": 
"RECORD", "IsAnonymous": false, "Record": { "IsOpen": true, "Fields": [ { 
"FieldName": "id", "FieldType": "int32", "IsNullable": false }, { "FieldName": 
"list", "FieldType": "testtype_list", "IsNullable": true } ] } }, "Timestamp": 
"Thu Feb 15 19:45:51 PST 2018" }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5cdaa5d6/asterixdb/asterix-app/src/test/resources/metadata/testsuite.xml
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/metadata/testsuite.xml 
b/asterixdb/asterix-app/src/test/resources/metadata/testsuite.xml
index 036a4bc..c0ab7a4 100644
--- a/asterixdb/asterix-app/src/test/resources/metadata/testsuite.xml
+++ b/asterixdb/asterix-app/src/test/resources/metadata/testsuite.xml
@@ -69,83 +69,83 @@
       </compilation-unit>
     </test-case>
     <test-case FilePath="basic">
-      <compilation-unit name="meta03_builtin_type">
+      <compilation-unit name="meta03/builtin_type">
         <output-dir compare="Text">meta03/builtin_type</output-dir>
       </compilation-unit>
     </test-case>
     <test-case FilePath="basic">
-      <compilation-unit name="meta03_builtin_type_nullable">
+      <compilation-unit name="meta03/builtin_type_nullable">
         <output-dir compare="Text">meta03/builtin_type_nullable</output-dir>
       </compilation-unit>
     </test-case>
     <test-case FilePath="basic">
-      <compilation-unit name="meta03_ordered_list">
+      <compilation-unit name="meta03/complex_type/ordered_list">
         <output-dir 
compare="Text">meta03/complex_type/ordered_list</output-dir>
       </compilation-unit>
     </test-case>
     <test-case FilePath="basic">
-      <compilation-unit name="meta03_ordered_list_nullable">
-        <output-dir 
compare="Text">meta03/complex_type/ordered_list</output-dir>
+      <compilation-unit name="meta03/complex_type/ordered_list_nullable">
+        <output-dir 
compare="Text">meta03/complex_type/ordered_list_nullable</output-dir>
       </compilation-unit>
     </test-case>
     <test-case FilePath="basic">
-      <compilation-unit name="meta03_record">
+      <compilation-unit name="meta03/complex_type/record">
         <output-dir compare="Text">meta03/complex_type/record</output-dir>
       </compilation-unit>
     </test-case>
     <test-case FilePath="basic">
-      <compilation-unit name="meta03_record_nullable">
-        <output-dir compare="Text">meta03/complex_type/record</output-dir>
+      <compilation-unit name="meta03/complex_type/record_nullable">
+        <output-dir 
compare="Text">meta03/complex_type/record_nullable</output-dir>
       </compilation-unit>
     </test-case>
     <test-case FilePath="basic">
-      <compilation-unit name="meta03_unordered_list">
+      <compilation-unit name="meta03/complex_type/unordered_list">
         <output-dir 
compare="Text">meta03/complex_type/unordered_list</output-dir>
       </compilation-unit>
     </test-case>
     <test-case FilePath="basic">
-      <compilation-unit name="meta03_unordered_list_nullable">
-        <output-dir 
compare="Text">meta03/complex_type/unordered_list</output-dir>
+      <compilation-unit name="meta03/complex_type/unordered_list_nullable">
+        <output-dir 
compare="Text">meta03/complex_type/unordered_list_nullable</output-dir>
       </compilation-unit>
     </test-case>
     <test-case FilePath="basic">
-      <compilation-unit name="meta04_builtin_type">
+      <compilation-unit name="meta04/builtin_type">
         <output-dir compare="Text">meta04/builtin_type</output-dir>
       </compilation-unit>
     </test-case>
     <test-case FilePath="basic">
-      <compilation-unit name="meta04_builtin_type_nullable">
+      <compilation-unit name="meta04/builtin_type_nullable">
         <output-dir compare="Text">meta04/builtin_type_nullable</output-dir>
       </compilation-unit>
     </test-case>
     <test-case FilePath="basic">
-      <compilation-unit name="meta04_ordered_list">
+      <compilation-unit name="meta04/complex_type/ordered_list">
         <output-dir 
compare="Text">meta04/complex_type/ordered_list</output-dir>
       </compilation-unit>
     </test-case>
     <test-case FilePath="basic">
-      <compilation-unit name="meta04_ordered_list_nullable">
-        <output-dir 
compare="Text">meta04/complex_type/ordered_list</output-dir>
+      <compilation-unit name="meta04/complex_type/ordered_list_nullable">
+        <output-dir 
compare="Text">meta04/complex_type/ordered_list_nullable</output-dir>
       </compilation-unit>
     </test-case>
     <test-case FilePath="basic">
-      <compilation-unit name="meta04_record">
+      <compilation-unit name="meta04/complex_type/record">
         <output-dir compare="Text">meta04/complex_type/record</output-dir>
       </compilation-unit>
     </test-case>
     <test-case FilePath="basic">
-      <compilation-unit name="meta04_record_nullable">
-        <output-dir compare="Text">meta04/complex_type/record</output-dir>
+      <compilation-unit name="meta04/complex_type/record_nullable">
+        <output-dir 
compare="Text">meta04/complex_type/record_nullable</output-dir>
       </compilation-unit>
     </test-case>
     <test-case FilePath="basic">
-      <compilation-unit name="meta04_unordered_list">
+      <compilation-unit name="meta04/complex_type/unordered_list">
         <output-dir 
compare="Text">meta04/complex_type/unordered_list</output-dir>
       </compilation-unit>
     </test-case>
     <test-case FilePath="basic">
-      <compilation-unit name="meta04_unordered_list_nullable">
-        <output-dir 
compare="Text">meta04/complex_type/unordered_list</output-dir>
+      <compilation-unit name="meta04/complex_type/unordered_list_nullable">
+        <output-dir 
compare="Text">meta04/complex_type/unordered_list_nullable</output-dir>
       </compilation-unit>
     </test-case>
     <test-case FilePath="basic">

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5cdaa5d6/asterixdb/asterix-app/src/test/resources/runtimets/queries/objects/ObjectsQueries.xml
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries/objects/ObjectsQueries.xml
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/objects/ObjectsQueries.xml
index d558c66..c07eb24 100644
--- 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries/objects/ObjectsQueries.xml
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/objects/ObjectsQueries.xml
@@ -16,167 +16,168 @@
  ! specific language governing permissions and limitations
  ! under the License.
  !-->
-<test-group name="records">
-  <test-case FilePath="records">
+<test-group name="objects">
+  <test-case FilePath="objects">
     <compilation-unit name="access-nested-fields">
       <output-dir compare="Text">access-nested-fields</output-dir>
     </compilation-unit>
   </test-case>
-  <test-case FilePath="records">
+  <test-case FilePath="objects">
     <compilation-unit name="closed-object-constructor_01">
       <output-dir compare="Text">closed-object-constructor_01</output-dir>
     </compilation-unit>
   </test-case>
-  <test-case FilePath="records">
+  <test-case FilePath="objects">
     <compilation-unit name="closed-object-constructor_02">
       <output-dir compare="Text">closed-object-constructor_02</output-dir>
     </compilation-unit>
   </test-case>
-  <test-case FilePath="records">
+  <test-case FilePath="objects">
     <compilation-unit name="closed-object-constructor_03">
       <output-dir compare="Text">closed-object-constructor_03</output-dir>
     </compilation-unit>
   </test-case>
-  <test-case FilePath="records">
+  <test-case FilePath="objects">
     <compilation-unit name="expFieldName">
       <output-dir compare="Text">expFieldName</output-dir>
     </compilation-unit>
   </test-case>
-  <test-case FilePath="records">
+  <test-case FilePath="objects">
     <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">
+  <test-case FilePath="objects">
     <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-object-fields">
+  <test-case FilePath="objects/get-object-fields">
     <compilation-unit name="documentation-example">
       <output-dir compare="Text">documentation-example</output-dir>
     </compilation-unit>
   </test-case>
-  <!--test-case FilePath="records/get-object-fields">
+  <!--test-case FilePath="objects/get-object-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-object-fields">
+  <test-case FilePath="objects/get-object-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-object-fields">
+  <test-case FilePath="objects/get-object-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-object-fields">
+  <test-case FilePath="objects/get-object-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-object-field-value">
+  <test-case FilePath="objects/get-object-field-value">
     <compilation-unit name="documentation-example">
       <output-dir compare="Text">documentation-example</output-dir>
     </compilation-unit>
   </test-case>
-  <test-case FilePath="records/get-object-field-value">
+  <test-case FilePath="objects/get-object-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-object-field-value">
+  <test-case FilePath="objects/get-object-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-object-field-value">
+  <test-case FilePath="objects/get-object-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-object-field-value">
+  <test-case FilePath="objects/get-object-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">
+  <test-case FilePath="objects">
     <compilation-unit name="open-object-constructor_01">
       <output-dir compare="Text">open-object-constructor_01</output-dir>
     </compilation-unit>
   </test-case>
-  <test-case FilePath="records">
+  <test-case FilePath="objects">
     <compilation-unit name="open-object-constructor_02">
       <output-dir compare="Text">open-object-constructor_02</output-dir>
     </compilation-unit>
   </test-case>
-  <test-case FilePath="records">
+  <test-case FilePath="objects">
     <compilation-unit name="closed-closed-fieldname-conflict_issue173">
       <output-dir 
compare="Text">closed-closed-fieldname-conflict_issue173</output-dir>
-      <expected-error>java.lang.IllegalStateException: Closed fields 0 and 1 
have the same field name "name"</expected-error>
+      <expected-error>Closed fields 0 and 1 have the same field name 
"name"</expected-error>
     </compilation-unit>
   </test-case>
-  <test-case FilePath="records">
+  <test-case FilePath="objects">
     <compilation-unit name="open-closed-fieldname-conflict_issue173">
       <output-dir 
compare="Text">open-closed-fieldname-conflict_issue173</output-dir>
-      <expected-error>org.apache.hyracks.api.exceptions.HyracksDataException: 
Open field "name" has the same field name as closed field at index 
0</expected-error>
+      <expected-error>Open field "name" has the same field name as closed 
field at index 0</expected-error>
     </compilation-unit>
   </test-case>
-  <test-case FilePath="records">
+  <test-case FilePath="objects">
     <compilation-unit name="open-open-fieldname-conflict_issue173">
       <output-dir 
compare="Text">open-open-fieldname-conflict_issue173</output-dir>
-      <expected-error>org.apache.hyracks.api.exceptions.HyracksDataException: 
Open fields 0 and 1 have the same field name "name"</expected-error>
+      <expected-error>Open fields 0 and 1 have the same field name 
"name"</expected-error>
     </compilation-unit>
   </test-case>
   <!-- RECORD MANIPULATION TESTS -->
-  <test-case FilePath="records/object-merge">
+  <test-case FilePath="objects/object-merge">
     <compilation-unit name="documentation-example">
       <output-dir compare="Text">documentation-example</output-dir>
     </compilation-unit>
   </test-case>
-  <test-case FilePath="records/object-merge">
-    <compilation-unit name="tiny-social-example-only-records">
-      <output-dir compare="Text">tiny-social-example-only-records</output-dir>
+  <test-case FilePath="objects/object-merge">
+    <compilation-unit name="tiny-social-example">
+      <output-dir compare="Text">tiny-social-example</output-dir>
+      <expected-error>ASX0013: Duplicate field name</expected-error>
     </compilation-unit>
   </test-case>
-  <test-case FilePath="records/object-merge">
+  <test-case FilePath="objects/object-merge">
     <compilation-unit name="highly-nested-open">
       <output-dir compare="Text">highly-nested-open</output-dir>
     </compilation-unit>
   </test-case>
-  <test-case FilePath="records/object-add-fields">
+  <test-case FilePath="objects/object-add-fields">
     <compilation-unit name="documentation-example">
       <output-dir compare="Text">documentation-example</output-dir>
     </compilation-unit>
   </test-case>
-  <test-case FilePath="records/object-add-fields">
-    <compilation-unit name="tiny-social-example-only-records">
-      <output-dir compare="Text">tiny-social-example-only-records</output-dir>
+  <!--test-case FilePath="objects/object-add-fields">
+    <compilation-unit name="tiny-social-example">
+      <output-dir compare="Text">tiny-social-example</output-dir>
     </compilation-unit>
-  </test-case>
-  <test-case FilePath="records/object-add-fields">
+  </test-case-->
+  <test-case FilePath="objects/object-add-fields">
     <compilation-unit name="highly-nested-open">
       <output-dir compare="Text">highly-nested-open</output-dir>
     </compilation-unit>
   </test-case>
-  <test-case FilePath="records/object-remove-fields">
+  <!--test-case FilePath="objects/object-remove-fields">
     <compilation-unit name="documentation-example">
       <output-dir compare="Text">documentation-example</output-dir>
     </compilation-unit>
-  </test-case>
-  <test-case FilePath="records/object-remove-fields">
-    <compilation-unit name="tiny-social-example-only-records">
-      <output-dir compare="Text">tiny-social-example-only-records</output-dir>
+  </test-case-->
+  <test-case FilePath="objects/object-remove-fields">
+    <compilation-unit name="tiny-social-example">
+      <output-dir compare="Text">tiny-social-example</output-dir>
     </compilation-unit>
   </test-case>
-  <test-case FilePath="records/object-remove-fields">
+  <test-case FilePath="objects/object-remove-fields">
     <compilation-unit name="highly-nested-open">
       <output-dir compare="Text">highly-nested-open</output-dir>
     </compilation-unit>
   </test-case>
-  <test-case FilePath="records">
+  <test-case FilePath="objects">
     <compilation-unit name="closed-nullable-fields_issue1616">
       <output-dir compare="Text">closed-nullable-fields_issue1616</output-dir>
     </compilation-unit>

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5cdaa5d6/asterixdb/asterix-app/src/test/resources/runtimets/queries/objects/get-object-field-value/tiny-social-example/tiny-social-example.4.query.aql
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries/objects/get-object-field-value/tiny-social-example/tiny-social-example.4.query.aql
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/objects/get-object-field-value/tiny-social-example/tiny-social-example.4.query.aql
index d8dd0a2..1f04a1a 100644
--- 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries/objects/get-object-field-value/tiny-social-example/tiny-social-example.4.query.aql
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/objects/get-object-field-value/tiny-social-example/tiny-social-example.4.query.aql
@@ -25,7 +25,7 @@ use dataverse TinySocial;
 
 for $r in dataset TweetMessages
 for $f in get-object-fields($r)
-where $f.field-type = "STRING"
+where $f.field-type = "string"
 let $result := get-object-field-value($r, $f.field-name)
 order by $result
 return $result

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5cdaa5d6/asterixdb/asterix-app/src/test/resources/runtimets/queries/objects/object-merge/tiny-social-example/tiny-social-example.3.update.aql
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries/objects/object-merge/tiny-social-example/tiny-social-example.3.update.aql
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/objects/object-merge/tiny-social-example/tiny-social-example.3.update.aql
index cc1d457..efe54fd 100644
--- 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries/objects/object-merge/tiny-social-example/tiny-social-example.3.update.aql
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/objects/object-merge/tiny-social-example/tiny-social-example.3.update.aql
@@ -24,13 +24,13 @@
 use dataverse TinySocial;
 
 load dataset FacebookUsers using localfs
-(("path"="nc1://data/tinysocial/fbu.adm"),("format"="adm"));
+(("path"="asterix_nc1://data/tinysocial/fbu.adm"),("format"="adm"));
 
 load dataset FacebookMessages using localfs
-(("path"="nc1://data/tinysocial/fbm.adm"),("format"="adm"));
+(("path"="asterix_nc1://data/tinysocial/fbm.adm"),("format"="adm"));
 
 load dataset TwitterUsers using localfs
-(("path"="nc1://data/tinysocial/twu.adm"),("format"="adm"));
+(("path"="asterix_nc1://data/tinysocial/twu.adm"),("format"="adm"));
 
 load dataset TweetMessages using localfs
-(("path"="nc1://data/tinysocial/twm.adm"),("format"="adm"));
+(("path"="asterix_nc1://data/tinysocial/twm.adm"),("format"="adm"));

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5cdaa5d6/asterixdb/asterix-app/src/test/resources/runtimets/queries/objects/object-remove-fields/tiny-social-example/tiny-social-example.3.update.aql
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries/objects/object-remove-fields/tiny-social-example/tiny-social-example.3.update.aql
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/objects/object-remove-fields/tiny-social-example/tiny-social-example.3.update.aql
index 515288f..3e740a9 100644
--- 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries/objects/object-remove-fields/tiny-social-example/tiny-social-example.3.update.aql
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/objects/object-remove-fields/tiny-social-example/tiny-social-example.3.update.aql
@@ -24,13 +24,13 @@
 use dataverse TinySocial;
 
 load dataset FacebookUsers using localfs
-(("path"="nc1://data/tinysocial/fbu.adm"),("format"="adm"));
+(("path"="asterix_nc1://data/tinysocial/fbu.adm"),("format"="adm"));
 
 load dataset FacebookMessages using localfs
-(("path"="nc1://data/tinysocial/fbm.adm"),("format"="adm"));
+(("path"="asterix_nc1://data/tinysocial/fbm.adm"),("format"="adm"));
 
 load dataset TwitterUsers using localfs
-(("path"="nc1://data/tinysocial/twu.adm"),("format"="adm"));
+(("path"="asterix_nc1://data/tinysocial/twu.adm"),("format"="adm"));
 
 load dataset TweetMessages using localfs
-(("path"="nc1://data/tinysocial/twm.adm"),("format"="adm"));
+(("path"="asterix_nc1://data/tinysocial/twm.adm"),("format"="adm"));

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5cdaa5d6/asterixdb/asterix-app/src/test/resources/runtimets/queries/objects/object-remove-fields/tiny-social-example/tiny-social-example.4.query.aql
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries/objects/object-remove-fields/tiny-social-example/tiny-social-example.4.query.aql
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/objects/object-remove-fields/tiny-social-example/tiny-social-example.4.query.aql
index d3a4118..a5761c7 100644
--- 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries/objects/object-remove-fields/tiny-social-example/tiny-social-example.4.query.aql
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/objects/object-remove-fields/tiny-social-example/tiny-social-example.4.query.aql
@@ -25,5 +25,5 @@ use dataverse TinySocial;
 
 for $r in dataset TweetMessages
 let $result := object-remove-fields($r, ["sender-location", ["user", 
"screen-name"]])
-order by $result
+order by $r.tweetid
 return $result

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

Reply via email to