asterixdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From buyin...@apache.org
Subject [3/4] asterixdb git commit: Support CASE expression in SQL++.
Date Tue, 26 Jul 2016 21:23:23 GMT
http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c8c067c5/asterixdb/asterix-app/src/main/java/org/apache/asterix/file/SecondaryInvertedIndexOperationsHelper.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/main/java/org/apache/asterix/file/SecondaryInvertedIndexOperationsHelper.java b/asterixdb/asterix-app/src/main/java/org/apache/asterix/file/SecondaryInvertedIndexOperationsHelper.java
index 7044205..c2d2f7c 100644
--- a/asterixdb/asterix-app/src/main/java/org/apache/asterix/file/SecondaryInvertedIndexOperationsHelper.java
+++ b/asterixdb/asterix-app/src/main/java/org/apache/asterix/file/SecondaryInvertedIndexOperationsHelper.java
@@ -113,8 +113,8 @@ public class SecondaryInvertedIndexOperationsHelper extends SecondaryIndexOperat
         // Prepare record descriptor used in the assign op, and the optional
         // select op.
         secondaryFieldAccessEvalFactories = new IScalarEvaluatorFactory[numSecondaryKeys + numFilterFields];
-        ISerializerDeserializer[] secondaryRecFields = new ISerializerDeserializer[numPrimaryKeys + numSecondaryKeys
-                + numFilterFields];
+        ISerializerDeserializer[] secondaryRecFields =
+                new ISerializerDeserializer[numPrimaryKeys + numSecondaryKeys + numFilterFields];
         ISerializerDeserializer[] enforcedRecFields = new ISerializerDeserializer[1 + numPrimaryKeys + numFilterFields];
         secondaryTypeTraits = new ITypeTraits[numSecondaryKeys + numPrimaryKeys];
         ITypeTraits[] enforcedTypeTraits = new ITypeTraits[1 + numPrimaryKeys];
@@ -123,8 +123,8 @@ public class SecondaryInvertedIndexOperationsHelper extends SecondaryIndexOperat
         if (numSecondaryKeys > 0) {
             secondaryFieldAccessEvalFactories[0] = FormatUtils.getDefaultFormat().getFieldAccessEvaluatorFactory(
                     isEnforcingKeyTypes ? enforcedItemType : itemType, secondaryKeyFields.get(0), numPrimaryKeys);
-            Pair<IAType, Boolean> keyTypePair = Index.getNonNullableOpenFieldType(secondaryKeyTypes.get(0),
-                    secondaryKeyFields.get(0), itemType);
+            Pair<IAType, Boolean> keyTypePair =
+                    Index.getNonNullableOpenFieldType(secondaryKeyTypes.get(0), secondaryKeyFields.get(0), itemType);
             secondaryKeyType = keyTypePair.first;
             anySecondaryKeyIsNullable = anySecondaryKeyIsNullable || keyTypePair.second;
             ISerializerDeserializer keySerde = serdeProvider.getSerializerDeserializer(secondaryKeyType);
@@ -154,8 +154,8 @@ public class SecondaryInvertedIndexOperationsHelper extends SecondaryIndexOperat
         // Set tokenizer factory.
         // TODO: We might want to expose the hashing option at the AQL level,
         // and add the choice to the index metadata.
-        tokenizerFactory = NonTaggedFormatUtil.getBinaryTokenizerFactory(secondaryKeyType.getTypeTag(), indexType,
-                gramLength);
+        tokenizerFactory =
+                NonTaggedFormatUtil.getBinaryTokenizerFactory(secondaryKeyType.getTypeTag(), indexType, gramLength);
         // Type traits for inverted-list elements. Inverted lists contain
         // primary keys.
         invListsTypeTraits = new ITypeTraits[numPrimaryKeys];
@@ -169,8 +169,8 @@ public class SecondaryInvertedIndexOperationsHelper extends SecondaryIndexOperat
         // For tokenization, sorting and loading.
         // One token (+ optional partitioning field) + primary keys.
         numTokenKeyPairFields = (!isPartitioned) ? 1 + numPrimaryKeys : 2 + numPrimaryKeys;
-        ISerializerDeserializer[] tokenKeyPairFields = new ISerializerDeserializer[numTokenKeyPairFields
-                + numFilterFields];
+        ISerializerDeserializer[] tokenKeyPairFields =
+                new ISerializerDeserializer[numTokenKeyPairFields + numFilterFields];
         ITypeTraits[] tokenKeyPairTypeTraits = new ITypeTraits[numTokenKeyPairFields];
         tokenKeyPairComparatorFactories = new IBinaryComparatorFactory[numTokenKeyPairFields];
         tokenKeyPairFields[0] = serdeProvider.getSerializerDeserializer(secondaryKeyType);
@@ -226,11 +226,11 @@ public class SecondaryInvertedIndexOperationsHelper extends SecondaryIndexOperat
                 localResourceMetadata, LocalResource.LSMInvertedIndexResource);
 
         IIndexDataflowHelperFactory dataflowHelperFactory = createDataflowHelperFactory();
-        LSMInvertedIndexCreateOperatorDescriptor invIndexCreateOp = new LSMInvertedIndexCreateOperatorDescriptor(spec,
-                AsterixRuntimeComponentsProvider.RUNTIME_PROVIDER, secondaryFileSplitProvider,
-                AsterixRuntimeComponentsProvider.RUNTIME_PROVIDER, tokenTypeTraits, tokenComparatorFactories,
-                invListsTypeTraits, primaryComparatorFactories, tokenizerFactory, dataflowHelperFactory,
-                localResourceFactoryProvider, NoOpOperationCallbackFactory.INSTANCE);
+        LSMInvertedIndexCreateOperatorDescriptor invIndexCreateOp =
+                new LSMInvertedIndexCreateOperatorDescriptor(spec, AsterixRuntimeComponentsProvider.RUNTIME_PROVIDER,
+                        secondaryFileSplitProvider, AsterixRuntimeComponentsProvider.RUNTIME_PROVIDER, tokenTypeTraits,
+                        tokenComparatorFactories, invListsTypeTraits, primaryComparatorFactories, tokenizerFactory,
+                        dataflowHelperFactory, localResourceFactoryProvider, NoOpOperationCallbackFactory.INSTANCE);
         AlgebricksPartitionConstraintHelper.setPartitionConstraintInJobSpec(spec, invIndexCreateOp,
                 secondaryPartitionConstraint);
         spec.addRoot(invIndexCreateOp);
@@ -249,12 +249,12 @@ public class SecondaryInvertedIndexOperationsHelper extends SecondaryIndexOperat
         BTreeSearchOperatorDescriptor primaryScanOp = createPrimaryIndexScanOp(spec);
 
         AbstractOperatorDescriptor sourceOp = primaryScanOp;
-        if (isEnforcingKeyTypes) {
+        if (isEnforcingKeyTypes && !enforcedItemType.equals(itemType)) {
             sourceOp = createCastOp(spec, dataset.getDatasetType());
             spec.connect(new OneToOneConnectorDescriptor(spec), primaryScanOp, 0, sourceOp, 0);
         }
-        AlgebricksMetaOperatorDescriptor asterixAssignOp = createAssignOp(spec, sourceOp, numSecondaryKeys,
-                secondaryRecDesc);
+        AlgebricksMetaOperatorDescriptor asterixAssignOp =
+                createAssignOp(spec, sourceOp, numSecondaryKeys, secondaryRecDesc);
 
         // If any of the secondary fields are nullable, then add a select op
         // that filters nulls.
@@ -267,8 +267,8 @@ public class SecondaryInvertedIndexOperationsHelper extends SecondaryIndexOperat
         AbstractOperatorDescriptor tokenizerOp = createTokenizerOp(spec);
 
         // Sort by token + primary keys.
-        ExternalSortOperatorDescriptor sortOp = createSortOp(spec, tokenKeyPairComparatorFactories,
-                tokenKeyPairRecDesc);
+        ExternalSortOperatorDescriptor sortOp =
+                createSortOp(spec, tokenKeyPairComparatorFactories, tokenKeyPairRecDesc);
 
         // Create secondary inverted index bulk load op.
         LSMInvertedIndexBulkLoadOperatorDescriptor invIndexBulkLoadOp = createInvertedIndexBulkLoadOp(spec);
@@ -364,11 +364,11 @@ public class SecondaryInvertedIndexOperationsHelper extends SecondaryIndexOperat
         JobSpecification spec = JobSpecificationUtils.createJobSpecification();
 
         IIndexDataflowHelperFactory dataflowHelperFactory = createDataflowHelperFactory();
-        LSMInvertedIndexCompactOperator compactOp = new LSMInvertedIndexCompactOperator(spec,
-                AsterixRuntimeComponentsProvider.RUNTIME_PROVIDER, secondaryFileSplitProvider,
-                AsterixRuntimeComponentsProvider.RUNTIME_PROVIDER, tokenTypeTraits, tokenComparatorFactories,
-                invListsTypeTraits, primaryComparatorFactories, tokenizerFactory, dataflowHelperFactory,
-                NoOpOperationCallbackFactory.INSTANCE);
+        LSMInvertedIndexCompactOperator compactOp =
+                new LSMInvertedIndexCompactOperator(spec, AsterixRuntimeComponentsProvider.RUNTIME_PROVIDER,
+                        secondaryFileSplitProvider, AsterixRuntimeComponentsProvider.RUNTIME_PROVIDER, tokenTypeTraits,
+                        tokenComparatorFactories, invListsTypeTraits, primaryComparatorFactories, tokenizerFactory,
+                        dataflowHelperFactory, NoOpOperationCallbackFactory.INSTANCE);
         AlgebricksPartitionConstraintHelper.setPartitionConstraintInJobSpec(spec, compactOp,
                 secondaryPartitionConstraint);
 

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c8c067c5/asterixdb/asterix-app/src/main/java/org/apache/asterix/file/SecondaryRTreeOperationsHelper.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/main/java/org/apache/asterix/file/SecondaryRTreeOperationsHelper.java b/asterixdb/asterix-app/src/main/java/org/apache/asterix/file/SecondaryRTreeOperationsHelper.java
index 7c500cf..cc9675d 100644
--- a/asterixdb/asterix-app/src/main/java/org/apache/asterix/file/SecondaryRTreeOperationsHelper.java
+++ b/asterixdb/asterix-app/src/main/java/org/apache/asterix/file/SecondaryRTreeOperationsHelper.java
@@ -112,8 +112,8 @@ public class SecondaryRTreeOperationsHelper extends SecondaryIndexOperationsHelp
                     AqlMetadataProvider.proposeLinearizer(keyType, secondaryComparatorFactories.length),
                     dataset.getDatasetId(), mergePolicyFactory, mergePolicyFactoryProperties, filterTypeTraits,
                     filterCmpFactories, rtreeFields, primaryKeyFields, secondaryFilterFields, isPointMBR);
-            localResourceFactoryProvider = new PersistentLocalResourceFactoryProvider(localResourceMetadata,
-                    LocalResource.LSMRTreeResource);
+            localResourceFactoryProvider =
+                    new PersistentLocalResourceFactoryProvider(localResourceMetadata, LocalResource.LSMRTreeResource);
             indexDataflowHelperFactory = new LSMRTreeWithAntiMatterTuplesDataflowHelperFactory(valueProviderFactories,
                     RTreePolicyType.RTREE, btreeCompFactories,
                     new AsterixVirtualBufferCacheProvider(dataset.getDatasetId()), mergePolicyFactory,
@@ -181,8 +181,8 @@ public class SecondaryRTreeOperationsHelper extends SecondaryIndexOperationsHelp
             throw new AsterixException("Cannot use " + numSecondaryKeys
                     + " fields as a key for the R-tree index. There can be only one field as a key for the R-tree index.");
         }
-        Pair<IAType, Boolean> spatialTypePair = Index.getNonNullableOpenFieldType(secondaryKeyTypes.get(0),
-                secondaryKeyFields.get(0), itemType);
+        Pair<IAType, Boolean> spatialTypePair =
+                Index.getNonNullableOpenFieldType(secondaryKeyTypes.get(0), secondaryKeyFields.get(0), itemType);
         IAType spatialType = spatialTypePair.first;
         anySecondaryKeyIsNullable = spatialTypePair.second;
         if (spatialType == null) {
@@ -192,24 +192,24 @@ public class SecondaryRTreeOperationsHelper extends SecondaryIndexOperationsHelp
         int numDimensions = NonTaggedFormatUtil.getNumDimensions(spatialType.getTypeTag());
         numNestedSecondaryKeyFields = numDimensions * 2;
         int recordColumn = dataset.getDatasetType() == DatasetType.INTERNAL ? numPrimaryKeys : 0;
-        secondaryFieldAccessEvalFactories = metadata.getFormat().createMBRFactory(
-                isEnforcingKeyTypes ? enforcedItemType : itemType, secondaryKeyFields.get(0), recordColumn,
-                numDimensions, filterFieldName);
+        secondaryFieldAccessEvalFactories =
+                metadata.getFormat().createMBRFactory(isEnforcingKeyTypes ? enforcedItemType : itemType,
+                        secondaryKeyFields.get(0), recordColumn, numDimensions, filterFieldName);
         secondaryComparatorFactories = new IBinaryComparatorFactory[numNestedSecondaryKeyFields];
         valueProviderFactories = new IPrimitiveValueProviderFactory[numNestedSecondaryKeyFields];
-        ISerializerDeserializer[] secondaryRecFields = new ISerializerDeserializer[numPrimaryKeys
-                + numNestedSecondaryKeyFields + numFilterFields];
+        ISerializerDeserializer[] secondaryRecFields =
+                new ISerializerDeserializer[numPrimaryKeys + numNestedSecondaryKeyFields + numFilterFields];
         ISerializerDeserializer[] enforcedRecFields = new ISerializerDeserializer[1 + numPrimaryKeys + numFilterFields];
         secondaryTypeTraits = new ITypeTraits[numNestedSecondaryKeyFields + numPrimaryKeys];
         ITypeTraits[] enforcedTypeTraits = new ITypeTraits[1 + numPrimaryKeys];
         IAType nestedKeyType = NonTaggedFormatUtil.getNestedSpatialType(spatialType.getTypeTag());
         keyType = nestedKeyType.getTypeTag();
         for (int i = 0; i < numNestedSecondaryKeyFields; i++) {
-            ISerializerDeserializer keySerde = AqlSerializerDeserializerProvider.INSTANCE
-                    .getSerializerDeserializer(nestedKeyType);
+            ISerializerDeserializer keySerde =
+                    AqlSerializerDeserializerProvider.INSTANCE.getSerializerDeserializer(nestedKeyType);
             secondaryRecFields[i] = keySerde;
-            secondaryComparatorFactories[i] = AqlBinaryComparatorFactoryProvider.INSTANCE
-                    .getBinaryComparatorFactory(nestedKeyType, true);
+            secondaryComparatorFactories[i] =
+                    AqlBinaryComparatorFactoryProvider.INSTANCE.getBinaryComparatorFactory(nestedKeyType, true);
             secondaryTypeTraits[i] = AqlTypeTraitProvider.INSTANCE.getTypeTrait(nestedKeyType);
             valueProviderFactories[i] = AqlPrimitiveValueProviderFactory.INSTANCE;
 
@@ -230,8 +230,8 @@ public class SecondaryRTreeOperationsHelper extends SecondaryIndexOperationsHelp
                 enforcedTypeTraits[i] = IndexingConstants.getTypeTraits(i);
             }
         }
-        enforcedRecFields[numPrimaryKeys] = AqlSerializerDeserializerProvider.INSTANCE
-                .getSerializerDeserializer(itemType);
+        enforcedRecFields[numPrimaryKeys] =
+                AqlSerializerDeserializerProvider.INSTANCE.getSerializerDeserializer(itemType);
         enforcedRecDesc = new RecordDescriptor(enforcedRecFields, enforcedTypeTraits);
         if (numFilterFields > 0) {
             rtreeFields = new int[numNestedSecondaryKeyFields + numPrimaryKeys];
@@ -282,10 +282,10 @@ public class SecondaryRTreeOperationsHelper extends SecondaryIndexOperationsHelp
         JobSpecification spec = JobSpecificationUtils.createJobSpecification();
         boolean temp = dataset.getDatasetDetails().isTemp();
         int[] fieldPermutation = createFieldPermutationForBulkLoadOp(numNestedSecondaryKeyFields);
-        int numNestedSecondaryKeFieldsConsideringPointMBR = isPointMBR ? numNestedSecondaryKeyFields / 2
-                : numNestedSecondaryKeyFields;
-        RecordDescriptor secondaryRecDescConsideringPointMBR = isPointMBR ? secondaryRecDescForPointMBR
-                : secondaryRecDesc;
+        int numNestedSecondaryKeFieldsConsideringPointMBR =
+                isPointMBR ? numNestedSecondaryKeyFields / 2 : numNestedSecondaryKeyFields;
+        RecordDescriptor secondaryRecDescConsideringPointMBR =
+                isPointMBR ? secondaryRecDescForPointMBR : secondaryRecDesc;
         if (dataset.getDatasetType() == DatasetType.INTERNAL) {
             // Create dummy key provider for feeding the primary index scan.
             AbstractOperatorDescriptor keyProviderOp = createDummyKeyProviderOp(spec);
@@ -295,7 +295,7 @@ public class SecondaryRTreeOperationsHelper extends SecondaryIndexOperationsHelp
 
             // Assign op.
             AbstractOperatorDescriptor sourceOp = primaryScanOp;
-            if (isEnforcingKeyTypes) {
+            if (isEnforcingKeyTypes && !enforcedItemType.equals(itemType)) {
                 sourceOp = createCastOp(spec, dataset.getDatasetType());
                 spec.connect(new OneToOneConnectorDescriptor(spec), primaryScanOp, 0, sourceOp, 0);
             }
@@ -310,10 +310,11 @@ public class SecondaryRTreeOperationsHelper extends SecondaryIndexOperationsHelp
             }
 
             // Sort by secondary keys.
-            ExternalSortOperatorDescriptor sortOp = createSortOp(spec,
-                    new IBinaryComparatorFactory[] {
-                            AqlMetadataProvider.proposeLinearizer(keyType, secondaryComparatorFactories.length) },
-                    isPointMBR ? secondaryRecDescForPointMBR : secondaryRecDesc);
+            ExternalSortOperatorDescriptor sortOp =
+                    createSortOp(spec,
+                            new IBinaryComparatorFactory[] { AqlMetadataProvider.proposeLinearizer(keyType,
+                                    secondaryComparatorFactories.length) },
+                            isPointMBR ? secondaryRecDescForPointMBR : secondaryRecDesc);
 
             AsterixStorageProperties storageProperties = propertiesProvider.getStorageProperties();
 
@@ -327,8 +328,8 @@ public class SecondaryRTreeOperationsHelper extends SecondaryIndexOperationsHelp
                     filterTypeTraits, filterCmpFactories, secondaryFilterFields, !temp, isPointMBR);;
 
             // Create secondary RTree bulk load op.
-            TreeIndexBulkLoadOperatorDescriptor secondaryBulkLoadOp = createTreeIndexBulkLoadOp(spec, fieldPermutation,
-                    idff, GlobalConfig.DEFAULT_TREE_FILL_FACTOR);
+            TreeIndexBulkLoadOperatorDescriptor secondaryBulkLoadOp =
+                    createTreeIndexBulkLoadOp(spec, fieldPermutation, idff, GlobalConfig.DEFAULT_TREE_FILL_FACTOR);
             AlgebricksMetaOperatorDescriptor metaOp = new AlgebricksMetaOperatorDescriptor(spec, 1, 0,
                     new IPushRuntimeFactory[] { new SinkRuntimeFactory() }, new RecordDescriptor[] {});
             // Connect the operators.
@@ -353,7 +354,7 @@ public class SecondaryRTreeOperationsHelper extends SecondaryIndexOperationsHelp
             // Create external indexing scan operator
             ExternalDataScanOperatorDescriptor primaryScanOp = createExternalIndexingOp(spec);
             AbstractOperatorDescriptor sourceOp = primaryScanOp;
-            if (isEnforcingKeyTypes) {
+            if (isEnforcingKeyTypes && !enforcedItemType.equals(itemType)) {
                 sourceOp = createCastOp(spec, dataset.getDatasetType());
                 spec.connect(new OneToOneConnectorDescriptor(spec), primaryScanOp, 0, sourceOp, 0);
             }
@@ -369,10 +370,11 @@ public class SecondaryRTreeOperationsHelper extends SecondaryIndexOperationsHelp
             }
 
             // Sort by secondary keys.
-            ExternalSortOperatorDescriptor sortOp = createSortOp(spec,
-                    new IBinaryComparatorFactory[] {
-                            AqlMetadataProvider.proposeLinearizer(keyType, secondaryComparatorFactories.length) },
-                    isPointMBR ? secondaryRecDescForPointMBR : secondaryRecDesc);
+            ExternalSortOperatorDescriptor sortOp =
+                    createSortOp(spec,
+                            new IBinaryComparatorFactory[] { AqlMetadataProvider.proposeLinearizer(keyType,
+                                    secondaryComparatorFactories.length) },
+                            isPointMBR ? secondaryRecDescForPointMBR : secondaryRecDesc);
             AsterixStorageProperties storageProperties = propertiesProvider.getStorageProperties();
 
             // Create the dataflow helper factory
@@ -478,27 +480,27 @@ public class SecondaryRTreeOperationsHelper extends SecondaryIndexOperationsHelp
                     AsterixRuntimeComponentsProvider.RUNTIME_PROVIDER, LSMRTreeIOOperationCallbackFactory.INSTANCE,
                     AqlMetadataProvider.proposeLinearizer(keyType, secondaryComparatorFactories.length), rtreeFields,
                     filterTypeTraits, filterCmpFactories, secondaryFilterFields, !temp, isPointMBR);
-            compactOp = new LSMTreeIndexCompactOperatorDescriptor(spec,
-                    AsterixRuntimeComponentsProvider.RUNTIME_PROVIDER,
-                    AsterixRuntimeComponentsProvider.RUNTIME_PROVIDER, secondaryFileSplitProvider, secondaryTypeTraits,
-                    secondaryComparatorFactories, secondaryBloomFilterKeyFields, idff,
-                    NoOpOperationCallbackFactory.INSTANCE);
+            compactOp =
+                    new LSMTreeIndexCompactOperatorDescriptor(spec, AsterixRuntimeComponentsProvider.RUNTIME_PROVIDER,
+                            AsterixRuntimeComponentsProvider.RUNTIME_PROVIDER, secondaryFileSplitProvider,
+                            secondaryTypeTraits, secondaryComparatorFactories, secondaryBloomFilterKeyFields, idff,
+                            NoOpOperationCallbackFactory.INSTANCE);
         } else {
             // External dataset
-            compactOp = new LSMTreeIndexCompactOperatorDescriptor(spec,
-                    AsterixRuntimeComponentsProvider.RUNTIME_PROVIDER,
-                    AsterixRuntimeComponentsProvider.RUNTIME_PROVIDER, secondaryFileSplitProvider, secondaryTypeTraits,
-                    secondaryComparatorFactories, secondaryBloomFilterKeyFields,
-                    new ExternalRTreeDataflowHelperFactory(valueProviderFactories, RTreePolicyType.RTREE,
-                            primaryComparatorFactories, mergePolicyFactory, mergePolicyFactoryProperties,
-                            new SecondaryIndexOperationTrackerProvider(dataset.getDatasetId()),
-                            AsterixRuntimeComponentsProvider.RUNTIME_PROVIDER,
-                            LSMRTreeIOOperationCallbackFactory.INSTANCE,
-                            AqlMetadataProvider.proposeLinearizer(keyType, secondaryComparatorFactories.length),
-                            storageProperties.getBloomFilterFalsePositiveRate(),
-                            new int[] { numNestedSecondaryKeyFields },
-                            ExternalDatasetsRegistry.INSTANCE.getDatasetVersion(dataset), true, isPointMBR),
-                    NoOpOperationCallbackFactory.INSTANCE);
+            compactOp =
+                    new LSMTreeIndexCompactOperatorDescriptor(spec, AsterixRuntimeComponentsProvider.RUNTIME_PROVIDER,
+                            AsterixRuntimeComponentsProvider.RUNTIME_PROVIDER, secondaryFileSplitProvider,
+                            secondaryTypeTraits, secondaryComparatorFactories, secondaryBloomFilterKeyFields,
+                            new ExternalRTreeDataflowHelperFactory(valueProviderFactories, RTreePolicyType.RTREE,
+                                    primaryComparatorFactories, mergePolicyFactory, mergePolicyFactoryProperties,
+                                    new SecondaryIndexOperationTrackerProvider(dataset.getDatasetId()),
+                                    AsterixRuntimeComponentsProvider.RUNTIME_PROVIDER,
+                                    LSMRTreeIOOperationCallbackFactory.INSTANCE,
+                                    AqlMetadataProvider.proposeLinearizer(keyType, secondaryComparatorFactories.length),
+                                    storageProperties.getBloomFilterFalsePositiveRate(),
+                                    new int[] { numNestedSecondaryKeyFields },
+                                    ExternalDatasetsRegistry.INSTANCE.getDatasetVersion(dataset), true, isPointMBR),
+                            NoOpOperationCallbackFactory.INSTANCE);
         }
 
         AlgebricksPartitionConstraintHelper.setPartitionConstraintInJobSpec(spec, compactOp,

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c8c067c5/asterixdb/asterix-app/src/test/java/org/apache/asterix/runtime/NullMissingTest.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/java/org/apache/asterix/runtime/NullMissingTest.java b/asterixdb/asterix-app/src/test/java/org/apache/asterix/runtime/NullMissingTest.java
index d4b50a4..d30ffd9 100644
--- a/asterixdb/asterix-app/src/test/java/org/apache/asterix/runtime/NullMissingTest.java
+++ b/asterixdb/asterix-app/src/test/java/org/apache/asterix/runtime/NullMissingTest.java
@@ -47,15 +47,15 @@ public class NullMissingTest {
             String className = func.getClass().getName();
             // We test all generated functions except
             // record functions, which requires type settings (we test them in runtime tests);
-            if (className.contains("generated") && !className.contains("record")) {
+            if (className.contains("generated") && !className.contains("record") && !className.contains("Cast")) {
                 testFunction(func);
             }
         }
     }
 
     private void testFunction(IFunctionDescriptorFactory funcFactory) throws Exception {
-        AbstractScalarFunctionDynamicDescriptor funcDesc = (AbstractScalarFunctionDynamicDescriptor) funcFactory
-                .createFunctionDescriptor();
+        AbstractScalarFunctionDynamicDescriptor funcDesc =
+                (AbstractScalarFunctionDynamicDescriptor) funcFactory.createFunctionDescriptor();
         int inputArity = funcDesc.getIdentifier().getArity();
         Iterator<IScalarEvaluatorFactory[]> argEvalFactoryIterator = getArgCombinations(inputArity);
         int index = 0;

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c8c067c5/asterixdb/asterix-app/src/test/resources/optimizerts/queries/tpch/q12_shipping.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/optimizerts/queries/tpch/q12_shipping.sqlpp b/asterixdb/asterix-app/src/test/resources/optimizerts/queries/tpch/q12_shipping.sqlpp
new file mode 100644
index 0000000..b1a8cc1
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/optimizerts/queries/tpch/q12_shipping.sqlpp
@@ -0,0 +1,56 @@
+/*
+ * 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 database tpch IF EXISTS;
+CREATE  database tpch;
+
+USE tpch;
+
+
+CREATE TYPE LineItemType AS {
+  l_linenumber : int32
+}
+
+CREATE TYPE OrderType AS {
+  o_orderkey : int32
+}
+
+CREATE TABLE LineItem(LineItemType) PRIMARY KEY l_linenumber;
+
+CREATE TABLE Orders(OrderType) PRIMARY KEY o_orderkey;
+
+/** The plan tests that the expression for different switch-case branches are not extracted.*/
+SELECT l.l_shipmode,
+       sum(CASE
+             WHEN o.o_orderpriority = '1-URGENT' or o.o_orderpriority = '2-HIGH' THEN 1 +  o.o_orderpriority * 0
+             ELSE 0 + o.o_orderpriority * 0
+           END) high_line_count,
+       sum(CASE o.o_orderpriority = '1-URGENT' or o.o_orderpriority = '2-HIGH'
+             WHEN true THEN 0 + o.o_orderpriority * 0
+             ELSE 1 +  o.o_orderpriority * 0
+           END) low_line_count
+FROM  LineItem l,
+      Orders o
+WHERE o.o_orderkey = l.l_orderkey AND l.l_commitdate < l.l_receiptdate AND
+      l.l_shipdate < l.l_commitdate AND l.l_receiptdate >= '1994-01-01' AND
+      l.l_receiptdate < '1995-01-01' AND (l.l_shipmode = 'MAIL' OR l.l_shipmode = 'SHIP')
+GROUP BY l.l_shipmode
+ORDER BY l.l_shipmode
+;

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c8c067c5/asterixdb/asterix-app/src/test/resources/optimizerts/results/query-ASTERIXDB-1203.plan
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/optimizerts/results/query-ASTERIXDB-1203.plan b/asterixdb/asterix-app/src/test/resources/optimizerts/results/query-ASTERIXDB-1203.plan
index 9dc7a8a..b090c13 100644
--- a/asterixdb/asterix-app/src/test/resources/optimizerts/results/query-ASTERIXDB-1203.plan
+++ b/asterixdb/asterix-app/src/test/resources/optimizerts/results/query-ASTERIXDB-1203.plan
@@ -16,7 +16,8 @@
                                     -- ASSIGN  |LOCAL|
                                       -- ASSIGN  |LOCAL|
                                         -- STREAM_SELECT  |LOCAL|
-                                          -- NESTED_TUPLE_SOURCE  |LOCAL|
+                                          -- ASSIGN  |LOCAL|
+                                            -- NESTED_TUPLE_SOURCE  |LOCAL|
                         }
                   -- SUBPLAN  |PARTITIONED|
                           {

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c8c067c5/asterixdb/asterix-app/src/test/resources/optimizerts/results/query-ASTERIXDB-865.plan
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/optimizerts/results/query-ASTERIXDB-865.plan b/asterixdb/asterix-app/src/test/resources/optimizerts/results/query-ASTERIXDB-865.plan
index 6ff5cee..914a23b 100644
--- a/asterixdb/asterix-app/src/test/resources/optimizerts/results/query-ASTERIXDB-865.plan
+++ b/asterixdb/asterix-app/src/test/resources/optimizerts/results/query-ASTERIXDB-865.plan
@@ -17,7 +17,8 @@
                                       -- UNNEST  |LOCAL|
                                         -- ASSIGN  |LOCAL|
                                           -- STREAM_SELECT  |LOCAL|
-                                            -- NESTED_TUPLE_SOURCE  |LOCAL|
+                                            -- ASSIGN  |LOCAL|
+                                              -- NESTED_TUPLE_SOURCE  |LOCAL|
                               }
                         -- SUBPLAN  |PARTITIONED|
                                 {

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c8c067c5/asterixdb/asterix-app/src/test/resources/optimizerts/results/tpch/q12_shipping.plan
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/optimizerts/results/tpch/q12_shipping.plan b/asterixdb/asterix-app/src/test/resources/optimizerts/results/tpch/q12_shipping.plan
new file mode 100644
index 0000000..7c1af83
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/optimizerts/results/tpch/q12_shipping.plan
@@ -0,0 +1,43 @@
+-- DISTRIBUTE_RESULT  |PARTITIONED|
+  -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+    -- STREAM_PROJECT  |PARTITIONED|
+      -- ASSIGN  |PARTITIONED|
+        -- SORT_MERGE_EXCHANGE [$$3(ASC) ]  |PARTITIONED|
+          -- PRE_CLUSTERED_GROUP_BY[$$94]  |PARTITIONED|
+                  {
+                    -- AGGREGATE  |LOCAL|
+                      -- NESTED_TUPLE_SOURCE  |LOCAL|
+                  }
+            -- HASH_PARTITION_MERGE_EXCHANGE MERGE:[$$94(ASC)] HASH:[$$94]  |PARTITIONED|
+              -- SORT_GROUP_BY[$$76]  |PARTITIONED|
+                      {
+                        -- AGGREGATE  |LOCAL|
+                          -- NESTED_TUPLE_SOURCE  |LOCAL|
+                      }
+                -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+                  -- STREAM_PROJECT  |PARTITIONED|
+                    -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+                      -- HYBRID_HASH_JOIN [$$83][$$76]  |PARTITIONED|
+                        -- HASH_PARTITION_EXCHANGE [$$83]  |PARTITIONED|
+                          -- UNNEST  |UNPARTITIONED|
+                            -- EMPTY_TUPLE_SOURCE  |UNPARTITIONED|
+                        -- HASH_PARTITION_EXCHANGE [$$76]  |PARTITIONED|
+                          -- STREAM_PROJECT  |PARTITIONED|
+                            -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+                              -- HYBRID_HASH_JOIN [$$85][$$80]  |PARTITIONED|
+                                -- HASH_PARTITION_EXCHANGE [$$85]  |PARTITIONED|
+                                  -- STREAM_PROJECT  |PARTITIONED|
+                                    -- STREAM_SELECT  |PARTITIONED|
+                                      -- ASSIGN  |PARTITIONED|
+                                        -- STREAM_PROJECT  |PARTITIONED|
+                                          -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+                                            -- DATASOURCE_SCAN  |PARTITIONED|
+                                              -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+                                                -- EMPTY_TUPLE_SOURCE  |PARTITIONED|
+                                -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+                                  -- STREAM_PROJECT  |PARTITIONED|
+                                    -- ASSIGN  |PARTITIONED|
+                                      -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+                                        -- DATASOURCE_SCAN  |PARTITIONED|
+                                          -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
+                                            -- EMPTY_TUPLE_SOURCE  |PARTITIONED|

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c8c067c5/asterixdb/asterix-app/src/test/resources/parserts/queries_sqlpp/IfInFLOWGR.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/parserts/queries_sqlpp/IfInFLOWGR.sqlpp b/asterixdb/asterix-app/src/test/resources/parserts/queries_sqlpp/IfInFLOWGR.sqlpp
index 294730f..1945567 100644
--- a/asterixdb/asterix-app/src/test/resources/parserts/queries_sqlpp/IfInFLOWGR.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/parserts/queries_sqlpp/IfInFLOWGR.sqlpp
@@ -17,9 +17,10 @@
  * under the License.
  */
 
-select element if ((i > j))
-    then i
+select element
+    case when i > j then i
     else j
+    end
 from  [1,2,30,40] as i,
       {{4,5,6}} as j
 ;

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c8c067c5/asterixdb/asterix-app/src/test/resources/parserts/queries_sqlpp/IfThenElse.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/parserts/queries_sqlpp/IfThenElse.sqlpp b/asterixdb/asterix-app/src/test/resources/parserts/queries_sqlpp/IfThenElse.sqlpp
index f346d1a..877c27a 100644
--- a/asterixdb/asterix-app/src/test/resources/parserts/queries_sqlpp/IfThenElse.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/parserts/queries_sqlpp/IfThenElse.sqlpp
@@ -17,6 +17,8 @@
  * under the License.
  */
 
-select element if ((2 > 1))
-    then 20
-    else 10;
+select element
+    case 2 > 1
+    when true then 20
+    else 10
+    end;

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c8c067c5/asterixdb/asterix-app/src/test/resources/parserts/queries_sqlpp/functionDecl2.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/parserts/queries_sqlpp/functionDecl2.sqlpp b/asterixdb/asterix-app/src/test/resources/parserts/queries_sqlpp/functionDecl2.sqlpp
index ddda48e..8c5e82a 100644
--- a/asterixdb/asterix-app/src/test/resources/parserts/queries_sqlpp/functionDecl2.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/parserts/queries_sqlpp/functionDecl2.sqlpp
@@ -18,7 +18,7 @@
  */
 
 declare function GT(a,b) {
-if ((a > b))
-    then true
+    case when a > b then true
     else false
+    end
 };

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c8c067c5/asterixdb/asterix-app/src/test/resources/parserts/queries_sqlpp/nestedFLWOGR1.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/parserts/queries_sqlpp/nestedFLWOGR1.sqlpp b/asterixdb/asterix-app/src/test/resources/parserts/queries_sqlpp/nestedFLWOGR1.sqlpp
index 704f348..7449562 100644
--- a/asterixdb/asterix-app/src/test/resources/parserts/queries_sqlpp/nestedFLWOGR1.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/parserts/queries_sqlpp/nestedFLWOGR1.sqlpp
@@ -19,9 +19,10 @@
 
 select element (
     select element k
-    from  if ((i > j))
-        then i
-        else j as k
+    from  case i > j
+            when true then i
+            else j
+          end as k
     where (k < 10)
 )
 from  [1,2,30,40] as i,

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c8c067c5/asterixdb/asterix-app/src/test/resources/parserts/queries_sqlpp/nestedFLWOGR2.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/parserts/queries_sqlpp/nestedFLWOGR2.sqlpp b/asterixdb/asterix-app/src/test/resources/parserts/queries_sqlpp/nestedFLWOGR2.sqlpp
index 0abbf80..13e0259 100644
--- a/asterixdb/asterix-app/src/test/resources/parserts/queries_sqlpp/nestedFLWOGR2.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/parserts/queries_sqlpp/nestedFLWOGR2.sqlpp
@@ -19,9 +19,11 @@
 
 select element (
     select element k
-    from  if ((i > j))
-        then i
-        else j as k
+    from  case
+           when i > j then i
+           else j
+          end
+          as k
     where (k < 10)
 )
 from  [1,2,30,(

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c8c067c5/asterixdb/asterix-app/src/test/resources/parserts/results_parser_sqlpp/IfInFLOWGR.ast
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/parserts/results_parser_sqlpp/IfInFLOWGR.ast b/asterixdb/asterix-app/src/test/resources/parserts/results_parser_sqlpp/IfInFLOWGR.ast
index 947c2d4..58fe98b 100644
--- a/asterixdb/asterix-app/src/test/resources/parserts/results_parser_sqlpp/IfInFLOWGR.ast
+++ b/asterixdb/asterix-app/src/test/resources/parserts/results_parser_sqlpp/IfInFLOWGR.ast
@@ -1,17 +1,17 @@
 Query:
 SELECT ELEMENT [
-IfExpr [
-  Condition:
-    OperatorExpr [
+CASE    LiteralExpr [TRUE]
+
+WHEN     OperatorExpr [
       Variable [ Name=$i ]
       >
       Variable [ Name=$j ]
     ]
-  Then:
-    Variable [ Name=$i ]
-  Else:
-    Variable [ Name=$j ]
-]
+THEN     Variable [ Name=$i ]
+
+ELSE     Variable [ Name=$j ]
+
+END
 ]
 FROM [  OrderedListConstructor [
     LiteralExpr [LONG] [1]

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c8c067c5/asterixdb/asterix-app/src/test/resources/parserts/results_parser_sqlpp/IfThenElse.ast
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/parserts/results_parser_sqlpp/IfThenElse.ast b/asterixdb/asterix-app/src/test/resources/parserts/results_parser_sqlpp/IfThenElse.ast
index 8c3462e..cf95780 100644
--- a/asterixdb/asterix-app/src/test/resources/parserts/results_parser_sqlpp/IfThenElse.ast
+++ b/asterixdb/asterix-app/src/test/resources/parserts/results_parser_sqlpp/IfThenElse.ast
@@ -1,15 +1,15 @@
 Query:
 SELECT ELEMENT [
-IfExpr [
-  Condition:
-    OperatorExpr [
+CASE    OperatorExpr [
       LiteralExpr [LONG] [2]
       >
       LiteralExpr [LONG] [1]
     ]
-  Then:
-    LiteralExpr [LONG] [20]
-  Else:
-    LiteralExpr [LONG] [10]
-]
+
+WHEN     LiteralExpr [TRUE]
+THEN     LiteralExpr [LONG] [20]
+
+ELSE     LiteralExpr [LONG] [10]
+
+END
 ]

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c8c067c5/asterixdb/asterix-app/src/test/resources/parserts/results_parser_sqlpp/functionDecl2.ast
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/parserts/results_parser_sqlpp/functionDecl2.ast b/asterixdb/asterix-app/src/test/resources/parserts/results_parser_sqlpp/functionDecl2.ast
index de37697..33b1f55 100644
--- a/asterixdb/asterix-app/src/test/resources/parserts/results_parser_sqlpp/functionDecl2.ast
+++ b/asterixdb/asterix-app/src/test/resources/parserts/results_parser_sqlpp/functionDecl2.ast
@@ -1,15 +1,15 @@
 FunctionDecl GT([$a, $b]) {
-  IfExpr [
-    Condition:
-      OperatorExpr [
+  CASE      LiteralExpr [TRUE]
+
+  WHEN       OperatorExpr [
         Variable [ Name=$a ]
         >
         Variable [ Name=$b ]
       ]
-    Then:
-      LiteralExpr [TRUE]
-    Else:
-      LiteralExpr [FALSE]
-  ]
+  THEN       LiteralExpr [TRUE]
+
+  ELSE       LiteralExpr [FALSE]
+
+  END
 }
 

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c8c067c5/asterixdb/asterix-app/src/test/resources/parserts/results_parser_sqlpp/nestedFLWOGR1.ast
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/parserts/results_parser_sqlpp/nestedFLWOGR1.ast b/asterixdb/asterix-app/src/test/resources/parserts/results_parser_sqlpp/nestedFLWOGR1.ast
index 2af8be1..42831c4 100644
--- a/asterixdb/asterix-app/src/test/resources/parserts/results_parser_sqlpp/nestedFLWOGR1.ast
+++ b/asterixdb/asterix-app/src/test/resources/parserts/results_parser_sqlpp/nestedFLWOGR1.ast
@@ -4,18 +4,18 @@ SELECT ELEMENT [
   SELECT ELEMENT [
   Variable [ Name=$k ]
   ]
-  FROM [    IfExpr [
-      Condition:
-        OperatorExpr [
+  FROM [    CASE        OperatorExpr [
           Variable [ Name=$i ]
           >
           Variable [ Name=$j ]
         ]
-      Then:
-        Variable [ Name=$i ]
-      Else:
-        Variable [ Name=$j ]
-    ]
+
+    WHEN         LiteralExpr [TRUE]
+    THEN         Variable [ Name=$i ]
+
+    ELSE         Variable [ Name=$j ]
+
+    END
     AS Variable [ Name=$k ]
   ]
   Where

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c8c067c5/asterixdb/asterix-app/src/test/resources/parserts/results_parser_sqlpp/nestedFLWOGR2.ast
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/parserts/results_parser_sqlpp/nestedFLWOGR2.ast b/asterixdb/asterix-app/src/test/resources/parserts/results_parser_sqlpp/nestedFLWOGR2.ast
index 5e5ac9a..60f5465 100644
--- a/asterixdb/asterix-app/src/test/resources/parserts/results_parser_sqlpp/nestedFLWOGR2.ast
+++ b/asterixdb/asterix-app/src/test/resources/parserts/results_parser_sqlpp/nestedFLWOGR2.ast
@@ -4,18 +4,18 @@ SELECT ELEMENT [
   SELECT ELEMENT [
   Variable [ Name=$k ]
   ]
-  FROM [    IfExpr [
-      Condition:
-        OperatorExpr [
+  FROM [    CASE        LiteralExpr [TRUE]
+
+    WHEN         OperatorExpr [
           Variable [ Name=$i ]
           >
           Variable [ Name=$j ]
         ]
-      Then:
-        Variable [ Name=$i ]
-      Else:
-        Variable [ Name=$j ]
-    ]
+    THEN         Variable [ Name=$i ]
+
+    ELSE         Variable [ Name=$j ]
+
+    END
     AS Variable [ Name=$k ]
   ]
   Where

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

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c8c067c5/asterixdb/asterix-app/src/test/resources/runtimets/queries/misc/query-ASTERIXDB-819-2/query-ASTERIXDB-819-2.1.query.aql
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries/misc/query-ASTERIXDB-819-2/query-ASTERIXDB-819-2.1.query.aql b/asterixdb/asterix-app/src/test/resources/runtimets/queries/misc/query-ASTERIXDB-819-2/query-ASTERIXDB-819-2.1.query.aql
new file mode 100644
index 0000000..a8b3789
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries/misc/query-ASTERIXDB-819-2/query-ASTERIXDB-819-2.1.query.aql
@@ -0,0 +1,23 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+if (1!=1.0) then
+"result"
+else
+{ "type": "object" }

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

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c8c067c5/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/misc/case_01/case_01.1.query.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/misc/case_01/case_01.1.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/misc/case_01/case_01.1.query.sqlpp
new file mode 100644
index 0000000..c2a4cea
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/misc/case_01/case_01.1.query.sqlpp
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+SELECT
+  CASE t
+    WHEN 0 THEN 0.0
+    WHEN NULL THEN -1
+    WHEN MISSING THEN -2
+    ELSE 2.0/t
+  END
+FROM [0, 1, 2, 4, NULL, [0][-1]] t;
+

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c8c067c5/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/misc/case_02/case_02.1.query.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/misc/case_02/case_02.1.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/misc/case_02/case_02.1.query.sqlpp
new file mode 100644
index 0000000..ab19bcb
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/misc/case_02/case_02.1.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.
+ */
+
+SELECT
+  CASE
+    WHEN t=0 THEN 0.0
+    WHEN t IS NULL THEN -1
+    WHEN t IS MISSING THEN -2
+    ELSE 2.0/t
+  END
+FROM [0, 1, 2, 4, NULL, [0][-1]] t;
+
+

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c8c067c5/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/misc/case_03/case_03.1.query.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/misc/case_03/case_03.1.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/misc/case_03/case_03.1.query.sqlpp
new file mode 100644
index 0000000..7c3e566
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/misc/case_03/case_03.1.query.sqlpp
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+SELECT
+  CASE
+    WHEN t = 0 THEN (SELECT 0 AS r)
+    WHEN t IS NULL THEN (SELECT -1 AS r)
+    WHEN t IS MISSING THEN (SELECT -2 AS r)
+    ELSE (SELECT -3 AS r)
+  END
+FROM [0, 1, 2, 4, NULL, [0][-1]] t;
+

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c8c067c5/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/misc/case_04/case_04.1.query.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/misc/case_04/case_04.1.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/misc/case_04/case_04.1.query.sqlpp
new file mode 100644
index 0000000..154e611
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/misc/case_04/case_04.1.query.sqlpp
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+SELECT
+  CASE
+    WHEN t = 0 THEN [0]
+    WHEN t IS NULL THEN (SELECT -1)
+    WHEN t IS MISSING THEN (SELECT -2)
+    ELSE 2.0/t
+  END
+FROM [0, 1, 2, 4, NULL, [0][-1]] t;
+

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c8c067c5/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/misc/case_05/case_05.1.query.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/misc/case_05/case_05.1.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/misc/case_05/case_05.1.query.sqlpp
new file mode 100644
index 0000000..32030a7
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/misc/case_05/case_05.1.query.sqlpp
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+SELECT
+  CASE
+    WHEN t = 0 THEN [0]
+    WHEN t IS NULL THEN (SELECT -1)
+    WHEN t IS MISSING THEN (SELECT -2)
+    WHEN t =1 THEN NULL
+    WHEN t=2 THEN MISSING
+    ELSE 2.0/t
+  END
+FROM [0, 1, 2, 4, NULL, [0][-1]] t;
+

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c8c067c5/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/misc/case_06/case_06.1.query.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/misc/case_06/case_06.1.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/misc/case_06/case_06.1.query.sqlpp
new file mode 100644
index 0000000..5bf2786
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/misc/case_06/case_06.1.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.
+ */
+
+SELECT
+  CASE
+    WHEN t = 0 THEN MISSING
+    ELSE NULL
+  END
+FROM [0, 1, 2, 4, NULL, [0][-1]] t;
+

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c8c067c5/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/misc/case_07/case_07.1.query.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/misc/case_07/case_07.1.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/misc/case_07/case_07.1.query.sqlpp
new file mode 100644
index 0000000..4850047
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/misc/case_07/case_07.1.query.sqlpp
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+SELECT
+  CASE
+    WHEN t = 0 THEN [0]
+    WHEN t IS NULL THEN (SELECT -1)
+    WHEN t IS MISSING THEN (SELECT -2)
+    WHEN t =1 THEN NULL
+    WHEN t=2 THEN MISSING
+    WHEN t IS UNKNOWN THEN (SELECT -3) // Should never enter this THEN branch.
+    ELSE 2.0/t
+  END
+FROM [0, 1, 2, 4, NULL, [0][-1]] t;

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c8c067c5/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/misc/ifthenelse_01/ifthenelse_01.3.query.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/misc/ifthenelse_01/ifthenelse_01.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/misc/ifthenelse_01/ifthenelse_01.3.query.sqlpp
index 609ec27..e96b458 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/misc/ifthenelse_01/ifthenelse_01.3.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/misc/ifthenelse_01/ifthenelse_01.3.query.sqlpp
@@ -17,9 +17,13 @@
  * under the License.
  */
 
-use test;
+USE test;
 
 
-select element if ((2 > 1))
-    then 20
-    else 10;
+SELECT ELEMENT
+    CASE 2>1
+     WHEN TRUE THEN 20
+     ELSE 10
+    END
+;
+

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c8c067c5/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/open-closed/query-issue258/query-issue258.2.update.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/open-closed/query-issue258/query-issue258.2.update.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/open-closed/query-issue258/query-issue258.2.update.sqlpp
index b662786..2b009ae 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/open-closed/query-issue258/query-issue258.2.update.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/open-closed/query-issue258/query-issue258.2.update.sqlpp
@@ -23,14 +23,16 @@
  * Date         : 21 May 2013
  */
 
-use test;
+USE test;
 
 
-insert into ds1
-if ((coll_count((
+INSERT INTO ds1
+CASE
+  WHEN coll_count((
       select element x
       from  ds2 as x
       where (x.id = 10)
-  )) <= 0))
-then {'id':10}
-else {'id':5};
+  )) <= 0
+  THEN {'id':10}
+  ELSE {'id':5}
+END;

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c8c067c5/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-like/q08_national_market_share/q08_national_market_share.3.query.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-like/q08_national_market_share/q08_national_market_share.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-like/q08_national_market_share/q08_national_market_share.3.query.sqlpp
index 3c1a921..a8b4bac 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-like/q08_national_market_share/q08_national_market_share.3.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-like/q08_national_market_share/q08_national_market_share.3.query.sqlpp
@@ -21,7 +21,7 @@ use tpch;
 
 
 select element {'year':year,'mkt_share':(tpch.coll_sum((
-          select element tpch.`switch-case`((i.s_name = 'BRAZIL'),true,i.revenue,false,0.0)
+          select element case when i.s_name = 'BRAZIL' then i.revenue else 0.0 end
           from  t as i
       )) / tpch.coll_sum((
           select element i.revenue

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c8c067c5/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-like/q12_shipping/q12_shipping.3.query.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-like/q12_shipping/q12_shipping.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-like/q12_shipping/q12_shipping.3.query.sqlpp
index 879f936..c576c6c 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-like/q12_shipping/q12_shipping.3.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-like/q12_shipping/q12_shipping.3.query.sqlpp
@@ -21,10 +21,16 @@ use tpch;
 
 
 select element {'l_shipmode':l_shipmode,'high_line_count':tpch.coll_sum((
-        select element tpch.`switch-case`(((i.o_orderpriority = '1-URGENT') or (i.o_orderpriority = '2-HIGH')),true,1,false,0)
+        select element case i.o_orderpriority = '1-URGENT' or i.o_orderpriority = '2-HIGH'
+                       when true then 1
+                       when false then 0
+                       end
         from  o as i
     )),'low_line_count':tpch.coll_sum((
-        select element tpch.`switch-case`(((i.o_orderpriority = '1-URGENT') or (i.o_orderpriority = '2-HIGH')),true,0,false,1)
+        select element case i.o_orderpriority = '1-URGENT' or i.o_orderpriority = '2-HIGH'
+                       when true then 0
+                       when false then 1
+                       end
         from  o as i
     ))}
 from  LineItem as l,

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c8c067c5/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-like/q14_promotion_effect/q14_promotion_effect.3.query.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-like/q14_promotion_effect/q14_promotion_effect.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-like/q14_promotion_effect/q14_promotion_effect.3.query.sqlpp
index eb556b1..7a14b25 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-like/q14_promotion_effect/q14_promotion_effect.3.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-like/q14_promotion_effect/q14_promotion_effect.3.query.sqlpp
@@ -21,7 +21,10 @@ use tpch;
 
 
 select element (100.0 * tpch.coll_sum((
-      select element tpch.`switch-case`(i.p_type like 'PROMO%',true,(i.l_extendedprice * (1 - i.l_discount)),false,0.0)
+      select element case i.p_type like 'PROMO%'
+                     when true then i.l_extendedprice * (1 - i.l_discount)
+                     when false then 0.0
+                     end
       from  lp as i
   )) / tpch.coll_sum((
       select element (i.l_extendedprice * (1 - i.l_discount))

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c8c067c5/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-sugar/q08_national_market_share/q08_national_market_share.3.query.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-sugar/q08_national_market_share/q08_national_market_share.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-sugar/q08_national_market_share/q08_national_market_share.3.query.sqlpp
index df23284..3c69b1c 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-sugar/q08_national_market_share/q08_national_market_share.3.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-sugar/q08_national_market_share/q08_national_market_share.3.query.sqlpp
@@ -21,8 +21,7 @@ USE tpch;
 
 
 SELECT  year,
-        sum( `switch-case`(s_name = 'BRAZIL', true, revenue, false, 0.0) )
-        / sum(revenue) AS mkt_share
+        SUM( CASE s_name = 'BRAZIL' WHEN true THEN revenue ELSE 0.0 END ) / SUM(revenue) AS mkt_share
 FROM  (
         SELECT o_year AS year,
                l_extendedprice * (1 - l_discount) AS revenue,

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c8c067c5/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-sugar/q12_shipping/q12_shipping.3.query.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-sugar/q12_shipping/q12_shipping.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-sugar/q12_shipping/q12_shipping.3.query.sqlpp
index 0d778e4..5d0378a 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-sugar/q12_shipping/q12_shipping.3.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-sugar/q12_shipping/q12_shipping.3.query.sqlpp
@@ -17,12 +17,12 @@
  * under the License.
  */
 
-use tpch;
+USE tpch;
 
 
 SELECT l_shipmode,
-       sum(`switch-case`(o_orderpriority = '1-URGENT' or o_orderpriority = '2-HIGH',true,1,false,0)) high_line_count,
-       sum(`switch-case`(o_orderpriority = '1-URGENT' or o_orderpriority = '2-HIGH',true,0,false,1)) low_line_count
+       sum(CASE WHEN o_orderpriority = '1-URGENT' or o_orderpriority = '2-HIGH' THEN 1 ELSE 0 END) high_line_count,
+       sum(CASE o_orderpriority = '1-URGENT' or o_orderpriority = '2-HIGH' WHEN true THEN 0 ELSE 1 END) low_line_count
 FROM  LineItem,
       Orders
 WHERE o_orderkey = l_orderkey AND l_commitdate < l_receiptdate AND

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c8c067c5/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-sugar/q14_promotion_effect/q14_promotion_effect.3.query.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-sugar/q14_promotion_effect/q14_promotion_effect.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-sugar/q14_promotion_effect/q14_promotion_effect.3.query.sqlpp
index 1c10baf..d359369 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-sugar/q14_promotion_effect/q14_promotion_effect.3.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-sugar/q14_promotion_effect/q14_promotion_effect.3.query.sqlpp
@@ -20,9 +20,9 @@
 use tpch;
 
 
-select element 100.0 *
-     sum(`switch-case`(p_type LIKE 'PROMO%',true, l_extendedprice * (1 - l_discount), false, 0.0))
-     / sum(l_extendedprice * (1 - l_discount))
+SELECT ELEMENT 100.0 *
+     SUM( CASE WHEN p_type LIKE 'PROMO%' THEN l_extendedprice * (1 - l_discount) ELSE 0.0 END )
+     / SUM(l_extendedprice * (1 - l_discount))
 FROM  LineItem,
       Part
 WHERE l_partkey = p_partkey AND l_shipdate >= '1995-09-01' AND l_shipdate < '1995-10-01'

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c8c067c5/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q08_national_market_share/q08_national_market_share.3.query.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q08_national_market_share/q08_national_market_share.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q08_national_market_share/q08_national_market_share.3.query.sqlpp
index 89afd7d..52fd1eb 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q08_national_market_share/q08_national_market_share.3.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q08_national_market_share/q08_national_market_share.3.query.sqlpp
@@ -21,7 +21,7 @@ USE tpch;
 
 
 SELECT  year AS year,
-        sum( `switch-case`(t.s_name = 'BRAZIL', true, t.revenue, false, 0.0) )
+        sum( case when t.s_name = 'BRAZIL' then t.revenue else 0.0 end )
         / sum(t.revenue) AS mkt_share
 FROM  (
         SELECT o_year AS year,

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c8c067c5/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q12_shipping/q12_shipping.3.query.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q12_shipping/q12_shipping.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q12_shipping/q12_shipping.3.query.sqlpp
index 3be8e22..227a576 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q12_shipping/q12_shipping.3.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q12_shipping/q12_shipping.3.query.sqlpp
@@ -21,8 +21,8 @@ use tpch;
 
 
 SELECT l_shipmode l_shipmode,
-       sum(`switch-case`(o.o_orderpriority = '1-URGENT' or o.o_orderpriority = '2-HIGH',true,1,false,0)) high_line_count,
-       sum(`switch-case`(o.o_orderpriority = '1-URGENT' or o.o_orderpriority = '2-HIGH',true,0,false,1)) low_line_count
+       sum(case when o.o_orderpriority = '1-URGENT' or o.o_orderpriority = '2-HIGH' then 1 else 0 end) high_line_count,
+       sum(case when o.o_orderpriority = '1-URGENT' or o.o_orderpriority = '2-HIGH' then 0 else 1 end) low_line_count
 FROM  LineItem l,
       Orders o
 WHERE o.o_orderkey = l.l_orderkey AND l.l_commitdate < l.l_receiptdate AND

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c8c067c5/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q14_promotion_effect/q14_promotion_effect.3.query.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q14_promotion_effect/q14_promotion_effect.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q14_promotion_effect/q14_promotion_effect.3.query.sqlpp
index dc26e42..0d11017 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q14_promotion_effect/q14_promotion_effect.3.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/q14_promotion_effect/q14_promotion_effect.3.query.sqlpp
@@ -21,7 +21,7 @@ use tpch;
 
 
 select element 100.0 *
-     sum(`switch-case`(p.p_type like 'PROMO%',true,(l.l_extendedprice * (1 - l.l_discount)),false,0.0))
+     sum( case when p.p_type like 'PROMO%' then l.l_extendedprice * (1 - l.l_discount) else 0.0 end)
      / sum(l.l_extendedprice * (1 - l.l_discount))
 FROM  LineItem l,
       Part p

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c8c067c5/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q08_national_market_share/q08_national_market_share.3.query.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q08_national_market_share/q08_national_market_share.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q08_national_market_share/q08_national_market_share.3.query.sqlpp
index 3c1a921..b9b739d 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q08_national_market_share/q08_national_market_share.3.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q08_national_market_share/q08_national_market_share.3.query.sqlpp
@@ -21,7 +21,7 @@ use tpch;
 
 
 select element {'year':year,'mkt_share':(tpch.coll_sum((
-          select element tpch.`switch-case`((i.s_name = 'BRAZIL'),true,i.revenue,false,0.0)
+          select element case i.s_name = 'BRAZIL' when true then i.revenue when false then 0.0 end
           from  t as i
       )) / tpch.coll_sum((
           select element i.revenue

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c8c067c5/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q12_shipping/q12_shipping.3.query.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q12_shipping/q12_shipping.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q12_shipping/q12_shipping.3.query.sqlpp
index 879f936..395279b 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q12_shipping/q12_shipping.3.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q12_shipping/q12_shipping.3.query.sqlpp
@@ -21,10 +21,16 @@ use tpch;
 
 
 select element {'l_shipmode':l_shipmode,'high_line_count':tpch.coll_sum((
-        select element tpch.`switch-case`(((i.o_orderpriority = '1-URGENT') or (i.o_orderpriority = '2-HIGH')),true,1,false,0)
+        select element case
+                        when i.o_orderpriority = '1-URGENT' or i.o_orderpriority = '2-HIGH' then 1
+                        else 0
+                        end
         from  o as i
     )),'low_line_count':tpch.coll_sum((
-        select element tpch.`switch-case`(((i.o_orderpriority = '1-URGENT') or (i.o_orderpriority = '2-HIGH')),true,0,false,1)
+        select element case
+                         when i.o_orderpriority = '1-URGENT' or i.o_orderpriority = '2-HIGH' then 0
+                         else 1
+                        end
         from  o as i
     ))}
 from  LineItem as l,

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c8c067c5/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q14_promotion_effect/q14_promotion_effect.3.query.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q14_promotion_effect/q14_promotion_effect.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q14_promotion_effect/q14_promotion_effect.3.query.sqlpp
index eb556b1..5de0352 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q14_promotion_effect/q14_promotion_effect.3.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q14_promotion_effect/q14_promotion_effect.3.query.sqlpp
@@ -21,7 +21,10 @@ use tpch;
 
 
 select element (100.0 * tpch.coll_sum((
-      select element tpch.`switch-case`(i.p_type like 'PROMO%',true,(i.l_extendedprice * (1 - i.l_discount)),false,0.0)
+      select element case
+                       when i.p_type like 'PROMO%' then i.l_extendedprice * (1 - i.l_discount)
+                       else 0.0
+                     end
       from  lp as i
   )) / tpch.coll_sum((
       select element (i.l_extendedprice * (1 - i.l_discount))

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c8c067c5/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/q08_national_market_share/q08_national_market_share.3.query.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/q08_national_market_share/q08_national_market_share.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/q08_national_market_share/q08_national_market_share.3.query.sqlpp
index aaef8e5..70b59e0 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/q08_national_market_share/q08_national_market_share.3.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/q08_national_market_share/q08_national_market_share.3.query.sqlpp
@@ -21,7 +21,7 @@ use tpch;
 
 
 select element {'year':year,'mkt_share':(COLL_SUM((
-          select element tpch.`switch-case`((i.s_name = 'BRAZIL'),true,i.revenue,false,0.0)
+          select element case i.s_name = 'BRAZIL' when true then i.revenue when false then 0.0 end
           from  t as i
       )) / COLL_SUM((
           select element i.revenue

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c8c067c5/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/q12_shipping/q12_shipping.3.query.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/q12_shipping/q12_shipping.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/q12_shipping/q12_shipping.3.query.sqlpp
index c089f72..58d0c9e 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/q12_shipping/q12_shipping.3.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/q12_shipping/q12_shipping.3.query.sqlpp
@@ -21,10 +21,11 @@ use tpch;
 
 
 select element {'l_shipmode':l_shipmode,'high_line_count':COLL_SUM((
-        select element tpch.`switch-case`(((i.o_orderpriority = '1-URGENT') or (i.o_orderpriority = '2-HIGH')),true,1,false,0)
+        select element 
+            CASE i.o_orderpriority = '1-URGENT' OR i.o_orderpriority = '2-HIGH' WHEN true THEN 1 WHEN false THEN 0 END
         from  o as i
     )),'low_line_count':COLL_SUM((
-        select element tpch.`switch-case`(((i.o_orderpriority = '1-URGENT') or (i.o_orderpriority = '2-HIGH')),true,0,false,1)
+        select element case when i.o_orderpriority = '1-URGENT' OR i.o_orderpriority = '2-HIGH' then 0 else 1 end
         from  o as i
     ))}
 from  LineItem as l,

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c8c067c5/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/q14_promotion_effect/q14_promotion_effect.3.query.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/q14_promotion_effect/q14_promotion_effect.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/q14_promotion_effect/q14_promotion_effect.3.query.sqlpp
index ba7de7d..32ab76a 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/q14_promotion_effect/q14_promotion_effect.3.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/q14_promotion_effect/q14_promotion_effect.3.query.sqlpp
@@ -21,7 +21,7 @@ use tpch;
 
 
 select element (100.0 * COLL_SUM((
-      select element tpch.`switch-case`(i.p_type like 'PROMO%',true,(i.l_extendedprice * (1 - i.l_discount)),false,0.0)
+      select element case i.p_type like 'PROMO%' when true then i.l_extendedprice * (1 - i.l_discount) else 0.0 end
       from  lp as i
   )) / COLL_SUM((
       select element (i.l_extendedprice * (1 - i.l_discount))

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c8c067c5/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/user-defined-functions/query-issue218-2/query-issue218-2.1.ddl.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/user-defined-functions/query-issue218-2/query-issue218-2.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/user-defined-functions/query-issue218-2/query-issue218-2.1.ddl.sqlpp
index f535ffe..6942fc8 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/user-defined-functions/query-issue218-2/query-issue218-2.1.ddl.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/user-defined-functions/query-issue218-2/query-issue218-2.1.ddl.sqlpp
@@ -28,8 +28,8 @@ create database test;
 
 create function test.computeBonus(pbcRating,salary)
 {
-   if (pbcRating = 1) then
-        salary * 0.25
-   else
-        salary * 0.10
+   CASE
+      WHEN pbcRating = 1 THEN salary * 0.25
+      ELSE salary * 0.10
+   END
 }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c8c067c5/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/user-defined-functions/query-issue218/query-issue218.1.ddl.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/user-defined-functions/query-issue218/query-issue218.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/user-defined-functions/query-issue218/query-issue218.1.ddl.sqlpp
index bc22967..28f84bf 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/user-defined-functions/query-issue218/query-issue218.1.ddl.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/user-defined-functions/query-issue218/query-issue218.1.ddl.sqlpp
@@ -28,8 +28,8 @@ create database test;
 
 create function test.computeBonus(pbcRating, salary)
 {
-   if (pbcRating = 1) then
-        salary * 0.25
-   else
-        salary * 0.10
+   CASE
+      WHEN pbcRating = 1 THEN salary * 0.25
+      ELSE salary * 0.10
+   END
 }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c8c067c5/asterixdb/asterix-app/src/test/resources/runtimets/results/misc/case_01/case_01.1.adm
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/misc/case_01/case_01.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/misc/case_01/case_01.1.adm
new file mode 100644
index 0000000..f433f2f
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/misc/case_01/case_01.1.adm
@@ -0,0 +1,6 @@
+{ "$1": 0.0 }
+{ "$1": 2.0 }
+{ "$1": 1.0 }
+{ "$1": 0.5 }
+{ "$1": null }
+{  }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c8c067c5/asterixdb/asterix-app/src/test/resources/runtimets/results/misc/case_02/case_02.1.adm
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/misc/case_02/case_02.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/misc/case_02/case_02.1.adm
new file mode 100644
index 0000000..7c61d7b
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/misc/case_02/case_02.1.adm
@@ -0,0 +1,6 @@
+{ "$1": 0.0 }
+{ "$1": 2.0 }
+{ "$1": 1.0 }
+{ "$1": 0.5 }
+{ "$1": -1 }
+{ "$1": -2 }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c8c067c5/asterixdb/asterix-app/src/test/resources/runtimets/results/misc/case_03/case_03.1.adm
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/misc/case_03/case_03.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/misc/case_03/case_03.1.adm
new file mode 100644
index 0000000..bcced75
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/misc/case_03/case_03.1.adm
@@ -0,0 +1,6 @@
+{ "$1": [ { "r": 0 } ] }
+{ "$1": [ { "r": -3 } ] }
+{ "$1": [ { "r": -3 } ] }
+{ "$1": [ { "r": -3 } ] }
+{ "$1": [ { "r": -1 } ] }
+{ "$1": [ { "r": -2 } ] }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c8c067c5/asterixdb/asterix-app/src/test/resources/runtimets/results/misc/case_04/case_04.1.adm
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/misc/case_04/case_04.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/misc/case_04/case_04.1.adm
new file mode 100644
index 0000000..f2a1ae7
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/misc/case_04/case_04.1.adm
@@ -0,0 +1,6 @@
+{ "$1": [ 0 ] }
+{ "$1": 2.0 }
+{ "$1": 1.0 }
+{ "$1": 0.5 }
+{ "$1": [ { "$2": -1 } ] }
+{ "$1": [ { "$3": -2 } ] }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c8c067c5/asterixdb/asterix-app/src/test/resources/runtimets/results/misc/case_05/case_05.1.adm
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/misc/case_05/case_05.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/misc/case_05/case_05.1.adm
new file mode 100644
index 0000000..5d37fcc
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/misc/case_05/case_05.1.adm
@@ -0,0 +1,6 @@
+{ "$1": [ 0 ] }
+{ "$1": null }
+{  }
+{ "$1": 0.5 }
+{ "$1": [ { "$2": -1 } ] }
+{ "$1": [ { "$3": -2 } ] }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c8c067c5/asterixdb/asterix-app/src/test/resources/runtimets/results/misc/case_06/case_06.1.adm
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/misc/case_06/case_06.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/misc/case_06/case_06.1.adm
new file mode 100644
index 0000000..69e44e4
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/misc/case_06/case_06.1.adm
@@ -0,0 +1,6 @@
+{  }
+{ "$1": null }
+{ "$1": null }
+{ "$1": null }
+{ "$1": null }
+{ "$1": null }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c8c067c5/asterixdb/asterix-app/src/test/resources/runtimets/results/misc/ifthenelse_02/ifthenelse_02.1.adm
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/misc/ifthenelse_02/ifthenelse_02.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/misc/ifthenelse_02/ifthenelse_02.1.adm
new file mode 100644
index 0000000..f599e28
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/misc/ifthenelse_02/ifthenelse_02.1.adm
@@ -0,0 +1 @@
+10

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c8c067c5/asterixdb/asterix-app/src/test/resources/runtimets/results/misc/query-ASTERIXDB-819-2/query-ASTERIXDB-819-2.1.adm
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/misc/query-ASTERIXDB-819-2/query-ASTERIXDB-819-2.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/misc/query-ASTERIXDB-819-2/query-ASTERIXDB-819-2.1.adm
new file mode 100644
index 0000000..bba55dc
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/misc/query-ASTERIXDB-819-2/query-ASTERIXDB-819-2.1.adm
@@ -0,0 +1 @@
+{ "type": "object" }


Mime
View raw message