Merge commit 69d7209, 86e5ff3, 8cff4a0, ba9d1d0, 41b511d

Change-Id: I0b7801bd47d53a64de7cfcf9951eccebd38899eb
diff --git a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/ByNameToByIndexFieldAccessRule.java b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/ByNameToByIndexFieldAccessRule.java
index 9c478ee..abc434f 100644
--- a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/ByNameToByIndexFieldAccessRule.java
+++ b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/ByNameToByIndexFieldAccessRule.java
@@ -23,13 +23,12 @@
 import java.util.Collections;
 
 import org.apache.asterix.algebra.base.OperatorAnnotation;
-import org.apache.asterix.lang.common.util.FunctionUtil;
 import org.apache.asterix.om.base.AInt32;
 import org.apache.asterix.om.constants.AsterixConstantValue;
 import org.apache.asterix.om.functions.BuiltinFunctions;
+import org.apache.asterix.om.typecomputer.impl.TypeComputeUtils;
 import org.apache.asterix.om.types.ARecordType;
 import org.apache.asterix.om.types.ATypeTag;
-import org.apache.asterix.om.types.AUnionType;
 import org.apache.asterix.om.types.IAType;
 import org.apache.asterix.om.utils.ConstantExpressionUtil;
 import org.apache.commons.lang3.mutable.Mutable;
@@ -77,20 +76,19 @@
             return false;
         }
         boolean changed = false;
-        AbstractFunctionCallExpression funcExpr = (AbstractFunctionCallExpression) expr;
-        for (Mutable<ILogicalExpression> funcArgRef : funcExpr.getArguments()) {
+        AbstractFunctionCallExpression fce = (AbstractFunctionCallExpression) expr;
+        for (Mutable<ILogicalExpression> funcArgRef : fce.getArguments()) {
             if (rewriteExpressionReference(op, funcArgRef, context)) {
                 changed = true;
             }
         }
-        AbstractFunctionCallExpression fce = (AbstractFunctionCallExpression) expr;
         if (fce.getFunctionIdentifier() != BuiltinFunctions.FIELD_ACCESS_BY_NAME) {
             return changed;
         }
         changed |= extractFirstArg(fce, op, context);
         IVariableTypeEnvironment env = context.getOutputTypeEnvironment(op.getInputs().get(0).getValue());
         IAType t = (IAType) env.getType(fce.getArguments().get(0).getValue());
-        changed |= rewriteFieldAccess(exprRef, fce, getActualType(t));
+        changed |= rewriteFieldAccess(exprRef, fce, TypeComputeUtils.getActualType(t));
         return changed;
     }
 
@@ -117,7 +115,7 @@
 
     // Rewrites field-access-by-name into field-access-by-index if possible.
     private boolean rewriteFieldAccess(Mutable<ILogicalExpression> exprRef, AbstractFunctionCallExpression fce,
-            IAType t) throws AlgebricksException {
+            IAType t) {
         if (t.getTypeTag() != ATypeTag.OBJECT) {
             return false;
         }
@@ -129,20 +127,6 @@
         return changed;
     }
 
-    // Gets the actual type of a given type.
-    private IAType getActualType(IAType t) throws AlgebricksException {
-        switch (t.getTypeTag()) {
-            case ANY:
-            case OBJECT:
-                return t;
-            case UNION:
-                return ((AUnionType) t).getActualType();
-            default:
-                throw new AlgebricksException("Cannot call field-access on data of type " + t);
-        }
-    }
-
-    @SuppressWarnings("unchecked")
     private static ILogicalExpression createFieldAccessByIndex(ARecordType recType,
             AbstractFunctionCallExpression fce) {
         String s = ConstantExpressionUtil.getStringArgument(fce, 1);
@@ -154,7 +138,8 @@
             return null;
         }
         ScalarFunctionCallExpression faExpr = new ScalarFunctionCallExpression(
-                FunctionUtil.getFunctionInfo(BuiltinFunctions.FIELD_ACCESS_BY_INDEX), fce.getArguments().get(0),
+                BuiltinFunctions.getBuiltinFunctionInfo(BuiltinFunctions.FIELD_ACCESS_BY_INDEX),
+                fce.getArguments().get(0),
                 new MutableObject<>(new ConstantExpression(new AsterixConstantValue(new AInt32(k)))));
         faExpr.setSourceLocation(fce.getSourceLocation());
         return faExpr;
diff --git a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/RemoveUnusedOneToOneEquiJoinRule.java b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/RemoveUnusedOneToOneEquiJoinRule.java
index 6a70786..61361f6 100644
--- a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/RemoveUnusedOneToOneEquiJoinRule.java
+++ b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/RemoveUnusedOneToOneEquiJoinRule.java
@@ -24,7 +24,9 @@
 import java.util.List;
 import java.util.Set;
 
+import org.apache.asterix.metadata.declared.DataSource;
 import org.apache.asterix.metadata.declared.DatasetDataSource;
+import org.apache.asterix.metadata.entities.Dataset;
 import org.apache.asterix.metadata.entities.InternalDatasetDetails;
 import org.apache.commons.lang3.mutable.Mutable;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
@@ -227,12 +229,14 @@
 
     private void fillPKVars(DataSourceScanOperator dataScan, List<LogicalVariable> pkVars) {
         pkVars.clear();
-        DatasetDataSource datasetDataSource = (DatasetDataSource) dataScan.getDataSource();
-        pkVars.clear();
-        if (datasetDataSource.getDataset().getDatasetDetails() instanceof InternalDatasetDetails) {
-            int numPKs = datasetDataSource.getDataset().getPrimaryKeys().size();
-            for (int i = 0; i < numPKs; i++) {
-                pkVars.add(dataScan.getVariables().get(i));
+        DataSource dataSource = (DataSource) dataScan.getDataSource();
+        if (dataSource.getDatasourceType() == DataSource.Type.INTERNAL_DATASET) {
+            Dataset dataset = ((DatasetDataSource) dataSource).getDataset();
+            if (dataset.getDatasetDetails() instanceof InternalDatasetDetails) {
+                int numPKs = dataset.getPrimaryKeys().size();
+                for (int i = 0; i < numPKs; i++) {
+                    pkVars.add(dataScan.getVariables().get(i));
+                }
             }
         }
     }
diff --git a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/translator/AbstractLangTranslator.java b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/translator/AbstractLangTranslator.java
index cc63560..8777f66 100644
--- a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/translator/AbstractLangTranslator.java
+++ b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/translator/AbstractLangTranslator.java
@@ -33,8 +33,10 @@
 import org.apache.asterix.common.exceptions.AsterixException;
 import org.apache.asterix.common.exceptions.CompilationException;
 import org.apache.asterix.common.exceptions.ErrorCode;
+import org.apache.asterix.common.functions.FunctionConstants;
 import org.apache.asterix.common.metadata.DataverseName;
 import org.apache.asterix.lang.common.base.Statement;
+import org.apache.asterix.lang.common.statement.CreateDataverseStatement;
 import org.apache.asterix.lang.common.statement.DatasetDecl;
 import org.apache.asterix.lang.common.statement.DataverseDropStatement;
 import org.apache.asterix.lang.common.statement.DeleteStatement;
@@ -142,6 +144,16 @@
                 }
                 break;
 
+            case CREATE_DATAVERSE:
+                CreateDataverseStatement dvCreateStmt = (CreateDataverseStatement) stmt;
+                dataverseName = dvCreateStmt.getDataverseName();
+                invalidOperation = FunctionConstants.ASTERIX_DV.equals(dataverseName)
+                        || FunctionConstants.ALGEBRICKS_DV.equals(dataverseName);
+                if (invalidOperation) {
+                    message = "Cannot create dataverse: " + dataverseName;
+                }
+                break;
+
             case DATAVERSE_DROP:
                 DataverseDropStatement dvDropStmt = (DataverseDropStatement) stmt;
                 dataverseName = dvDropStmt.getDataverseName();
@@ -162,6 +174,7 @@
                             + MetadataConstants.METADATA_DATAVERSE_NAME;
                 }
                 break;
+
             case DATASET_DECL:
                 DatasetDecl datasetStmt = (DatasetDecl) stmt;
                 Map<String, String> hints = datasetStmt.getHints();
diff --git a/asterixdb/asterix-app/src/test/resources/optimizerts/queries/joins/fnds_join_ds.sqlpp b/asterixdb/asterix-app/src/test/resources/optimizerts/queries/joins/fnds_join_ds.sqlpp
new file mode 100644
index 0000000..5ae9ad6
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/optimizerts/queries/joins/fnds_join_ds.sqlpp
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/*
+ * Description: Functional datasource join with dataset
+ */
+
+drop  dataverse test if exists;
+create  dataverse test;
+
+use test;
+
+create type test.TestType as
+{
+  id : integer
+};
+
+create  dataset t1(TestType) primary key id;
+
+set `import-private-functions` `true`;
+
+select count(*)
+from tpcds_datagen("customer_address", 1.0) tpcds, t1
+where tpcds.ca_address_id = t1.aid;
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/optimizerts/results/joins/fnds_join_ds.plan b/asterixdb/asterix-app/src/test/resources/optimizerts/results/joins/fnds_join_ds.plan
new file mode 100644
index 0000000..a561ca4
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/optimizerts/results/joins/fnds_join_ds.plan
@@ -0,0 +1,24 @@
+-- DISTRIBUTE_RESULT  |UNPARTITIONED|
+  -- ONE_TO_ONE_EXCHANGE  |UNPARTITIONED|
+    -- STREAM_PROJECT  |UNPARTITIONED|
+      -- ASSIGN  |UNPARTITIONED|
+        -- AGGREGATE  |UNPARTITIONED|
+          -- RANDOM_MERGE_EXCHANGE  |PARTITIONED|
+            -- AGGREGATE  |PARTITIONED|
+              -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+                -- HYBRID_HASH_JOIN [$$48][$$49]  |PARTITIONED|
+                  -- HASH_PARTITION_EXCHANGE [$$48]  |PARTITIONED|
+                    -- STREAM_PROJECT  |PARTITIONED|
+                      -- ASSIGN  |PARTITIONED|
+                        -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+                          -- DATASOURCE_SCAN (asterix.tpcds-datagen.customer_address.1.0)  |PARTITIONED|
+                            -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+                              -- EMPTY_TUPLE_SOURCE  |PARTITIONED|
+                  -- HASH_PARTITION_EXCHANGE [$$49]  |PARTITIONED|
+                    -- STREAM_PROJECT  |PARTITIONED|
+                      -- ASSIGN  |PARTITIONED|
+                        -- STREAM_PROJECT  |PARTITIONED|
+                          -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+                            -- DATASOURCE_SCAN (test.t1)  |PARTITIONED|
+                              -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+                                -- EMPTY_TUPLE_SOURCE  |PARTITIONED|
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/ddl/invalid-dataverse-name/invalid-dataverse-name.4.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/ddl/invalid-dataverse-name/invalid-dataverse-name.4.ddl.sqlpp
new file mode 100644
index 0000000..61a675c
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/ddl/invalid-dataverse-name/invalid-dataverse-name.4.ddl.sqlpp
@@ -0,0 +1,24 @@
+/*
+ * 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.
+ */
+
+/*
+ * Reserved dataverse name -> Error
+ */
+
+create dataverse asterix;
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/ddl/invalid-dataverse-name/invalid-dataverse-name.5.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/ddl/invalid-dataverse-name/invalid-dataverse-name.5.ddl.sqlpp
new file mode 100644
index 0000000..85708ce
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/ddl/invalid-dataverse-name/invalid-dataverse-name.5.ddl.sqlpp
@@ -0,0 +1,24 @@
+/*
+ * 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.
+ */
+
+/*
+ * Reserved dataverse name -> Error
+ */
+
+create dataverse algebricks;
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/fun_return_null_missing/field-access/field-access.01.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/fun_return_null_missing/field-access/field-access.01.ddl.sqlpp
new file mode 100644
index 0000000..aa4fd86
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/fun_return_null_missing/field-access/field-access.01.ddl.sqlpp
@@ -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 test;
+
+CREATE TYPE t1 AS {
+id:   int,
+str1: string
+};
+
+CREATE DATASET ds1(t1) PRIMARY KEY id;
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/fun_return_null_missing/field-access/field-access.02.update.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/fun_return_null_missing/field-access/field-access.02.update.sqlpp
new file mode 100644
index 0000000..c78eeb5
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/fun_return_null_missing/field-access/field-access.02.update.sqlpp
@@ -0,0 +1,22 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+USE test;
+
+INSERT INTO ds1([{"id": 1, "str1": "text", "str2": "text"}]);
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/fun_return_null_missing/field-access/field-access.03.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/fun_return_null_missing/field-access/field-access.03.query.sqlpp
new file mode 100644
index 0000000..6832a64
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/fun_return_null_missing/field-access/field-access.03.query.sqlpp
@@ -0,0 +1,29 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/*
+ *  Description: tests reporting invalid argument type for field-access function
+ */
+// requesttype=application/json
+// param max-warnings:json=1000
+
+USE test;
+
+FROM ds1 AS ds1
+SELECT ds1.str1.x, ds1.str2.y;
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/fun_return_null_missing/field-access/field-access.04.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/fun_return_null_missing/field-access/field-access.04.query.sqlpp
new file mode 100644
index 0000000..bb65e36
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/fun_return_null_missing/field-access/field-access.04.query.sqlpp
@@ -0,0 +1,26 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/*
+ *  Description: tests reporting invalid argument type for field-access function
+ */
+// requesttype=application/json
+// param max-warnings:json=1000
+
+SELECT "x".y;
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/fun_return_null_missing/field-access/field-access.99.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/fun_return_null_missing/field-access/field-access.99.ddl.sqlpp
new file mode 100644
index 0000000..36b2bab
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/fun_return_null_missing/field-access/field-access.99.ddl.sqlpp
@@ -0,0 +1,20 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+DROP DATAVERSE test IF EXISTS;
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/fun_return_null/numeric_fun/numeric_fun_001/numeric_fun_001.01.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/fun_return_null_missing/numeric_fun/numeric_fun_001/numeric_fun_001.01.ddl.sqlpp
similarity index 100%
rename from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/fun_return_null/numeric_fun/numeric_fun_001/numeric_fun_001.01.ddl.sqlpp
rename to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/fun_return_null_missing/numeric_fun/numeric_fun_001/numeric_fun_001.01.ddl.sqlpp
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/fun_return_null/numeric_fun/numeric_fun_001/numeric_fun_001.02.update.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/fun_return_null_missing/numeric_fun/numeric_fun_001/numeric_fun_001.02.update.sqlpp
similarity index 100%
rename from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/fun_return_null/numeric_fun/numeric_fun_001/numeric_fun_001.02.update.sqlpp
rename to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/fun_return_null_missing/numeric_fun/numeric_fun_001/numeric_fun_001.02.update.sqlpp
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/fun_return_null/numeric_fun/numeric_fun_001/numeric_fun_001.03.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/fun_return_null_missing/numeric_fun/numeric_fun_001/numeric_fun_001.03.query.sqlpp
similarity index 100%
rename from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/fun_return_null/numeric_fun/numeric_fun_001/numeric_fun_001.03.query.sqlpp
rename to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/fun_return_null_missing/numeric_fun/numeric_fun_001/numeric_fun_001.03.query.sqlpp
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/fun_return_null/numeric_fun/numeric_fun_001/numeric_fun_001.04.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/fun_return_null_missing/numeric_fun/numeric_fun_001/numeric_fun_001.04.ddl.sqlpp
similarity index 100%
rename from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/fun_return_null/numeric_fun/numeric_fun_001/numeric_fun_001.04.ddl.sqlpp
rename to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/fun_return_null_missing/numeric_fun/numeric_fun_001/numeric_fun_001.04.ddl.sqlpp
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/fun_return_null/numeric_fun/numeric_fun_002/numeric_fun_002.01.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/fun_return_null_missing/numeric_fun/numeric_fun_002/numeric_fun_002.01.ddl.sqlpp
similarity index 100%
rename from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/fun_return_null/numeric_fun/numeric_fun_002/numeric_fun_002.01.ddl.sqlpp
rename to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/fun_return_null_missing/numeric_fun/numeric_fun_002/numeric_fun_002.01.ddl.sqlpp
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/fun_return_null/numeric_fun/numeric_fun_002/numeric_fun_002.02.update.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/fun_return_null_missing/numeric_fun/numeric_fun_002/numeric_fun_002.02.update.sqlpp
similarity index 100%
rename from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/fun_return_null/numeric_fun/numeric_fun_002/numeric_fun_002.02.update.sqlpp
rename to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/fun_return_null_missing/numeric_fun/numeric_fun_002/numeric_fun_002.02.update.sqlpp
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/fun_return_null/numeric_fun/numeric_fun_002/numeric_fun_002.03.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/fun_return_null_missing/numeric_fun/numeric_fun_002/numeric_fun_002.03.query.sqlpp
similarity index 100%
rename from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/fun_return_null/numeric_fun/numeric_fun_002/numeric_fun_002.03.query.sqlpp
rename to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/fun_return_null_missing/numeric_fun/numeric_fun_002/numeric_fun_002.03.query.sqlpp
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/fun_return_null/numeric_fun/numeric_fun_002/numeric_fun_002.04.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/fun_return_null_missing/numeric_fun/numeric_fun_002/numeric_fun_002.04.ddl.sqlpp
similarity index 100%
rename from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/fun_return_null/numeric_fun/numeric_fun_002/numeric_fun_002.04.ddl.sqlpp
rename to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/fun_return_null_missing/numeric_fun/numeric_fun_002/numeric_fun_002.04.ddl.sqlpp
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/fun_return_null/numeric_fun/numeric_fun_003/numeric_fun_003.01.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/fun_return_null_missing/numeric_fun/numeric_fun_003/numeric_fun_003.01.ddl.sqlpp
similarity index 100%
rename from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/fun_return_null/numeric_fun/numeric_fun_003/numeric_fun_003.01.ddl.sqlpp
rename to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/fun_return_null_missing/numeric_fun/numeric_fun_003/numeric_fun_003.01.ddl.sqlpp
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/fun_return_null/numeric_fun/numeric_fun_003/numeric_fun_003.02.update.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/fun_return_null_missing/numeric_fun/numeric_fun_003/numeric_fun_003.02.update.sqlpp
similarity index 100%
rename from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/fun_return_null/numeric_fun/numeric_fun_003/numeric_fun_003.02.update.sqlpp
rename to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/fun_return_null_missing/numeric_fun/numeric_fun_003/numeric_fun_003.02.update.sqlpp
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/fun_return_null/numeric_fun/numeric_fun_003/numeric_fun_003.03.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/fun_return_null_missing/numeric_fun/numeric_fun_003/numeric_fun_003.03.query.sqlpp
similarity index 100%
rename from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/fun_return_null/numeric_fun/numeric_fun_003/numeric_fun_003.03.query.sqlpp
rename to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/fun_return_null_missing/numeric_fun/numeric_fun_003/numeric_fun_003.03.query.sqlpp
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/fun_return_null/numeric_fun/numeric_fun_003/numeric_fun_003.04.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/fun_return_null_missing/numeric_fun/numeric_fun_003/numeric_fun_003.04.ddl.sqlpp
similarity index 100%
rename from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/fun_return_null/numeric_fun/numeric_fun_003/numeric_fun_003.04.ddl.sqlpp
rename to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/fun_return_null_missing/numeric_fun/numeric_fun_003/numeric_fun_003.04.ddl.sqlpp
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/fun_return_null/string_fun/string_fun_001/string_fun_001.01.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/fun_return_null_missing/string_fun/string_fun_001/string_fun_001.01.ddl.sqlpp
similarity index 100%
rename from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/fun_return_null/string_fun/string_fun_001/string_fun_001.01.ddl.sqlpp
rename to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/fun_return_null_missing/string_fun/string_fun_001/string_fun_001.01.ddl.sqlpp
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/fun_return_null/string_fun/string_fun_001/string_fun_001.02.update.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/fun_return_null_missing/string_fun/string_fun_001/string_fun_001.02.update.sqlpp
similarity index 100%
rename from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/fun_return_null/string_fun/string_fun_001/string_fun_001.02.update.sqlpp
rename to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/fun_return_null_missing/string_fun/string_fun_001/string_fun_001.02.update.sqlpp
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/fun_return_null/string_fun/string_fun_001/string_fun_001.03.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/fun_return_null_missing/string_fun/string_fun_001/string_fun_001.03.query.sqlpp
similarity index 100%
rename from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/fun_return_null/string_fun/string_fun_001/string_fun_001.03.query.sqlpp
rename to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/fun_return_null_missing/string_fun/string_fun_001/string_fun_001.03.query.sqlpp
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/fun_return_null/string_fun/string_fun_001/string_fun_001.04.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/fun_return_null_missing/string_fun/string_fun_001/string_fun_001.04.query.sqlpp
similarity index 100%
rename from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/fun_return_null/string_fun/string_fun_001/string_fun_001.04.query.sqlpp
rename to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/fun_return_null_missing/string_fun/string_fun_001/string_fun_001.04.query.sqlpp
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/fun_return_null/string_fun/string_fun_001/string_fun_001.05.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/fun_return_null_missing/string_fun/string_fun_001/string_fun_001.05.query.sqlpp
similarity index 100%
rename from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/fun_return_null/string_fun/string_fun_001/string_fun_001.05.query.sqlpp
rename to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/fun_return_null_missing/string_fun/string_fun_001/string_fun_001.05.query.sqlpp
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/fun_return_null/string_fun/string_fun_001/string_fun_001.06.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/fun_return_null_missing/string_fun/string_fun_001/string_fun_001.06.query.sqlpp
similarity index 100%
rename from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/fun_return_null/string_fun/string_fun_001/string_fun_001.06.query.sqlpp
rename to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/fun_return_null_missing/string_fun/string_fun_001/string_fun_001.06.query.sqlpp
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/fun_return_null/string_fun/string_fun_001/string_fun_001.07.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/fun_return_null_missing/string_fun/string_fun_001/string_fun_001.07.query.sqlpp
similarity index 100%
rename from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/fun_return_null/string_fun/string_fun_001/string_fun_001.07.query.sqlpp
rename to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/fun_return_null_missing/string_fun/string_fun_001/string_fun_001.07.query.sqlpp
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/fun_return_null/string_fun/string_fun_001/string_fun_001.08.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/fun_return_null_missing/string_fun/string_fun_001/string_fun_001.08.query.sqlpp
similarity index 100%
rename from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/fun_return_null/string_fun/string_fun_001/string_fun_001.08.query.sqlpp
rename to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/fun_return_null_missing/string_fun/string_fun_001/string_fun_001.08.query.sqlpp
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/fun_return_null/string_fun/string_fun_001/string_fun_001.09.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/fun_return_null_missing/string_fun/string_fun_001/string_fun_001.09.ddl.sqlpp
similarity index 100%
rename from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/fun_return_null/string_fun/string_fun_001/string_fun_001.09.ddl.sqlpp
rename to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/fun_return_null_missing/string_fun/string_fun_001/string_fun_001.09.ddl.sqlpp
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/fun_return_null/string_fun/string_fun_002/string_fun_002.01.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/fun_return_null_missing/string_fun/string_fun_002/string_fun_002.01.query.sqlpp
similarity index 100%
rename from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/fun_return_null/string_fun/string_fun_002/string_fun_002.01.query.sqlpp
rename to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/fun_return_null_missing/string_fun/string_fun_002/string_fun_002.01.query.sqlpp
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/fun_return_null/string_fun/string_fun_003/string_fun_003.01.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/fun_return_null_missing/string_fun/string_fun_003/string_fun_003.01.ddl.sqlpp
similarity index 100%
rename from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/fun_return_null/string_fun/string_fun_003/string_fun_003.01.ddl.sqlpp
rename to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/fun_return_null_missing/string_fun/string_fun_003/string_fun_003.01.ddl.sqlpp
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/fun_return_null/string_fun/string_fun_003/string_fun_003.02.update.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/fun_return_null_missing/string_fun/string_fun_003/string_fun_003.02.update.sqlpp
similarity index 100%
rename from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/fun_return_null/string_fun/string_fun_003/string_fun_003.02.update.sqlpp
rename to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/fun_return_null_missing/string_fun/string_fun_003/string_fun_003.02.update.sqlpp
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/fun_return_null/string_fun/string_fun_003/string_fun_003.03.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/fun_return_null_missing/string_fun/string_fun_003/string_fun_003.03.query.sqlpp
similarity index 100%
rename from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/fun_return_null/string_fun/string_fun_003/string_fun_003.03.query.sqlpp
rename to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/fun_return_null_missing/string_fun/string_fun_003/string_fun_003.03.query.sqlpp
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/fun_return_null/string_fun/string_fun_003/string_fun_003.04.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/fun_return_null_missing/string_fun/string_fun_003/string_fun_003.04.query.sqlpp
similarity index 100%
rename from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/fun_return_null/string_fun/string_fun_003/string_fun_003.04.query.sqlpp
rename to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/fun_return_null_missing/string_fun/string_fun_003/string_fun_003.04.query.sqlpp
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/fun_return_null/string_fun/string_fun_003/string_fun_003.05.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/fun_return_null_missing/string_fun/string_fun_003/string_fun_003.05.query.sqlpp
similarity index 100%
rename from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/fun_return_null/string_fun/string_fun_003/string_fun_003.05.query.sqlpp
rename to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/fun_return_null_missing/string_fun/string_fun_003/string_fun_003.05.query.sqlpp
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/fun_return_null/string_fun/string_fun_003/string_fun_003.06.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/fun_return_null_missing/string_fun/string_fun_003/string_fun_003.06.ddl.sqlpp
similarity index 100%
rename from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/fun_return_null/string_fun/string_fun_003/string_fun_003.06.ddl.sqlpp
rename to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/fun_return_null_missing/string_fun/string_fun_003/string_fun_003.06.ddl.sqlpp
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/fun_return_null/string_fun/string_fun_004/string_fun_004.01.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/fun_return_null_missing/string_fun/string_fun_004/string_fun_004.01.ddl.sqlpp
similarity index 100%
rename from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/fun_return_null/string_fun/string_fun_004/string_fun_004.01.ddl.sqlpp
rename to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/fun_return_null_missing/string_fun/string_fun_004/string_fun_004.01.ddl.sqlpp
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/fun_return_null/string_fun/string_fun_004/string_fun_004.02.update.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/fun_return_null_missing/string_fun/string_fun_004/string_fun_004.02.update.sqlpp
similarity index 100%
rename from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/fun_return_null/string_fun/string_fun_004/string_fun_004.02.update.sqlpp
rename to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/fun_return_null_missing/string_fun/string_fun_004/string_fun_004.02.update.sqlpp
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/fun_return_null/string_fun/string_fun_004/string_fun_004.03.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/fun_return_null_missing/string_fun/string_fun_004/string_fun_004.03.query.sqlpp
similarity index 100%
rename from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/fun_return_null/string_fun/string_fun_004/string_fun_004.03.query.sqlpp
rename to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/fun_return_null_missing/string_fun/string_fun_004/string_fun_004.03.query.sqlpp
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/fun_return_null/string_fun/string_fun_004/string_fun_004.04.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/fun_return_null_missing/string_fun/string_fun_004/string_fun_004.04.query.sqlpp
similarity index 100%
rename from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/fun_return_null/string_fun/string_fun_004/string_fun_004.04.query.sqlpp
rename to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/fun_return_null_missing/string_fun/string_fun_004/string_fun_004.04.query.sqlpp
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/fun_return_null/string_fun/string_fun_004/string_fun_004.05.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/fun_return_null_missing/string_fun/string_fun_004/string_fun_004.05.query.sqlpp
similarity index 100%
rename from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/fun_return_null/string_fun/string_fun_004/string_fun_004.05.query.sqlpp
rename to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/fun_return_null_missing/string_fun/string_fun_004/string_fun_004.05.query.sqlpp
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/fun_return_null/string_fun/string_fun_004/string_fun_004.06.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/fun_return_null_missing/string_fun/string_fun_004/string_fun_004.06.ddl.sqlpp
similarity index 100%
rename from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/fun_return_null/string_fun/string_fun_004/string_fun_004.06.ddl.sqlpp
rename to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/fun_return_null_missing/string_fun/string_fun_004/string_fun_004.06.ddl.sqlpp
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-01-negative/sugar-01-negative.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-01-negative/sugar-01-negative.3.query.sqlpp
index 0218637..523e8ed 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-01-negative/sugar-01-negative.3.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-01-negative/sugar-01-negative.3.query.sqlpp
@@ -23,5 +23,5 @@
 // cannot be used like a SQL-92 sugar, e.g., AVG. Its input must be a collection.
 FROM Employee e
 GROUP BY e.deptno AS deptno GROUP AS g
-SELECT deptno AS deptno, STRICT_AVG(g.e.salary) AS avgpay,
+SELECT deptno AS deptno, STRICT_AVG(g[0].e.salary) AS avgpay,
        (SELECT i.e.name AS name, i.e.salary AS salary FROM g AS i) AS workers;
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-01-negative/sugar-01-negative.99.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-01-negative/sugar-01-negative.99.ddl.sqlpp
new file mode 100644
index 0000000..9293a16
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-01-negative/sugar-01-negative.99.ddl.sqlpp
@@ -0,0 +1,20 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+DROP DATAVERSE gby IF EXISTS;
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/statement-params/named_01/named_01.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/statement-params/named_01/named_01.3.query.sqlpp
new file mode 100644
index 0000000..daf38c9
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/statement-params/named_01/named_01.3.query.sqlpp
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/*
+ * Description  : Test named statement parameters that have the same name as keywords (json encoded request)
+ * Expected Res : Success
+ * Date         : Dec 2020
+ */
+
+// requesttype=application/json
+
+// param $from:json="from"
+// param $select:json="select"
+
+{
+  "t1": {
+    "from": $from,
+    "select": $`select`
+  },
+
+  "t2": {
+    "from_type": is_string($from),
+    "select_type": is_string($`select`)
+  },
+
+  "t3": [ $from, $`select` ]
+}
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/statement-params/named_01/named_01.4.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/statement-params/named_01/named_01.4.query.sqlpp
new file mode 100644
index 0000000..b769d89
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/statement-params/named_01/named_01.4.query.sqlpp
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/*
+ * Description  : Test named statement parameters that have the same name as keywords (url encoded request)
+ * Expected Res : Success
+ * Date         : Dec 2020
+ */
+
+// requesttype=application/x-www-form-urlencoded
+
+// param $from:json="from"
+// param $select:json="select"
+
+{
+  "t1": {
+    "from": $from,
+    "select": $`select`
+  },
+
+  "t2": {
+    "from_type": is_string($from),
+    "select_type": is_string($`select`)
+  },
+
+  "t3": [ $from, $`select` ]
+}
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/feeds/feeds_01/feeds_01.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/feeds/feeds_01/feeds_01.1.adm
index 3ab469e..8ada33c 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results/feeds/feeds_01/feeds_01.1.adm
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/feeds/feeds_01/feeds_01.1.adm
@@ -1 +1 @@
-{ "DataverseName": "feeds", "FeedName": "TweetFeed", "AdapterConfiguration": {{ { "Name": "path", "Value": "asterix_nc1://data/twitter/obamatweets.adm" }, { "Name": "feed", "Value": "TweetFeed" }, { "Name": "adapter-name", "Value": "localfs" }, { "Name": "is-feed", "Value": "true" }, { "Name": "parser", "Value": "adm" }, { "Name": "reader", "Value": "localfs" }, { "Name": "format", "Value": "adm" }, { "Name": "tuple-interval", "Value": "10" }, { "Name": "type-name", "Value": "TweetType" }, { "Name": "dataverse", "Value": "feeds" } }}, "Timestamp": "Tue Mar 31 10:30:06 PDT 2020" }
\ No newline at end of file
+{ "DataverseName": "feeds", "FeedName": "TweetFeed", "AdapterConfiguration": {{ { "Name": "dataset-dataverse", "Value": "feeds" }, { "Name": "path", "Value": "asterix_nc1://data/twitter/obamatweets.adm" }, { "Name": "feed", "Value": "TweetFeed" }, { "Name": "adapter-name", "Value": "localfs" }, { "Name": "is-feed", "Value": "true" }, { "Name": "parser", "Value": "adm" }, { "Name": "reader", "Value": "localfs" }, { "Name": "format", "Value": "adm" }, { "Name": "tuple-interval", "Value": "10" }, { "Name": "type-name", "Value": "TweetType" } }}, "Timestamp": "Tue Mar 31 10:30:06 PDT 2020" }
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/fun_return_null_missing/field-access/field-access.03.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/fun_return_null_missing/field-access/field-access.03.adm
new file mode 100644
index 0000000..f7bcb87
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/fun_return_null_missing/field-access/field-access.03.adm
@@ -0,0 +1 @@
+{  }
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/fun_return_null_missing/field-access/field-access.04.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/fun_return_null_missing/field-access/field-access.04.adm
new file mode 100644
index 0000000..f7bcb87
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/fun_return_null_missing/field-access/field-access.04.adm
@@ -0,0 +1 @@
+{  }
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/fun_return_null/numeric_fun/numeric_fun_001/numeric_fun_001.03.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/fun_return_null_missing/numeric_fun/numeric_fun_001/numeric_fun_001.03.adm
similarity index 100%
rename from asterixdb/asterix-app/src/test/resources/runtimets/results/fun_return_null/numeric_fun/numeric_fun_001/numeric_fun_001.03.adm
rename to asterixdb/asterix-app/src/test/resources/runtimets/results/fun_return_null_missing/numeric_fun/numeric_fun_001/numeric_fun_001.03.adm
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/fun_return_null/numeric_fun/numeric_fun_002/numeric_fun_002.03.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/fun_return_null_missing/numeric_fun/numeric_fun_002/numeric_fun_002.03.adm
similarity index 100%
rename from asterixdb/asterix-app/src/test/resources/runtimets/results/fun_return_null/numeric_fun/numeric_fun_002/numeric_fun_002.03.adm
rename to asterixdb/asterix-app/src/test/resources/runtimets/results/fun_return_null_missing/numeric_fun/numeric_fun_002/numeric_fun_002.03.adm
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/fun_return_null/numeric_fun/numeric_fun_003/numeric_fun_003.03.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/fun_return_null_missing/numeric_fun/numeric_fun_003/numeric_fun_003.03.adm
similarity index 100%
rename from asterixdb/asterix-app/src/test/resources/runtimets/results/fun_return_null/numeric_fun/numeric_fun_003/numeric_fun_003.03.adm
rename to asterixdb/asterix-app/src/test/resources/runtimets/results/fun_return_null_missing/numeric_fun/numeric_fun_003/numeric_fun_003.03.adm
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/fun_return_null/string_fun/string_fun_001/string_fun_001.03.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/fun_return_null_missing/string_fun/string_fun_001/string_fun_001.03.adm
similarity index 100%
rename from asterixdb/asterix-app/src/test/resources/runtimets/results/fun_return_null/string_fun/string_fun_001/string_fun_001.03.adm
rename to asterixdb/asterix-app/src/test/resources/runtimets/results/fun_return_null_missing/string_fun/string_fun_001/string_fun_001.03.adm
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/fun_return_null/string_fun/string_fun_001/string_fun_001.04.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/fun_return_null_missing/string_fun/string_fun_001/string_fun_001.04.adm
similarity index 100%
rename from asterixdb/asterix-app/src/test/resources/runtimets/results/fun_return_null/string_fun/string_fun_001/string_fun_001.04.adm
rename to asterixdb/asterix-app/src/test/resources/runtimets/results/fun_return_null_missing/string_fun/string_fun_001/string_fun_001.04.adm
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/fun_return_null/string_fun/string_fun_001/string_fun_001.05.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/fun_return_null_missing/string_fun/string_fun_001/string_fun_001.05.adm
similarity index 100%
rename from asterixdb/asterix-app/src/test/resources/runtimets/results/fun_return_null/string_fun/string_fun_001/string_fun_001.05.adm
rename to asterixdb/asterix-app/src/test/resources/runtimets/results/fun_return_null_missing/string_fun/string_fun_001/string_fun_001.05.adm
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/fun_return_null/string_fun/string_fun_001/string_fun_001.06.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/fun_return_null_missing/string_fun/string_fun_001/string_fun_001.06.adm
similarity index 100%
rename from asterixdb/asterix-app/src/test/resources/runtimets/results/fun_return_null/string_fun/string_fun_001/string_fun_001.06.adm
rename to asterixdb/asterix-app/src/test/resources/runtimets/results/fun_return_null_missing/string_fun/string_fun_001/string_fun_001.06.adm
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/fun_return_null/string_fun/string_fun_001/string_fun_001.07.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/fun_return_null_missing/string_fun/string_fun_001/string_fun_001.07.adm
similarity index 100%
rename from asterixdb/asterix-app/src/test/resources/runtimets/results/fun_return_null/string_fun/string_fun_001/string_fun_001.07.adm
rename to asterixdb/asterix-app/src/test/resources/runtimets/results/fun_return_null_missing/string_fun/string_fun_001/string_fun_001.07.adm
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/fun_return_null/string_fun/string_fun_001/string_fun_001.08.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/fun_return_null_missing/string_fun/string_fun_001/string_fun_001.08.adm
similarity index 100%
rename from asterixdb/asterix-app/src/test/resources/runtimets/results/fun_return_null/string_fun/string_fun_001/string_fun_001.08.adm
rename to asterixdb/asterix-app/src/test/resources/runtimets/results/fun_return_null_missing/string_fun/string_fun_001/string_fun_001.08.adm
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/fun_return_null/string_fun/string_fun_002/string_fun_002.01.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/fun_return_null_missing/string_fun/string_fun_002/string_fun_002.01.adm
similarity index 100%
rename from asterixdb/asterix-app/src/test/resources/runtimets/results/fun_return_null/string_fun/string_fun_002/string_fun_002.01.adm
rename to asterixdb/asterix-app/src/test/resources/runtimets/results/fun_return_null_missing/string_fun/string_fun_002/string_fun_002.01.adm
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/fun_return_null/string_fun/string_fun_003/string_fun_003.01.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/fun_return_null_missing/string_fun/string_fun_003/string_fun_003.01.adm
similarity index 100%
rename from asterixdb/asterix-app/src/test/resources/runtimets/results/fun_return_null/string_fun/string_fun_003/string_fun_003.01.adm
rename to asterixdb/asterix-app/src/test/resources/runtimets/results/fun_return_null_missing/string_fun/string_fun_003/string_fun_003.01.adm
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/fun_return_null/string_fun/string_fun_003/string_fun_003.02.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/fun_return_null_missing/string_fun/string_fun_003/string_fun_003.02.adm
similarity index 100%
rename from asterixdb/asterix-app/src/test/resources/runtimets/results/fun_return_null/string_fun/string_fun_003/string_fun_003.02.adm
rename to asterixdb/asterix-app/src/test/resources/runtimets/results/fun_return_null_missing/string_fun/string_fun_003/string_fun_003.02.adm
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/fun_return_null/string_fun/string_fun_003/string_fun_003.03.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/fun_return_null_missing/string_fun/string_fun_003/string_fun_003.03.adm
similarity index 100%
rename from asterixdb/asterix-app/src/test/resources/runtimets/results/fun_return_null/string_fun/string_fun_003/string_fun_003.03.adm
rename to asterixdb/asterix-app/src/test/resources/runtimets/results/fun_return_null_missing/string_fun/string_fun_003/string_fun_003.03.adm
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/fun_return_null/string_fun/string_fun_004/string_fun_004.03.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/fun_return_null_missing/string_fun/string_fun_004/string_fun_004.03.adm
similarity index 100%
rename from asterixdb/asterix-app/src/test/resources/runtimets/results/fun_return_null/string_fun/string_fun_004/string_fun_004.03.adm
rename to asterixdb/asterix-app/src/test/resources/runtimets/results/fun_return_null_missing/string_fun/string_fun_004/string_fun_004.03.adm
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/fun_return_null/string_fun/string_fun_004/string_fun_004.04.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/fun_return_null_missing/string_fun/string_fun_004/string_fun_004.04.adm
similarity index 100%
rename from asterixdb/asterix-app/src/test/resources/runtimets/results/fun_return_null/string_fun/string_fun_004/string_fun_004.04.adm
rename to asterixdb/asterix-app/src/test/resources/runtimets/results/fun_return_null_missing/string_fun/string_fun_004/string_fun_004.04.adm
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/fun_return_null/string_fun/string_fun_004/string_fun_004.05.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/fun_return_null_missing/string_fun/string_fun_004/string_fun_004.05.adm
similarity index 100%
rename from asterixdb/asterix-app/src/test/resources/runtimets/results/fun_return_null/string_fun/string_fun_004/string_fun_004.05.adm
rename to asterixdb/asterix-app/src/test/resources/runtimets/results/fun_return_null_missing/string_fun/string_fun_004/string_fun_004.05.adm
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/statement-params/named_01/named_01.3.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/statement-params/named_01/named_01.3.adm
new file mode 100644
index 0000000..f7dce44
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/statement-params/named_01/named_01.3.adm
@@ -0,0 +1 @@
+{ "t1": { "from": "from", "select": "select" }, "t2": { "from_type": true, "select_type": true }, "t3": [ "from", "select" ] }
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/statement-params/named_01/named_01.4.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/statement-params/named_01/named_01.4.adm
new file mode 100644
index 0000000..f7dce44
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/statement-params/named_01/named_01.4.adm
@@ -0,0 +1 @@
+{ "t1": { "from": "from", "select": "select" }, "t2": { "from_type": true, "select_type": true }, "t3": [ "from", "select" ] }
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_sqlpp.xml b/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_sqlpp.xml
index 49c4280..65b8c2b 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_sqlpp.xml
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_sqlpp.xml
@@ -4020,6 +4020,8 @@
         <output-dir compare="Text">none</output-dir>
         <expected-error>ASX1115: Invalid name for a database object: "&lt;empty&gt;"</expected-error>
         <expected-error>ASX1115: Invalid name for a database object: " a"</expected-error>
+        <expected-error>ASX1079: Compilation error: Invalid operation - Cannot create dataverse: asterix</expected-error>
+        <expected-error>ASX1079: Compilation error: Invalid operation - Cannot create dataverse: algebricks</expected-error>
       </compilation-unit>
     </test-case>
     <test-case FilePath="ddl">
@@ -5644,7 +5646,7 @@
     <test-case FilePath="group-by">
       <compilation-unit name="sugar-01-negative">
         <output-dir compare="Text">core-01</output-dir>
-        <expected-error>ASX1091: Type mismatch: expected value of type object, but got the value of type array (in line 26, at column 38)</expected-error>
+        <expected-error>ASX0037: Type mismatch: expected value of type array or multiset, but got the value of type bigint (in line 26, at column 26)</expected-error>
       </compilation-unit>
     </test-case>
     <test-case FilePath="group-by">
@@ -13380,6 +13382,11 @@
         <output-dir compare="Clean-JSON">issue-ASTERIXDB-1165</output-dir>
       </compilation-unit>
     </test-case>
+    <test-case FilePath="json">
+      <compilation-unit name="int01">
+        <output-dir compare="Clean-JSON">int01-cleanjson</output-dir>
+      </compilation-unit>
+    </test-case>
   </test-group>
   <test-group name="materialization">
     <test-case FilePath="materialization">
@@ -13497,13 +13504,6 @@
       </compilation-unit>
     </test-case>
   </test-group>
-  <test-group name="cleanjson">
-    <test-case FilePath="json">
-      <compilation-unit name="int01">
-        <output-dir compare="Clean-JSON">int01-cleanjson</output-dir>
-      </compilation-unit>
-    </test-case>
-  </test-group>
   <test-group name="csv">
     <test-case FilePath="csv">
       <compilation-unit name="basic-types">
@@ -14164,8 +14164,8 @@
       </compilation-unit>
     </test-case>
   </test-group>
-  <test-group name="fun_return_null/string_fun">
-    <test-case FilePath="fun_return_null/string_fun" check-warnings="true">
+  <test-group name="fun_return_null_missing/string_fun">
+    <test-case FilePath="fun_return_null_missing/string_fun" check-warnings="true">
       <compilation-unit name="string_fun_001">
         <output-dir compare="Text">string_fun_001</output-dir>
         <expected-warn>Type mismatch: function trim expects its 1st input parameter to be of type string, but the actual input type is bigint (in line 41, at column 1)</expected-warn>
@@ -14265,7 +14265,7 @@
         <expected-warn>Type mismatch: function ends-with expects its 1st input parameter to be of type string, but the actual input type is bigint (in line 33, at column 1)</expected-warn>
       </compilation-unit>
     </test-case>
-    <test-case FilePath="fun_return_null/string_fun" check-warnings="true">
+    <test-case FilePath="fun_return_null_missing/string_fun" check-warnings="true">
       <compilation-unit name="string_fun_002">
         <output-dir compare="Text">string_fun_002</output-dir>
         <expected-warn>Type mismatch: function rtrim expects its 1st input parameter to be of type string, but the actual input type is bigint (in line 42, at column 1)</expected-warn>
@@ -14300,7 +14300,7 @@
         <expected-warn>Type mismatch: function regexp-position expects its 1st input parameter to be of type string, but the actual input type is integer (in line 50, at column 1)</expected-warn>
       </compilation-unit>
     </test-case>
-    <test-case FilePath="fun_return_null/string_fun" check-warnings="true">
+    <test-case FilePath="fun_return_null_missing/string_fun" check-warnings="true">
       <compilation-unit name="string_fun_003">
         <output-dir compare="Text">string_fun_003</output-dir>
         <expected-warn>Invalid value: function repeat expects its 2nd input parameter to be an integer value, got 5.3 (in line 31, at column 1)</expected-warn>
@@ -14325,7 +14325,7 @@
         <expected-warn>Invalid value: function substring expects its 2nd input parameter to be an integer value, got Infinity (in line 34, at column 1)</expected-warn>
       </compilation-unit>
     </test-case>
-    <test-case FilePath="fun_return_null/string_fun" check-warnings="true">
+    <test-case FilePath="fun_return_null_missing/string_fun" check-warnings="true">
       <compilation-unit name="string_fun_004">
         <output-dir compare="Text">string_fun_004</output-dir>
         <expected-warn>Type mismatch: function string-concat expects its 2nd input parameter to be of type string, but the actual input type is tinyint (in line 30, at column 1)</expected-warn>
@@ -14351,8 +14351,8 @@
       </compilation-unit>
     </test-case>
   </test-group>
-  <test-group name="fun_return_null/numeric_fun" >
-    <test-case FilePath="fun_return_null/numeric_fun" check-warnings="true">
+  <test-group name="fun_return_null_missing/numeric_fun" >
+    <test-case FilePath="fun_return_null_missing/numeric_fun" check-warnings="true">
       <compilation-unit name="numeric_fun_001">
         <output-dir compare="Text">numeric_fun_001</output-dir>
         <expected-warn>Type mismatch: function abs expects its 1st input parameter to be of type tinyint, smallint, integer, bigint, float or double, but the actual input type is string</expected-warn>
@@ -14429,7 +14429,7 @@
         <source-location>false</source-location>
       </compilation-unit>
     </test-case>
-    <test-case FilePath="fun_return_null/numeric_fun" check-warnings="true">
+    <test-case FilePath="fun_return_null_missing/numeric_fun" check-warnings="true">
       <compilation-unit name="numeric_fun_002">
         <output-dir compare="Text">numeric_fun_002</output-dir>
         <expected-warn>Type mismatch: function round expects its 1st input parameter to be of type tinyint, smallint, integer, bigint, float or double, but the actual input type is string</expected-warn>
@@ -14456,7 +14456,7 @@
         <source-location>false</source-location>
       </compilation-unit>
     </test-case>
-    <test-case FilePath="fun_return_null/numeric_fun" check-warnings="true">
+    <test-case FilePath="fun_return_null_missing/numeric_fun" check-warnings="true">
       <compilation-unit name="numeric_fun_003">
         <output-dir compare="Text">numeric_fun_003</output-dir>
         <expected-warn>Type mismatch: function numeric-add expects its 2nd input parameter to be of type tinyint, smallint, integer, bigint, float, double, date, time, datetime, duration, yearmonthduration or daytimeduration, but the actual input type is string</expected-warn>
@@ -14500,6 +14500,15 @@
         <source-location>false</source-location>
       </compilation-unit>
     </test-case>
+    <test-case FilePath="fun_return_null_missing" check-warnings="true">
+      <compilation-unit name="field-access">
+        <output-dir compare="Text">field-access</output-dir>
+        <expected-warn>Type mismatch: function field-access-by-name expects its 1st input parameter to be of type object, but the actual input type is string</expected-warn>
+        <expected-warn>Type mismatch: function field-access-by-name expects its 1st input parameter to be of type object, but the actual input type is string</expected-warn>
+        <expected-warn>Type mismatch: function field-access-by-name expects its 1st input parameter to be of type object, but the actual input type is string</expected-warn>
+        <source-location>false</source-location>
+      </compilation-unit>
+    </test-case>
   </test-group>
   <test-group name="window">
     <test-case FilePath="window">
diff --git a/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/util/ExternalDataConstants.java b/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/util/ExternalDataConstants.java
index 812cb96..326f53d 100644
--- a/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/util/ExternalDataConstants.java
+++ b/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/util/ExternalDataConstants.java
@@ -36,7 +36,7 @@
     // used to specify the stream factory for an adapter that has a stream data source
     public static final String KEY_STREAM = "stream";
     // used to specify the dataverse of the adapter
-    public static final String KEY_DATAVERSE = "dataverse";
+    public static final String KEY_DATASET_DATAVERSE = "dataset-dataverse";
     // used to specify the socket addresses when reading data from sockets
     public static final String KEY_SOCKETS = "sockets";
     // specify whether the socket address points to an NC or an IP
diff --git a/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/util/ExternalDataUtils.java b/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/util/ExternalDataUtils.java
index 036dbad..a28a2ee 100644
--- a/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/util/ExternalDataUtils.java
+++ b/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/util/ExternalDataUtils.java
@@ -186,7 +186,7 @@
     }
 
     public static DataverseName getDataverse(Map<String, String> configuration) {
-        return DataverseName.createFromCanonicalForm(configuration.get(ExternalDataConstants.KEY_DATAVERSE));
+        return DataverseName.createFromCanonicalForm(configuration.get(ExternalDataConstants.KEY_DATASET_DATAVERSE));
     }
 
     public static String getParserFactory(Map<String, String> configuration) {
@@ -311,7 +311,7 @@
         if (!configuration.containsKey(ExternalDataConstants.KEY_IS_FEED)) {
             configuration.put(ExternalDataConstants.KEY_IS_FEED, ExternalDataConstants.TRUE);
         }
-        configuration.put(ExternalDataConstants.KEY_DATAVERSE, dataverseName.getCanonicalForm());
+        configuration.put(ExternalDataConstants.KEY_DATASET_DATAVERSE, dataverseName.getCanonicalForm());
         configuration.put(ExternalDataConstants.KEY_FEED_NAME, feedName);
     }
 
diff --git a/asterixdb/asterix-lang-sqlpp/src/main/javacc/SQLPP.jj b/asterixdb/asterix-lang-sqlpp/src/main/javacc/SQLPP.jj
index bb17115..5403272 100644
--- a/asterixdb/asterix-lang-sqlpp/src/main/javacc/SQLPP.jj
+++ b/asterixdb/asterix-lang-sqlpp/src/main/javacc/SQLPP.jj
@@ -3530,18 +3530,10 @@
 }
 {
   (
-    (
-      <DOLLAR>
-      (
-        <INTEGER_LITERAL> { name = token.image; } |
-        <IDENTIFIER> { name = token.image; } |
-        name = QuotedString()
-      )
-    )
-    |
-    (
-      <QUES> { name = String.valueOf(++externalVarCounter); }
-    )
+      <DOLLAR_IDENTIFIER> { name = token.image.substring(1); }
+    | <DOLLAR_INTEGER_LITERAL> { name = token.image.substring(1); }
+    | <DOLLAR_QUOTED_STRING> { name = removeQuotesAndEscapes(token.image.substring(1)); }
+    | <QUES> { name = String.valueOf(++externalVarCounter); }
   )
   {
      String idName = SqlppVariableUtil.toExternalVariableName(name);
@@ -4761,6 +4753,7 @@
   | <EXCEPT : "except">
   | <EXISTS : "exists">
   | <EXTERNAL : "external">
+  | <FALSE : "false">
   | <FEED : "feed">
   | <FILTER : "filter">
   | <FLATTEN : "flatten">
@@ -4792,10 +4785,12 @@
   | <LIKE : "like">
   | <LIMIT : "limit">
   | <LOAD : "load">
+  | <MISSING : "missing">
   | <MOD : "mod">
   | <NODEGROUP : "nodegroup">
   | <NGRAM : "ngram">
   | <NOT : "not">
+  | <NULL : "null">
   | <OFFSET : "offset">
   | <ON : "on">
   | <OPEN : "open">
@@ -4825,8 +4820,9 @@
   | <SYNONYM : "synonym">
   | <TEMPORARY : "temporary"> // intentionally not used but reserved for future usage
   | <THEN : "then">
-  | <TYPE : "type">
   | <TO : "to">
+  | <TRUE : "true">
+  | <TYPE : "type">
   | <UNION : "union">
   | <UNKNOWN : "unknown">
   | <UNNEST : "unnest">
@@ -4860,7 +4856,6 @@
   | <ATT : "@">
   | <COLON : ":">
   | <COMMA : ",">
-  | <DOLLAR: "$">
   | <DOT : ".">
   | <PERCENT: "%">
   | <QUES : "?">
@@ -4904,44 +4899,33 @@
 <DEFAULT,IN_DBL_BRACE>
 TOKEN :
 {
-    <INTEGER_LITERAL : (<DIGIT>)+ >
-}
-
-<DEFAULT,IN_DBL_BRACE>
-TOKEN [IGNORE_CASE]:
-{
-    <MISSING : "missing">
-  | <NULL : "null">
-  | <TRUE : "true">
-  | <FALSE : "false">
-}
-
-<DEFAULT,IN_DBL_BRACE>
-TOKEN :
-{
     <#DIGIT : ["0" - "9"]>
 }
 
 <DEFAULT,IN_DBL_BRACE>
 TOKEN:
 {
-    < DOUBLE_LITERAL: <DIGITS> ( "." <DIGITS> ) (("e"|"E") ("+"|"-")? <DIGITS>)?
+    <INTEGER_LITERAL : <DIGITS> >
+  | <DOUBLE_LITERAL: <DIGITS> ( "." <DIGITS> ) (("e"|"E") ("+"|"-")? <DIGITS>)?
                       | <DIGITS> (("e"|"E") ("+"|"-")? <DIGITS>)
                       | "." <DIGITS> (("e"|"E") ("+"|"-")? <DIGITS>)?
     >
-  | < FLOAT_LITERAL:  <DIGITS> ( "f" | "F" )
+  | <FLOAT_LITERAL:  <DIGITS> ( "f" | "F" )
                       | <DIGITS> ( "." <DIGITS> ( "f" | "F" ) )?
                       | "." <DIGITS> ( "f" | "F" )
     >
-  | <DIGITS : (<DIGIT>)+ >
+  | <#DIGITS : (<DIGIT>)+ >
 }
 
 <DEFAULT,IN_DBL_BRACE>
 TOKEN :
 {
     <#LETTER : ["A" - "Z", "a" - "z"]>
-  | <#IDENTIFIER_SPECIALCHARS_START : ["_"]>
-  | <#IDENTIFIER_SPECIALCHARS_REST : ["$"]>
+  | <#IDENTIFIER_START_SPECIALCHAR : ["_"]>
+  | <#IDENTIFIER_REST_SPECIALCHAR : ["$"]>
+  | <#IDENTIFIER_START : <LETTER> | <IDENTIFIER_START_SPECIALCHAR> >
+  | <#IDENTIFIER_REST  : <LETTER> | <DIGIT> | <IDENTIFIER_START_SPECIALCHAR> | <IDENTIFIER_REST_SPECIALCHAR> >
+  | <IDENTIFIER : <IDENTIFIER_START> (<IDENTIFIER_REST>)* >
 }
 
 <DEFAULT,IN_DBL_BRACE>
@@ -4992,8 +4976,9 @@
 <DEFAULT,IN_DBL_BRACE>
 TOKEN :
 {
-    <IDENTIFIER : ( <LETTER> | <IDENTIFIER_SPECIALCHARS_START> )
-                  ( <LETTER> | <DIGIT> | <IDENTIFIER_SPECIALCHARS_START> | <IDENTIFIER_SPECIALCHARS_REST> )*>
+    <DOLLAR_INTEGER_LITERAL : "$" <INTEGER_LITERAL> >
+  | <DOLLAR_IDENTIFIER : "$" <IDENTIFIER> >
+  | <DOLLAR_QUOTED_STRING: "$" <QUOTED_STRING> >
 }
 
 <DEFAULT,IN_DBL_BRACE>
diff --git a/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/declared/MetadataProvider.java b/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/declared/MetadataProvider.java
index 3b387d8..0e675d8 100644
--- a/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/declared/MetadataProvider.java
+++ b/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/declared/MetadataProvider.java
@@ -853,7 +853,8 @@
             Map<String, String> configuration, ARecordType itemType, ARecordType metaType,
             IWarningCollector warningCollector) throws AlgebricksException {
         try {
-            configuration.put(ExternalDataConstants.KEY_DATAVERSE, dataset.getDataverseName().getCanonicalForm());
+            configuration.put(ExternalDataConstants.KEY_DATASET_DATAVERSE,
+                    dataset.getDataverseName().getCanonicalForm());
             ITypedAdapterFactory adapterFactory =
                     AdapterFactoryProvider.getAdapterFactory(getApplicationContext().getServiceContext(), adapterName,
                             configuration, itemType, metaType, warningCollector);
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/typecomputer/impl/FieldAccessByNameResultType.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/typecomputer/impl/FieldAccessByNameResultType.java
index c5373bc..1c4939a 100644
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/typecomputer/impl/FieldAccessByNameResultType.java
+++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/typecomputer/impl/FieldAccessByNameResultType.java
@@ -18,7 +18,6 @@
  */
 package org.apache.asterix.om.typecomputer.impl;
 
-import org.apache.asterix.om.exceptions.TypeMismatchException;
 import org.apache.asterix.om.typecomputer.base.AbstractResultTypeComputer;
 import org.apache.asterix.om.types.ARecordType;
 import org.apache.asterix.om.types.ATypeTag;
@@ -28,8 +27,6 @@
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.base.ILogicalExpression;
 import org.apache.hyracks.algebricks.core.algebra.expressions.AbstractFunctionCallExpression;
-import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.api.exceptions.SourceLocation;
 
 public class FieldAccessByNameResultType extends AbstractResultTypeComputer {
 
@@ -39,18 +36,6 @@
     }
 
     @Override
-    protected void checkArgType(FunctionIdentifier funcId, int argIndex, IAType type, SourceLocation sourceLoc)
-            throws AlgebricksException {
-        ATypeTag actualTypeTag = type.getTypeTag();
-        if (argIndex == 0 && actualTypeTag != ATypeTag.OBJECT) {
-            throw new TypeMismatchException(sourceLoc, actualTypeTag, ATypeTag.OBJECT);
-        }
-        if (argIndex == 1 && actualTypeTag != ATypeTag.STRING) {
-            throw new TypeMismatchException(sourceLoc, actualTypeTag, ATypeTag.STRING);
-        }
-    }
-
-    @Override
     protected IAType getResultType(ILogicalExpression expr, IAType... strippedInputTypes) throws AlgebricksException {
         IAType firstArgType = strippedInputTypes[0];
         if (firstArgType.getTypeTag() != ATypeTag.OBJECT) {
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/records/FieldAccessByNameDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/records/FieldAccessByNameDescriptor.java
index 4b24f4e..c5c7c97 100644
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/records/FieldAccessByNameDescriptor.java
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/records/FieldAccessByNameDescriptor.java
@@ -43,7 +43,7 @@
 
     @Override
     public IScalarEvaluatorFactory createEvaluatorFactory(IScalarEvaluatorFactory[] args) {
-        return new FieldAccessByNameEvalFactory(args[0], args[1], sourceLoc);
+        return new FieldAccessByNameEvalFactory(args[0], args[1], sourceLoc, getIdentifier());
     }
 
 }
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/records/FieldAccessByNameEvalFactory.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/records/FieldAccessByNameEvalFactory.java
index 0d68785..8549292 100644
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/records/FieldAccessByNameEvalFactory.java
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/records/FieldAccessByNameEvalFactory.java
@@ -24,11 +24,12 @@
 import org.apache.asterix.dataflow.data.nontagged.serde.ARecordSerializerDeserializer;
 import org.apache.asterix.formats.nontagged.BinaryComparatorFactoryProvider;
 import org.apache.asterix.formats.nontagged.BinaryHashFunctionFactoryProvider;
+import org.apache.asterix.om.exceptions.ExceptionUtil;
 import org.apache.asterix.om.types.ATypeTag;
 import org.apache.asterix.om.types.EnumDeserializer;
 import org.apache.asterix.om.utils.NonTaggedFormatUtil;
 import org.apache.asterix.runtime.evaluators.functions.PointableHelper;
-import org.apache.asterix.runtime.exceptions.TypeMismatchException;
+import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
 import org.apache.hyracks.algebricks.runtime.base.IEvaluatorContext;
 import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
 import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
@@ -45,15 +46,17 @@
 
     private static final long serialVersionUID = 1L;
 
-    private IScalarEvaluatorFactory recordEvalFactory;
-    private IScalarEvaluatorFactory fldNameEvalFactory;
+    private final IScalarEvaluatorFactory recordEvalFactory;
+    private final IScalarEvaluatorFactory fldNameEvalFactory;
     private final SourceLocation sourceLoc;
+    private final FunctionIdentifier funID;
 
     public FieldAccessByNameEvalFactory(IScalarEvaluatorFactory recordEvalFactory,
-            IScalarEvaluatorFactory fldNameEvalFactory, SourceLocation sourceLoc) {
+            IScalarEvaluatorFactory fldNameEvalFactory, SourceLocation sourceLoc, FunctionIdentifier funID) {
         this.recordEvalFactory = recordEvalFactory;
         this.fldNameEvalFactory = fldNameEvalFactory;
         this.sourceLoc = sourceLoc;
+        this.funID = funID;
     }
 
     @Override
@@ -64,16 +67,13 @@
                     BinaryHashFunctionFactoryProvider.UTF8STRING_POINTABLE_INSTANCE.createBinaryHashFunction();
             private final IBinaryComparator fieldNameComparator =
                     BinaryComparatorFactoryProvider.UTF8STRING_POINTABLE_INSTANCE.createBinaryComparator();
-            private ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
-            private DataOutput out = resultStorage.getDataOutput();
+            private final ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
+            private final DataOutput out = resultStorage.getDataOutput();
 
-            private IPointable inputArg0 = new VoidPointable();
-            private IPointable inputArg1 = new VoidPointable();
-            private IScalarEvaluator eval0 = recordEvalFactory.createScalarEvaluator(ctx);
-            private IScalarEvaluator eval1 = fldNameEvalFactory.createScalarEvaluator(ctx);
-            private int fieldValueOffset;
-            private int fieldValueLength;
-            private ATypeTag fieldValueTypeTag;
+            private final IPointable inputArg0 = new VoidPointable();
+            private final IPointable inputArg1 = new VoidPointable();
+            private final IScalarEvaluator eval0 = recordEvalFactory.createScalarEvaluator(ctx);
+            private final IScalarEvaluator eval1 = fldNameEvalFactory.createScalarEvaluator(ctx);
 
             @Override
             public void evaluate(IFrameTupleReference tuple, IPointable result) throws HyracksDataException {
@@ -91,21 +91,33 @@
                     int serRecordLen = inputArg0.getLength();
 
                     if (serRecord[serRecordOffset] != ATypeTag.SERIALIZED_RECORD_TYPE_TAG) {
-                        throw new TypeMismatchException(sourceLoc, serRecord[serRecordOffset],
-                                ATypeTag.SERIALIZED_RECORD_TYPE_TAG);
+                        ExceptionUtil.warnTypeMismatch(ctx, sourceLoc, funID, serRecord[serRecordOffset], 0,
+                                ATypeTag.OBJECT);
+                        out.writeByte(ATypeTag.SERIALIZED_MISSING_TYPE_TAG);
+                        result.set(resultStorage);
+                        return;
                     }
                     byte[] serFldName = inputArg1.getByteArray();
                     int serFldNameOffset = inputArg1.getStartOffset();
-                    fieldValueOffset = ARecordSerializerDeserializer.getFieldOffsetByName(serRecord, serRecordOffset,
-                            serRecordLen, serFldName, serFldNameOffset, fieldNameHashFunction, fieldNameComparator);
+                    if (serFldName[serFldNameOffset] != ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
+                        ExceptionUtil.warnTypeMismatch(ctx, sourceLoc, funID, serFldName[serFldNameOffset], 1,
+                                ATypeTag.STRING);
+                        out.writeByte(ATypeTag.SERIALIZED_MISSING_TYPE_TAG);
+                        result.set(resultStorage);
+                        return;
+                    }
+                    int fieldValueOffset =
+                            ARecordSerializerDeserializer.getFieldOffsetByName(serRecord, serRecordOffset, serRecordLen,
+                                    serFldName, serFldNameOffset, fieldNameHashFunction, fieldNameComparator);
                     if (fieldValueOffset < 0) {
                         out.writeByte(ATypeTag.SERIALIZED_MISSING_TYPE_TAG);
                         result.set(resultStorage);
                         return;
                     }
 
-                    fieldValueTypeTag = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(serRecord[fieldValueOffset]);
-                    fieldValueLength = NonTaggedFormatUtil.getFieldValueLength(serRecord, fieldValueOffset,
+                    ATypeTag fieldValueTypeTag =
+                            EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(serRecord[fieldValueOffset]);
+                    int fieldValueLength = NonTaggedFormatUtil.getFieldValueLength(serRecord, fieldValueOffset,
                             fieldValueTypeTag, true) + 1;
                     result.set(serRecord, fieldValueOffset, fieldValueLength);
                 } catch (IOException e) {