asterixdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From buyin...@apache.org
Subject [04/22] incubator-asterixdb git commit: ASTERIXDB-1228: Add MISSING into the data model.
Date Tue, 24 May 2016 01:31:22 GMT
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/535d86b5/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/staticcodegen/EvaluatorVisitor.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/staticcodegen/EvaluatorVisitor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/staticcodegen/EvaluatorVisitor.java
deleted file mode 100644
index 6d554d7..0000000
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/staticcodegen/EvaluatorVisitor.java
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
- * 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.
- */
-package org.apache.asterix.runtime.evaluators.staticcodegen;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.objectweb.asm.ClassVisitor;
-import org.objectweb.asm.Label;
-import org.objectweb.asm.MethodVisitor;
-import org.objectweb.asm.Opcodes;
-import org.objectweb.asm.tree.AbstractInsnNode;
-import org.objectweb.asm.tree.FieldInsnNode;
-import org.objectweb.asm.tree.IincInsnNode;
-import org.objectweb.asm.tree.InsnNode;
-import org.objectweb.asm.tree.IntInsnNode;
-
-/**
- * This visitor adds null-handling byte code into an evaluator class.
- */
-public class EvaluatorVisitor extends ClassVisitor {
-    private final static String EVALUATE_DESC = "(Lorg/apache/hyracks/dataflow/common/data/accessors/IFrameTupleReference;Lorg/apache/hyracks/data/std/api/IPointable;)V";
-    private final static String EVALUATE = "evaluate";
-    private final static MethodIdentifier METHOD_IDENTIFIER = new MethodIdentifier(EVALUATE, EVALUATE_DESC, null);
-    private final static String TYPECHECK_CLASS = "org/apache/asterix/runtime/evaluators/staticcodegen/TypeCheckUtil";
-    private final static String IS_NULL = "isNull";
-    private final static String TYPECHECK_METHOD_DESC = "(Lorg/apache/hyracks/data/std/api/IPointable;Lorg/apache/hyracks/data/std/api/IPointable;)Z";
-
-    public EvaluatorVisitor(ClassVisitor downStreamVisitor) {
-        super(Opcodes.ASM5, downStreamVisitor);
-    }
-
-    @Override
-    public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) {
-        MethodVisitor mv = cv.visitMethod(access, name, desc, signature, exceptions);
-        if (!METHOD_IDENTIFIER.equals(new MethodIdentifier(name, desc, signature))) {
-            return mv;
-        }
-        if (mv != null) {
-            return new MethodVisitor(Opcodes.ASM5, mv) {
-                private FieldInsnNode fieldAccessNode = null;
-                private List<AbstractInsnNode> instructionsAfterFieldAccess = new ArrayList<>();
-
-                @Override
-                public void visitFieldInsn(int opcode, String owner, String name, String desc) {
-                    mv.visitFieldInsn(opcode, owner, name, desc);
-                    fieldAccessNode = new FieldInsnNode(opcode, owner, name, desc);
-                    instructionsAfterFieldAccess.clear();
-                }
-
-                @Override
-                public void visitIincInsn(int var, int increment) {
-                    if (fieldAccessNode != null) {
-                        instructionsAfterFieldAccess.add(new IincInsnNode(var, increment));
-                    }
-                    super.visitIincInsn(var, increment);
-                }
-
-                @Override
-                public void visitInsn(int opcode) {
-                    if (fieldAccessNode != null) {
-                        instructionsAfterFieldAccess.add(new InsnNode(opcode));
-                    }
-                    super.visitInsn(opcode);
-                }
-
-                @Override
-                public void visitIntInsn(int opcode, int operand) {
-                    if (fieldAccessNode != null) {
-                        instructionsAfterFieldAccess.add(new IntInsnNode(opcode, operand));
-                    }
-                    super.visitIntInsn(opcode, operand);
-                }
-
-                @Override
-                public void visitMethodInsn(int opcode, String owner, String name, String desc, boolean itf) {
-                    mv.visitMethodInsn(opcode, owner, name, desc, itf);
-                    if (fieldAccessNode == null
-                            || !METHOD_IDENTIFIER.equals(new MethodIdentifier(name, desc, signature))) {
-                        return;
-                    }
-                    // Loads "this".
-                    mv.visitVarInsn(Opcodes.ALOAD, 0);
-                    // Replays the field access instruction.
-                    fieldAccessNode.accept(mv);
-
-                    // Replays other instruction between the field access and the evaluator call.
-                    for (AbstractInsnNode instruction : instructionsAfterFieldAccess) {
-                        instruction.accept(mv);
-                    }
-
-                    // Loads the result IPointable.
-                    mv.visitVarInsn(Opcodes.ALOAD, 2);
-
-                    // Invokes the null check method.
-                    mv.visitMethodInsn(Opcodes.INVOKESTATIC, TYPECHECK_CLASS, IS_NULL, TYPECHECK_METHOD_DESC, false);
-                    Label notNull = new Label();
-                    // Adds the if branch.
-                    mv.visitJumpInsn(Opcodes.IFEQ, notNull);
-                    mv.visitInsn(Opcodes.RETURN);
-                    mv.visitLabel(notNull);
-                    mv.visitFrame(Opcodes.F_SAME, 0, null, 0, null);
-                }
-            };
-        }
-        return null;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/535d86b5/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/staticcodegen/GatherInnerClassVisitor.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/staticcodegen/GatherInnerClassVisitor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/staticcodegen/GatherInnerClassVisitor.java
index 2293734..031707b 100644
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/staticcodegen/GatherInnerClassVisitor.java
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/staticcodegen/GatherInnerClassVisitor.java
@@ -44,7 +44,8 @@ public class GatherInnerClassVisitor extends ClassVisitor {
 
     @Override
     public void visitInnerClass(String name, String outerName, String innerName, int access) {
-        if (className == null || !name.equals(className)) {
+        if ((className == null || !name.equals(className))
+                && ((access & Opcodes.ACC_PUBLIC) == 0 || (access & Opcodes.ACC_STATIC) == 0)) {
             innerClassNames.add(name);
         }
     }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/535d86b5/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/staticcodegen/RenameClassVisitor.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/staticcodegen/RenameClassVisitor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/staticcodegen/RenameClassVisitor.java
index 1eb7357..4396fd6 100644
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/staticcodegen/RenameClassVisitor.java
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/staticcodegen/RenameClassVisitor.java
@@ -53,7 +53,9 @@ public class RenameClassVisitor extends ClassVisitor {
 
     @Override
     public void visitInnerClass(String name, String outerName, String innerName, int access) {
-        // Skips inner class descriptions.
+        if ((access & Opcodes.ACC_PUBLIC) != 0 && (access & Opcodes.ACC_STATIC) != 0) {
+            super.visitInnerClass(name, outerName, innerName, access);
+        }
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/535d86b5/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/staticcodegen/TypeCheckUtil.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/staticcodegen/TypeCheckUtil.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/staticcodegen/TypeCheckUtil.java
deleted file mode 100644
index 0b02f39..0000000
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/staticcodegen/TypeCheckUtil.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * 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.
- */
-package org.apache.asterix.runtime.evaluators.staticcodegen;
-
-import org.apache.asterix.om.types.ATypeTag;
-import org.apache.hyracks.data.std.api.IPointable;
-
-/**
- * The null-handling code to be injected into the evaluator(...) method of scalar evaluators.
- */
-public class TypeCheckUtil {
-
-    public static byte[] NULL_BYTES = new byte[] { ATypeTag.SERIALIZED_NULL_TYPE_TAG };
-
-    public static boolean isNull(IPointable arg, IPointable resultPointable) {
-        byte[] data = arg.getByteArray();
-        int start = arg.getStartOffset();
-        if (data[start] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
-            resultPointable.set(NULL_BYTES, 0, 1);
-            return true;
-        }
-        return false;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/535d86b5/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/staticcodegen/TypeChecker.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/staticcodegen/TypeChecker.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/staticcodegen/TypeChecker.java
new file mode 100644
index 0000000..55c2c4b
--- /dev/null
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/staticcodegen/TypeChecker.java
@@ -0,0 +1,77 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.asterix.runtime.evaluators.staticcodegen;
+
+import org.apache.asterix.om.types.ATypeTag;
+import org.apache.hyracks.data.std.api.IPointable;
+
+/**
+ * The missing/null-handling code to be injected into the evaluator(...) method of scalar evaluators.
+ */
+public class TypeChecker {
+
+    private byte[] MISSING_BYTES = new byte[] { ATypeTag.SERIALIZED_MISSING_TYPE_TAG };
+    private byte[] NULL_BYTES = new byte[] { ATypeTag.SERIALIZED_NULL_TYPE_TAG };
+    private boolean meetNull = false;
+
+    /**
+     * This method should be called for each argument of a function.
+     *
+     * @param arg,
+     *            the argument pointable.
+     * @param resultPointable,
+     *            the returned result for the function.
+     * @return true if arg is MISSING; false otherwise.
+     */
+    public boolean isMissing(IPointable arg, IPointable resultPointable) {
+        byte[] data = arg.getByteArray();
+        int start = arg.getStartOffset();
+        byte serializedTypeTag = data[start];
+        if (serializedTypeTag == ATypeTag.SERIALIZED_MISSING_TYPE_TAG) {
+            resultPointable.set(MISSING_BYTES, 0, 1);
+            // resets meetNull for the next evaluate(...) call.
+            meetNull = false;
+            return true;
+        }
+        if (serializedTypeTag == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
+            meetNull |= true;
+        }
+        return false;
+    }
+
+    /**
+     * This method should be called after all arguments for a function are evaluated.
+     *
+     * @param resultPointable,
+     *            the returned result for the function.
+     * @return true if any argument is NULL; false otherwise.
+     */
+    public boolean isNull(IPointable resultPointable) {
+        if (meetNull) {
+            resultPointable.set(NULL_BYTES, 0, 1);
+            // resets meetNull.
+            meetNull = false;
+            return true;
+        }
+        // resets meetNull for the next evaluate(...) call.
+        meetNull = false;
+        return false;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/535d86b5/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/formats/NonTaggedDataFormat.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/formats/NonTaggedDataFormat.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/formats/NonTaggedDataFormat.java
index c151dbd..5811cd6 100644
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/formats/NonTaggedDataFormat.java
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/formats/NonTaggedDataFormat.java
@@ -26,7 +26,7 @@ import java.util.List;
 import java.util.Map;
 
 import org.apache.asterix.common.config.GlobalConfig;
-import org.apache.asterix.dataflow.data.nontagged.AqlNullWriterFactory;
+import org.apache.asterix.dataflow.data.nontagged.AqlMissingWriterFactory;
 import org.apache.asterix.formats.base.IDataFormat;
 import org.apache.asterix.formats.nontagged.AqlADMPrinterFactoryProvider;
 import org.apache.asterix.formats.nontagged.AqlBinaryBooleanInspectorImpl;
@@ -43,7 +43,7 @@ import org.apache.asterix.formats.nontagged.AqlSerializerDeserializerProvider;
 import org.apache.asterix.formats.nontagged.AqlTypeTraitProvider;
 import org.apache.asterix.om.base.ABoolean;
 import org.apache.asterix.om.base.AInt32;
-import org.apache.asterix.om.base.ANull;
+import org.apache.asterix.om.base.AMissing;
 import org.apache.asterix.om.base.AOrderedList;
 import org.apache.asterix.om.base.AString;
 import org.apache.asterix.om.base.IAObject;
@@ -54,7 +54,7 @@ import org.apache.asterix.om.functions.IFunctionDescriptor;
 import org.apache.asterix.om.functions.IFunctionDescriptorFactory;
 import org.apache.asterix.om.functions.IFunctionManager;
 import org.apache.asterix.om.pointables.base.DefaultOpenFieldType;
-import org.apache.asterix.om.typecomputer.base.TypeComputerUtilities;
+import org.apache.asterix.om.typecomputer.base.TypeCastUtils;
 import org.apache.asterix.om.types.AOrderedListType;
 import org.apache.asterix.om.types.ARecordType;
 import org.apache.asterix.om.types.ATypeTag;
@@ -70,20 +70,11 @@ import org.apache.asterix.runtime.evaluators.constructors.ClosedRecordConstructo
 import org.apache.asterix.runtime.evaluators.constructors.OpenRecordConstructorDescriptor;
 import org.apache.asterix.runtime.evaluators.functions.CastListDescriptor;
 import org.apache.asterix.runtime.evaluators.functions.CastRecordDescriptor;
-import org.apache.asterix.runtime.evaluators.functions.DeepEqualityDescriptor;
-import org.apache.asterix.runtime.evaluators.functions.FlowRecordDescriptor;
 import org.apache.asterix.runtime.evaluators.functions.OrderedListConstructorDescriptor;
 import org.apache.asterix.runtime.evaluators.functions.UnorderedListConstructorDescriptor;
-import org.apache.asterix.runtime.evaluators.functions.records.FieldAccessByIndexDescriptor;
 import org.apache.asterix.runtime.evaluators.functions.records.FieldAccessByIndexEvalFactory;
 import org.apache.asterix.runtime.evaluators.functions.records.FieldAccessByNameDescriptor;
-import org.apache.asterix.runtime.evaluators.functions.records.FieldAccessNestedDescriptor;
 import org.apache.asterix.runtime.evaluators.functions.records.FieldAccessNestedEvalFactory;
-import org.apache.asterix.runtime.evaluators.functions.records.GetRecordFieldValueDescriptor;
-import org.apache.asterix.runtime.evaluators.functions.records.GetRecordFieldsDescriptor;
-import org.apache.asterix.runtime.evaluators.functions.records.RecordAddFieldsDescriptor;
-import org.apache.asterix.runtime.evaluators.functions.records.RecordMergeDescriptor;
-import org.apache.asterix.runtime.evaluators.functions.records.RecordRemoveFieldsDescriptor;
 import org.apache.commons.lang3.mutable.Mutable;
 import org.apache.commons.lang3.mutable.MutableObject;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
@@ -114,7 +105,7 @@ import org.apache.hyracks.algebricks.data.ITypeTraitProvider;
 import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
 import org.apache.hyracks.algebricks.runtime.evaluators.ColumnAccessEvalFactory;
 import org.apache.hyracks.algebricks.runtime.evaluators.ConstantEvalFactory;
-import org.apache.hyracks.api.dataflow.value.INullWriterFactory;
+import org.apache.hyracks.api.dataflow.value.IMissingWriterFactory;
 import org.apache.hyracks.api.dataflow.value.IPredicateEvaluatorFactoryProvider;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
@@ -125,6 +116,8 @@ import org.apache.hyracks.dataflow.common.data.parsers.IntegerParserFactory;
 import org.apache.hyracks.dataflow.common.data.parsers.LongParserFactory;
 import org.apache.hyracks.dataflow.common.data.parsers.UTF8StringParserFactory;
 
+import junit.extensions.PA;
+
 public class NonTaggedDataFormat implements IDataFormat {
 
     private static boolean registered = false;
@@ -389,8 +382,8 @@ public class NonTaggedDataFormat implements IDataFormat {
                 } else {
                     IAType itemType = (IAType) context.getType(f.getArguments().get(0).getValue());
                     if (itemType instanceof AUnionType) {
-                        if (((AUnionType) itemType).isNullableType()) {
-                            itemType = ((AUnionType) itemType).getNullableType();
+                        if (((AUnionType) itemType).isUnknownableType()) {
+                            itemType = ((AUnionType) itemType).getActualType();
                         } else {
                             // Convert UNION types into ANY.
                             itemType = BuiltinType.ANY;
@@ -408,7 +401,8 @@ public class NonTaggedDataFormat implements IDataFormat {
                 IAType outType = (IAType) context.getType(expr);
                 IAType type0 = (IAType) context.getType(f.getArguments().get(0).getValue());
                 IAType type1 = (IAType) context.getType(f.getArguments().get(1).getValue());
-                ((RecordMergeDescriptor) fd).reset(outType, type0, type1);
+                PA.invokeMethod(fd, "reset(org.apache.asterix.om.types.IAType, org.apache.asterix.om.types.IAType, "
+                        + " org.apache.asterix.om.types.IAType)", outType, type0, type1);
             }
         });
 
@@ -420,7 +414,8 @@ public class NonTaggedDataFormat implements IDataFormat {
                 AbstractFunctionCallExpression f = (AbstractFunctionCallExpression) expr;
                 IAType type0 = (IAType) context.getType(f.getArguments().get(0).getValue());
                 IAType type1 = (IAType) context.getType(f.getArguments().get(1).getValue());
-                ((DeepEqualityDescriptor) fd).reset(type0, type1);
+                PA.invokeMethod(fd, "reset(org.apache.asterix.om.types.IAType, org.apache.asterix.om.types.IAType)",
+                        type0, type1);
             }
         });
 
@@ -440,7 +435,8 @@ public class NonTaggedDataFormat implements IDataFormat {
                 if (type1.getTypeTag().equals(ATypeTag.ANY)) {
                     type1 = DefaultOpenFieldType.NESTED_OPEN_AORDERED_LIST_TYPE;
                 }
-                ((RecordAddFieldsDescriptor) fd).reset(outType, type0, type1);
+                PA.invokeMethod(fd, "reset(org.apache.asterix.om.types.IAType, org.apache.asterix.om.types.IAType,"
+                        + " org.apache.asterix.om.types.IAType)", outType, type0, type1);
             }
         });
 
@@ -460,7 +456,8 @@ public class NonTaggedDataFormat implements IDataFormat {
                 if (type1.getTypeTag().equals(ATypeTag.ANY)) {
                     type1 = DefaultOpenFieldType.NESTED_OPEN_AORDERED_LIST_TYPE;
                 }
-                ((RecordRemoveFieldsDescriptor) fd).reset(outType, type0, type1);
+                PA.invokeMethod(fd, "reset(org.apache.asterix.om.types.IAType, org.apache.asterix.om.types.IAType,"
+                        + " org.apache.asterix.om.types.IAType)", outType, type0, type1);
             }
         });
 
@@ -469,7 +466,7 @@ public class NonTaggedDataFormat implements IDataFormat {
             public void infer(ILogicalExpression expr, IFunctionDescriptor fd, IVariableTypeEnvironment context)
                     throws AlgebricksException {
                 AbstractFunctionCallExpression funcExpr = (AbstractFunctionCallExpression) expr;
-                ARecordType rt = (ARecordType) TypeComputerUtilities.getRequiredType(funcExpr);
+                ARecordType rt = (ARecordType) TypeCastUtils.getRequiredType(funcExpr);
                 IAType it = (IAType) context.getType(funcExpr.getArguments().get(0).getValue());
                 if (it.getTypeTag().equals(ATypeTag.ANY)) {
                     it = DefaultOpenFieldType.NESTED_OPEN_RECORD_TYPE;
@@ -482,7 +479,7 @@ public class NonTaggedDataFormat implements IDataFormat {
             public void infer(ILogicalExpression expr, IFunctionDescriptor fd, IVariableTypeEnvironment context)
                     throws AlgebricksException {
                 AbstractFunctionCallExpression funcExpr = (AbstractFunctionCallExpression) expr;
-                AbstractCollectionType rt = (AbstractCollectionType) TypeComputerUtilities.getRequiredType(funcExpr);
+                AbstractCollectionType rt = (AbstractCollectionType) TypeCastUtils.getRequiredType(funcExpr);
                 IAType it = (IAType) context.getType(funcExpr.getArguments().get(0).getValue());
                 if (it.getTypeTag().equals(ATypeTag.ANY)) {
                     it = DefaultOpenFieldType.NESTED_OPEN_AORDERED_LIST_TYPE;
@@ -490,15 +487,6 @@ public class NonTaggedDataFormat implements IDataFormat {
                 ((CastListDescriptor) fd).reset(rt, (AbstractCollectionType) it);
             }
         });
-        functionTypeInferers.put(AsterixBuiltinFunctions.FLOW_RECORD, new FunctionTypeInferer() {
-            @Override
-            public void infer(ILogicalExpression expr, IFunctionDescriptor fd, IVariableTypeEnvironment context)
-                    throws AlgebricksException {
-                ARecordType it = (ARecordType) TypeComputerUtilities
-                        .getInputType((AbstractFunctionCallExpression) expr);
-                ((FlowRecordDescriptor) fd).reset(it);
-            }
-        });
         functionTypeInferers.put(AsterixBuiltinFunctions.OPEN_RECORD_CONSTRUCTOR, new FunctionTypeInferer() {
             @Override
             public void infer(ILogicalExpression expr, IFunctionDescriptor fd, IVariableTypeEnvironment context)
@@ -561,16 +549,16 @@ public class NonTaggedDataFormat implements IDataFormat {
                 switch (t.getTypeTag()) {
                     case RECORD: {
                         ARecordType recType = (ARecordType) t;
-                        ((FieldAccessByIndexDescriptor) fd).reset(recType);
+                        PA.invokeMethod(fd, "reset(org.apache.asterix.om.types.ARecordType)", recType);
                         break;
                     }
                     case UNION: {
                         AUnionType unionT = (AUnionType) t;
-                        if (unionT.isNullableType()) {
-                            IAType t2 = unionT.getNullableType();
+                        if (unionT.isUnknownableType()) {
+                            IAType t2 = unionT.getActualType();
                             if (t2.getTypeTag() == ATypeTag.RECORD) {
                                 ARecordType recType = (ARecordType) t2;
-                                ((FieldAccessByIndexDescriptor) fd).reset(recType);
+                                PA.invokeMethod(fd, "reset(org.apache.asterix.om.types.ARecordType)", recType);
                                 break;
                             }
                         }
@@ -598,7 +586,8 @@ public class NonTaggedDataFormat implements IDataFormat {
                 switch (t.getTypeTag()) {
                     case RECORD: {
                         ARecordType recType = (ARecordType) t;
-                        ((FieldAccessNestedDescriptor) fd).reset(recType, listFieldPath);
+                        PA.invokeMethod(fd, "reset(org.apache.asterix.om.types.ARecordType, java.util.List)", recType,
+                                listFieldPath);
                         break;
                     }
                     default: {
@@ -615,7 +604,7 @@ public class NonTaggedDataFormat implements IDataFormat {
                 IAType t = (IAType) context.getType(fce.getArguments().get(0).getValue());
                 if (t.getTypeTag().equals(ATypeTag.RECORD)) {
                     ARecordType recType = (ARecordType) t;
-                    ((GetRecordFieldsDescriptor) fd).reset(recType);
+                    PA.invokeMethod(fd, "reset(org.apache.asterix.om.types.ARecordType)", recType);
                 } else {
                     throw new NotImplementedException("get-record-fields for data of type " + t);
                 }
@@ -629,7 +618,7 @@ public class NonTaggedDataFormat implements IDataFormat {
                 IAType t = (IAType) context.getType(fce.getArguments().get(0).getValue());
                 if (t.getTypeTag().equals(ATypeTag.RECORD)) {
                     ARecordType recType = (ARecordType) t;
-                    ((GetRecordFieldValueDescriptor) fd).reset(recType);
+                    PA.invokeMethod(fd, "reset(org.apache.asterix.om.types.ARecordType)", recType);
                 } else {
                     throw new NotImplementedException("get-record-field-value for data of type " + t);
                 }
@@ -662,8 +651,8 @@ public class NonTaggedDataFormat implements IDataFormat {
     @Override
     public IScalarEvaluatorFactory getConstantEvalFactory(IAlgebricksConstantValue value) throws AlgebricksException {
         IAObject obj = null;
-        if (value.isNull()) {
-            obj = ANull.NULL;
+        if (value.isMissing()) {
+            obj = AMissing.MISSING;
         } else if (value.isTrue()) {
             obj = ABoolean.TRUE;
         } else if (value.isFalse()) {
@@ -688,8 +677,8 @@ public class NonTaggedDataFormat implements IDataFormat {
     }
 
     @Override
-    public INullWriterFactory getNullWriterFactory() {
-        return AqlNullWriterFactory.INSTANCE;
+    public IMissingWriterFactory getMissingWriterFactory() {
+        return AqlMissingWriterFactory.INSTANCE;
     }
 
     @Override
@@ -701,7 +690,7 @@ public class NonTaggedDataFormat implements IDataFormat {
                 switch (expr.getExpressionTag()) {
                     case CONSTANT: {
                         ConstantExpression c = (ConstantExpression) expr;
-                        if (c == ConstantExpression.NULL) {
+                        if (c == ConstantExpression.MISSING) {
                             return 1;
                         } else if (c == ConstantExpression.FALSE || c == ConstantExpression.TRUE) {
                             return 2;
@@ -709,25 +698,26 @@ public class NonTaggedDataFormat implements IDataFormat {
                             AsterixConstantValue acv = (AsterixConstantValue) c.getValue();
                             IAObject o = acv.getObject();
                             switch (o.getType().getTypeTag()) {
-                                case DOUBLE: {
+                                case DOUBLE:
                                     return 9;
-                                }
-                                case BOOLEAN: {
+                                case FLOAT:
+                                    return 5;
+                                case BOOLEAN:
                                     return 2;
-                                }
-                                case NULL: {
+                                case MISSING:
                                     return 1;
-                                }
-                                case INT32: {
+                                case NULL:
+                                    return 1;
+                                case INT8:
+                                    return 2;
+                                case INT16:
+                                    return 3;
+                                case INT32:
                                     return 5;
-                                }
-                                case INT64: {
+                                case INT64:
                                     return 9;
-                                }
-                                default: {
-                                    // TODO
+                                default:
                                     return -1;
-                                }
                             }
                         }
                     }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/535d86b5/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/AsterixLSMPrimaryUpsertOperatorNodePushable.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/AsterixLSMPrimaryUpsertOperatorNodePushable.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/AsterixLSMPrimaryUpsertOperatorNodePushable.java
index 7785978..24988d4 100644
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/AsterixLSMPrimaryUpsertOperatorNodePushable.java
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/AsterixLSMPrimaryUpsertOperatorNodePushable.java
@@ -30,7 +30,7 @@ import org.apache.asterix.om.types.ARecordType;
 import org.apache.asterix.om.types.ATypeTag;
 import org.apache.hyracks.api.comm.VSizeFrame;
 import org.apache.hyracks.api.context.IHyracksTaskContext;
-import org.apache.hyracks.api.dataflow.value.INullWriter;
+import org.apache.hyracks.api.dataflow.value.IMissingWriter;
 import org.apache.hyracks.api.dataflow.value.IRecordDescriptorProvider;
 import org.apache.hyracks.api.dataflow.value.RecordDescriptor;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
@@ -59,8 +59,8 @@ public class AsterixLSMPrimaryUpsertOperatorNodePushable extends LSMIndexInsertU
 
     private final PermutingFrameTupleReference key;
     private MultiComparator keySearchCmp;
-    private ArrayTupleBuilder nullTupleBuilder;
-    private final INullWriter nullWriter;
+    private ArrayTupleBuilder missingTupleBuilder;
+    private final IMissingWriter missingWriter;
     private ArrayTupleBuilder tb;
     private DataOutput dos;
     private RangePredicate searchPred;
@@ -79,8 +79,8 @@ public class AsterixLSMPrimaryUpsertOperatorNodePushable extends LSMIndexInsertU
             int partition, int[] fieldPermutation, IRecordDescriptorProvider recordDescProvider, int numOfPrimaryKeys,
             ARecordType recordType, int filterFieldIndex) {
         super(opDesc, ctx, partition, fieldPermutation, recordDescProvider, IndexOperation.UPSERT);
-        // initialize nullWriter
-        this.nullWriter = opDesc.getNullWriterFactory().createNullWriter();
+        // initialize missingWriter
+        this.missingWriter = opDesc.getMissingWriterFactory().createMissingWriter();
         // The search key should only have the primary index and not use the permutations.
         this.key = new PermutingFrameTupleReference();
         int[] searchKeyPermutations = new int[numOfPrimaryKeys];
@@ -114,14 +114,14 @@ public class AsterixLSMPrimaryUpsertOperatorNodePushable extends LSMIndexInsertU
         index = indexHelper.getIndexInstance();
 
         try {
-            nullTupleBuilder = new ArrayTupleBuilder(1);
-            DataOutput out = nullTupleBuilder.getDataOutput();
+            missingTupleBuilder = new ArrayTupleBuilder(1);
+            DataOutput out = missingTupleBuilder.getDataOutput();
             try {
-                nullWriter.writeNull(out);
+                missingWriter.writeMissing(out);
             } catch (IOException e) {
                 throw new HyracksDataException(e);
             }
-            nullTupleBuilder.addFieldEndOffset();
+            missingTupleBuilder.addFieldEndOffset();
             searchPred = createSearchPredicate();
             tb = new ArrayTupleBuilder(recordDesc.getFieldCount());
             dos = tb.getDataOutput();
@@ -180,11 +180,11 @@ public class AsterixLSMPrimaryUpsertOperatorNodePushable extends LSMIndexInsertU
     }
 
     public static boolean isNull(ITupleReference t1, int field) {
-        return t1.getFieldData(field)[t1.getFieldStart(field)] == ATypeTag.SERIALIZED_NULL_TYPE_TAG;
+        return t1.getFieldData(field)[t1.getFieldStart(field)] == ATypeTag.SERIALIZED_MISSING_TYPE_TAG;
     }
 
     private void addNullField() throws IOException {
-        dos.write(nullTupleBuilder.getByteArray());
+        dos.write(missingTupleBuilder.getByteArray());
         tb.addFieldEndOffset();
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/535d86b5/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/AsterixLSMTreeUpsertOperatorDescriptor.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/AsterixLSMTreeUpsertOperatorDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/AsterixLSMTreeUpsertOperatorDescriptor.java
index 803e15d..0c1177f 100644
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/AsterixLSMTreeUpsertOperatorDescriptor.java
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/AsterixLSMTreeUpsertOperatorDescriptor.java
@@ -23,7 +23,7 @@ import org.apache.asterix.om.types.ARecordType;
 import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.dataflow.IOperatorNodePushable;
 import org.apache.hyracks.api.dataflow.value.IBinaryComparatorFactory;
-import org.apache.hyracks.api.dataflow.value.INullWriterFactory;
+import org.apache.hyracks.api.dataflow.value.IMissingWriterFactory;
 import org.apache.hyracks.api.dataflow.value.IRecordDescriptorProvider;
 import org.apache.hyracks.api.dataflow.value.ITypeTraits;
 import org.apache.hyracks.api.dataflow.value.RecordDescriptor;
@@ -50,12 +50,12 @@ public class AsterixLSMTreeUpsertOperatorDescriptor extends AsterixLSMTreeInsert
             IFileSplitProvider fileSplitProvider, ITypeTraits[] typeTraits,
             IBinaryComparatorFactory[] comparatorFactories, int[] bloomFilterKeyFields, int[] fieldPermutation,
             IIndexDataflowHelperFactory dataflowHelperFactory, ITupleFilterFactory tupleFilterFactory,
-            boolean isPrimary, String indexName, INullWriterFactory nullWriterFactory,
+            boolean isPrimary, String indexName, IMissingWriterFactory missingWriterFactory,
             IModificationOperationCallbackFactory modificationOpCallbackProvider,
             ISearchOperationCallbackFactory searchOpCallbackProvider, int[] prevValuePermutation) {
         super(spec, recDesc, storageManager, lifecycleManagerProvider, fileSplitProvider, typeTraits,
                 comparatorFactories, bloomFilterKeyFields, fieldPermutation, IndexOperation.UPSERT,
-                dataflowHelperFactory, tupleFilterFactory, isPrimary, indexName, nullWriterFactory,
+                dataflowHelperFactory, tupleFilterFactory, isPrimary, indexName, missingWriterFactory,
                 modificationOpCallbackProvider, searchOpCallbackProvider);
         this.prevValuePermutation = prevValuePermutation;
     }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/535d86b5/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/unnestingfunctions/std/ScanCollectionDescriptor.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/unnestingfunctions/std/ScanCollectionDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/unnestingfunctions/std/ScanCollectionDescriptor.java
index 495e7b6..0883520 100644
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/unnestingfunctions/std/ScanCollectionDescriptor.java
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/unnestingfunctions/std/ScanCollectionDescriptor.java
@@ -80,7 +80,7 @@ public class ScanCollectionDescriptor extends AbstractUnnestingFunctionDynamicDe
                 private final IPointable inputVal = new VoidPointable();
                 private final IScalarEvaluator argEval = listEvalFactory.createScalarEvaluator(ctx);
                 private int itemIndex;
-                private boolean metNull = false;
+                private boolean metUnknown = false;
 
                 @Override
                 public void init(IFrameTupleReference tuple) throws AlgebricksException {
@@ -88,8 +88,8 @@ public class ScanCollectionDescriptor extends AbstractUnnestingFunctionDynamicDe
                         argEval.evaluate(tuple, inputVal);
                         ATypeTag typeTag = EnumDeserializer.ATYPETAGDESERIALIZER
                                 .deserialize(inputVal.getByteArray()[inputVal.getStartOffset()]);
-                        if (typeTag == ATypeTag.NULL) {
-                            metNull = true;
+                        if (typeTag == ATypeTag.MISSING || typeTag == ATypeTag.NULL) {
+                            metUnknown = true;
                             return;
                         }
                         listAccessor.reset(inputVal.getByteArray(), inputVal.getStartOffset());
@@ -102,7 +102,7 @@ public class ScanCollectionDescriptor extends AbstractUnnestingFunctionDynamicDe
                 @Override
                 public boolean step(IPointable result) throws AlgebricksException {
                     try {
-                        if (!metNull) {
+                        if (!metUnknown) {
                             if (itemIndex < listAccessor.size()) {
                                 resultStorage.reset();
                                 listAccessor.writeItem(itemIndex, resultStorage.getDataOutput());

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/535d86b5/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/unnestingfunctions/std/SubsetCollectionDescriptor.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/unnestingfunctions/std/SubsetCollectionDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/unnestingfunctions/std/SubsetCollectionDescriptor.java
index 4ad01d8..b6f8b0b 100644
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/unnestingfunctions/std/SubsetCollectionDescriptor.java
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/unnestingfunctions/std/SubsetCollectionDescriptor.java
@@ -73,7 +73,7 @@ public class SubsetCollectionDescriptor extends AbstractUnnestingFunctionDynamic
                     private int posCrt;
                     private ATypeTag itemTag;
                     private boolean selfDescList = false;
-                    private boolean metNull = false;
+                    private boolean metUnknown = false;
 
                     @Override
                     public void init(IFrameTupleReference tuple) throws AlgebricksException {
@@ -89,11 +89,12 @@ public class SubsetCollectionDescriptor extends AbstractUnnestingFunctionDynamic
                             evalList.evaluate(tuple, inputVal);
                             byte[] serList = inputVal.getByteArray();
                             int offset = inputVal.getStartOffset();
-                            metNull = false;
+                            metUnknown = false;
 
                             byte typeTag = serList[offset];
-                            if (typeTag == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
-                                metNull = true;
+                            if (typeTag == ATypeTag.SERIALIZED_MISSING_TYPE_TAG
+                                    || typeTag == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
+                                metUnknown = true;
                                 return;
                             }
 
@@ -121,7 +122,7 @@ public class SubsetCollectionDescriptor extends AbstractUnnestingFunctionDynamic
 
                     @Override
                     public boolean step(IPointable result) throws AlgebricksException {
-                        if (!metNull && posCrt < posStart + numItems && posCrt < numItemsMax) {
+                        if (!metUnknown && posCrt < posStart + numItems && posCrt < numItemsMax) {
                             resultStorage.reset();
                             byte[] serList = inputVal.getByteArray();
                             int offset = inputVal.getStartOffset();

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/535d86b5/asterixdb/asterix-server/src/main/licenses/NOTICE
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-server/src/main/licenses/NOTICE b/asterixdb/asterix-server/src/main/licenses/NOTICE
index d9240eb..4686009 100644
--- a/asterixdb/asterix-server/src/main/licenses/NOTICE
+++ b/asterixdb/asterix-server/src/main/licenses/NOTICE
@@ -684,3 +684,51 @@ Copyright (C) 2000-2007 The Apache Software Foundation
         * license/LICENSE.jzlib.txt (BSD Style License)
       * HOMEPAGE:
         * http://www.jcraft.com/jzlib/
+
+ - repo/asm-all-5.1.jar
+
+   Copyright (c) 2000-2011 INRIA, France Telecom
+   All rights reserved.
+
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions
+   are met:
+
+   1. Redistributions of source code must retain the above copyright
+      notice, this list of conditions and the following disclaimer.
+
+   2. Redistributions in binary form must reproduce the above copyright
+      notice, this list of conditions and the following disclaimer in the
+      documentation and/or other materials provided with the distribution.
+
+   3. Neither the name of the copyright holders nor the names of its
+      contributors may be used to endorse or promote products derived from
+      this software without specific prior written permission.
+
+   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+   AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+   ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+   LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+   CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+   SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+   INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+   CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+   ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+   THE POSSIBILITY OF SUCH DAMAGE.
+
+ - repo/privilegedaccessor-1.2.2.jar
+
+   Copyright 2004-2012 Sebastian Dietrich (Sebastian.Dietrich@e-movimento.com)
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/535d86b5/asterixdb/asterix-tools/src/main/java/org/apache/asterix/tools/datagen/AdmDataGen.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-tools/src/main/java/org/apache/asterix/tools/datagen/AdmDataGen.java b/asterixdb/asterix-tools/src/main/java/org/apache/asterix/tools/datagen/AdmDataGen.java
index 30fb4e9..2918575 100644
--- a/asterixdb/asterix-tools/src/main/java/org/apache/asterix/tools/datagen/AdmDataGen.java
+++ b/asterixdb/asterix-tools/src/main/java/org/apache/asterix/tools/datagen/AdmDataGen.java
@@ -673,7 +673,7 @@ public class AdmDataGen {
                 for (int i = 0; i < m; i++) {
                     IAType ti = recType.getFieldTypes()[i];
                     if (NonTaggedFormatUtil.isOptional(ti)) {
-                        ti = ((AUnionType) ti).getNullableType();
+                        ti = ((AUnionType) ti).getActualType();
                         nullable[i] = true;
                     }
                     IRecordFieldDataGen rfdg = annot.getDeclaredFieldsDatagen()[i];

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/535d86b5/hyracks-fullstack/algebricks/algebricks-compiler/src/main/java/org/apache/hyracks/algebricks/compiler/api/AbstractCompilerFactoryBuilder.java
----------------------------------------------------------------------
diff --git a/hyracks-fullstack/algebricks/algebricks-compiler/src/main/java/org/apache/hyracks/algebricks/compiler/api/AbstractCompilerFactoryBuilder.java b/hyracks-fullstack/algebricks/algebricks-compiler/src/main/java/org/apache/hyracks/algebricks/compiler/api/AbstractCompilerFactoryBuilder.java
index 1bafe5c..6f28df3 100644
--- a/hyracks-fullstack/algebricks/algebricks-compiler/src/main/java/org/apache/hyracks/algebricks/compiler/api/AbstractCompilerFactoryBuilder.java
+++ b/hyracks-fullstack/algebricks/algebricks-compiler/src/main/java/org/apache/hyracks/algebricks/compiler/api/AbstractCompilerFactoryBuilder.java
@@ -27,7 +27,7 @@ import org.apache.hyracks.algebricks.core.algebra.expressions.IExpressionEvalSiz
 import org.apache.hyracks.algebricks.core.algebra.expressions.IExpressionRuntimeProvider;
 import org.apache.hyracks.algebricks.core.algebra.expressions.IExpressionTypeComputer;
 import org.apache.hyracks.algebricks.core.algebra.expressions.IMergeAggregationExpressionFactory;
-import org.apache.hyracks.algebricks.core.algebra.expressions.INullableTypeComputer;
+import org.apache.hyracks.algebricks.core.algebra.expressions.IMissableTypeComputer;
 import org.apache.hyracks.algebricks.core.algebra.expressions.IPartialAggregationTypeComputer;
 import org.apache.hyracks.algebricks.core.rewriter.base.AbstractRuleController;
 import org.apache.hyracks.algebricks.core.rewriter.base.IAlgebraicRewriteRule;
@@ -41,7 +41,7 @@ import org.apache.hyracks.algebricks.data.INormalizedKeyComputerFactoryProvider;
 import org.apache.hyracks.algebricks.data.IPrinterFactoryProvider;
 import org.apache.hyracks.algebricks.data.ISerializerDeserializerProvider;
 import org.apache.hyracks.algebricks.data.ITypeTraitProvider;
-import org.apache.hyracks.api.dataflow.value.INullWriterFactory;
+import org.apache.hyracks.api.dataflow.value.IMissingWriterFactory;
 import org.apache.hyracks.api.dataflow.value.IPredicateEvaluatorFactoryProvider;
 
 public abstract class AbstractCompilerFactoryBuilder {
@@ -59,9 +59,9 @@ public abstract class AbstractCompilerFactoryBuilder {
     protected IPredicateEvaluatorFactoryProvider predEvaluatorFactoryProvider;
     protected IExpressionRuntimeProvider expressionRuntimeProvider;
     protected IExpressionTypeComputer expressionTypeComputer;
-    protected INullableTypeComputer nullableTypeComputer;
+    protected IMissableTypeComputer missableTypeComputer;
     protected IExpressionEvalSizeComputer expressionEvalSizeComputer;
-    protected INullWriterFactory nullWriterFactory;
+    protected IMissingWriterFactory missingWriterFactory;
     protected INormalizedKeyComputerFactoryProvider normalizedKeyComputerFactoryProvider;
     protected IPartialAggregationTypeComputer partialAggregationTypeComputer;
     protected IMergeAggregationExpressionFactory mergeAggregationExpressionFactory;
@@ -174,12 +174,12 @@ public abstract class AbstractCompilerFactoryBuilder {
         return clusterLocations;
     }
 
-    public void setNullWriterFactory(INullWriterFactory nullWriterFactory) {
-        this.nullWriterFactory = nullWriterFactory;
+    public void setMissingWriterFactory(IMissingWriterFactory missingWriterFactory) {
+        this.missingWriterFactory = missingWriterFactory;
     }
 
-    public INullWriterFactory getNullWriterFactory() {
-        return nullWriterFactory;
+    public IMissingWriterFactory getMissingWriterFactory() {
+        return missingWriterFactory;
     }
 
     public void setExpressionEvalSizeComputer(IExpressionEvalSizeComputer expressionEvalSizeComputer) {
@@ -224,12 +224,12 @@ public abstract class AbstractCompilerFactoryBuilder {
         this.physicalOptimizationConfig = physicalOptimizationConfig;
     }
 
-    public void setNullableTypeComputer(INullableTypeComputer nullableTypeComputer) {
-        this.nullableTypeComputer = nullableTypeComputer;
+    public void setMissableTypeComputer(IMissableTypeComputer missableTypeComputer) {
+        this.missableTypeComputer = missableTypeComputer;
     }
 
-    public INullableTypeComputer getNullableTypeComputer() {
-        return nullableTypeComputer;
+    public IMissableTypeComputer getMissableTypeComputer() {
+        return missableTypeComputer;
     }
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/535d86b5/hyracks-fullstack/algebricks/algebricks-compiler/src/main/java/org/apache/hyracks/algebricks/compiler/api/HeuristicCompilerFactoryBuilder.java
----------------------------------------------------------------------
diff --git a/hyracks-fullstack/algebricks/algebricks-compiler/src/main/java/org/apache/hyracks/algebricks/compiler/api/HeuristicCompilerFactoryBuilder.java b/hyracks-fullstack/algebricks/algebricks-compiler/src/main/java/org/apache/hyracks/algebricks/compiler/api/HeuristicCompilerFactoryBuilder.java
index 1d3a55c..09982a0 100644
--- a/hyracks-fullstack/algebricks/algebricks-compiler/src/main/java/org/apache/hyracks/algebricks/compiler/api/HeuristicCompilerFactoryBuilder.java
+++ b/hyracks-fullstack/algebricks/algebricks-compiler/src/main/java/org/apache/hyracks/algebricks/compiler/api/HeuristicCompilerFactoryBuilder.java
@@ -25,7 +25,7 @@ import org.apache.hyracks.algebricks.core.algebra.base.IOptimizationContext;
 import org.apache.hyracks.algebricks.core.algebra.expressions.IExpressionEvalSizeComputer;
 import org.apache.hyracks.algebricks.core.algebra.expressions.IExpressionTypeComputer;
 import org.apache.hyracks.algebricks.core.algebra.expressions.IMergeAggregationExpressionFactory;
-import org.apache.hyracks.algebricks.core.algebra.expressions.INullableTypeComputer;
+import org.apache.hyracks.algebricks.core.algebra.expressions.IMissableTypeComputer;
 import org.apache.hyracks.algebricks.core.algebra.metadata.IMetadataProvider;
 import org.apache.hyracks.algebricks.core.algebra.prettyprint.LogicalOperatorPrettyPrintVisitor;
 import org.apache.hyracks.algebricks.core.config.AlgebricksConfig;
@@ -51,11 +51,11 @@ public class HeuristicCompilerFactoryBuilder extends AbstractCompilerFactoryBuil
         public IOptimizationContext createOptimizationContext(int varCounter,
                 IExpressionEvalSizeComputer expressionEvalSizeComputer,
                 IMergeAggregationExpressionFactory mergeAggregationExpressionFactory,
-                IExpressionTypeComputer expressionTypeComputer, INullableTypeComputer nullableTypeComputer,
+                IExpressionTypeComputer expressionTypeComputer, IMissableTypeComputer missableTypeComputer,
                 PhysicalOptimizationConfig physicalOptimizationConfig, AlgebricksPartitionConstraint clusterLocations) {
             LogicalOperatorPrettyPrintVisitor prettyPrintVisitor = new LogicalOperatorPrettyPrintVisitor();
             return new AlgebricksOptimizationContext(varCounter, expressionEvalSizeComputer,
-                    mergeAggregationExpressionFactory, expressionTypeComputer, nullableTypeComputer,
+                    mergeAggregationExpressionFactory, expressionTypeComputer, missableTypeComputer,
                     physicalOptimizationConfig, clusterLocations, prettyPrintVisitor);
         }
     }
@@ -78,7 +78,7 @@ public class HeuristicCompilerFactoryBuilder extends AbstractCompilerFactoryBuil
                     int varCounter) {
                 final IOptimizationContext oc = optCtxFactory.createOptimizationContext(varCounter,
                         expressionEvalSizeComputer, mergeAggregationExpressionFactory, expressionTypeComputer,
-                        nullableTypeComputer, physicalOptimizationConfig, clusterLocations);
+                        missableTypeComputer, physicalOptimizationConfig, clusterLocations);
                 oc.setMetadataDeclarations(metadata);
                 final HeuristicOptimizer opt = new HeuristicOptimizer(plan, logicalRewrites, physicalRewrites, oc);
                 return new ICompiler() {
@@ -95,9 +95,9 @@ public class HeuristicCompilerFactoryBuilder extends AbstractCompilerFactoryBuil
                         JobGenContext context = new JobGenContext(null, metadata, appContext,
                                 serializerDeserializerProvider, hashFunctionFactoryProvider, hashFunctionFamilyProvider,
                                 comparatorFactoryProvider, typeTraitProvider, binaryBooleanInspectorFactory,
-                                binaryIntegerInspectorFactory, printerProvider, nullWriterFactory,
+                                binaryIntegerInspectorFactory, printerProvider, missingWriterFactory,
                                 normalizedKeyComputerFactoryProvider, expressionRuntimeProvider, expressionTypeComputer,
-                                nullableTypeComputer, oc, expressionEvalSizeComputer, partialAggregationTypeComputer,
+                                oc, expressionEvalSizeComputer, partialAggregationTypeComputer,
                                 predEvaluatorFactoryProvider, physicalOptimizationConfig.getFrameSize(),
                                 clusterLocations);
 

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/535d86b5/hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/algebra/expressions/ConstantExpression.java
----------------------------------------------------------------------
diff --git a/hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/algebra/expressions/ConstantExpression.java b/hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/algebra/expressions/ConstantExpression.java
index 449688b..33da4f9 100644
--- a/hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/algebra/expressions/ConstantExpression.java
+++ b/hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/algebra/expressions/ConstantExpression.java
@@ -24,7 +24,6 @@ import java.util.List;
 import java.util.Map;
 
 import org.apache.commons.lang3.mutable.Mutable;
-
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.base.ILogicalExpression;
 import org.apache.hyracks.algebricks.core.algebra.base.LogicalExpressionTag;
@@ -42,6 +41,11 @@ public final class ConstantExpression extends AbstractLogicalExpression {
         }
 
         @Override
+        public boolean isMissing() {
+            return false;
+        }
+
+        @Override
         public boolean isNull() {
             return false;
         }
@@ -64,6 +68,11 @@ public final class ConstantExpression extends AbstractLogicalExpression {
         }
 
         @Override
+        public boolean isMissing() {
+            return false;
+        }
+
+        @Override
         public boolean isNull() {
             return false;
         }
@@ -78,7 +87,7 @@ public final class ConstantExpression extends AbstractLogicalExpression {
             return "FALSE";
         }
     });
-    public final static ConstantExpression NULL = new ConstantExpression(new IAlgebricksConstantValue() {
+    public final static ConstantExpression MISSING = new ConstantExpression(new IAlgebricksConstantValue() {
 
         @Override
         public boolean isTrue() {
@@ -86,18 +95,23 @@ public final class ConstantExpression extends AbstractLogicalExpression {
         }
 
         @Override
-        public boolean isNull() {
+        public boolean isMissing() {
             return true;
         }
 
         @Override
+        public boolean isNull() {
+            return false;
+        }
+
+        @Override
         public boolean isFalse() {
             return false;
         }
 
         @Override
         public String toString() {
-            return "NULL";
+            return "MISSING";
         }
     });
 

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/535d86b5/hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/algebra/expressions/IAlgebricksConstantValue.java
----------------------------------------------------------------------
diff --git a/hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/algebra/expressions/IAlgebricksConstantValue.java b/hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/algebra/expressions/IAlgebricksConstantValue.java
index f80f82b..e6e2834 100644
--- a/hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/algebra/expressions/IAlgebricksConstantValue.java
+++ b/hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/algebra/expressions/IAlgebricksConstantValue.java
@@ -19,6 +19,8 @@
 package org.apache.hyracks.algebricks.core.algebra.expressions;
 
 public interface IAlgebricksConstantValue {
+    public boolean isMissing();
+
     public boolean isNull();
 
     public boolean isTrue();

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/535d86b5/hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/algebra/expressions/IMissableTypeComputer.java
----------------------------------------------------------------------
diff --git a/hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/algebra/expressions/IMissableTypeComputer.java b/hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/algebra/expressions/IMissableTypeComputer.java
new file mode 100644
index 0000000..029f41a
--- /dev/null
+++ b/hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/algebra/expressions/IMissableTypeComputer.java
@@ -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.
+ */
+package org.apache.hyracks.algebricks.core.algebra.expressions;
+
+import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
+
+public interface IMissableTypeComputer {
+    public Object makeMissableType(Object type) throws AlgebricksException;
+
+    public boolean canBeMissing(Object type);
+
+    public Object getNonOptionalType(Object type);
+}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/535d86b5/hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/algebra/expressions/INullableTypeComputer.java
----------------------------------------------------------------------
diff --git a/hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/algebra/expressions/INullableTypeComputer.java b/hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/algebra/expressions/INullableTypeComputer.java
deleted file mode 100644
index 2aea6b0..0000000
--- a/hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/algebra/expressions/INullableTypeComputer.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * 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.
- */
-package org.apache.hyracks.algebricks.core.algebra.expressions;
-
-import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
-
-public interface INullableTypeComputer {
-    public Object makeNullableType(Object type) throws AlgebricksException;
-
-    public boolean canBeNull(Object type);
-
-    public Object getNonOptionalType(Object type);
-}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/535d86b5/hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/algebra/functions/AlgebricksBuiltinFunctions.java
----------------------------------------------------------------------
diff --git a/hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/algebra/functions/AlgebricksBuiltinFunctions.java b/hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/algebra/functions/AlgebricksBuiltinFunctions.java
index 874b751..07e4f98 100644
--- a/hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/algebra/functions/AlgebricksBuiltinFunctions.java
+++ b/hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/algebra/functions/AlgebricksBuiltinFunctions.java
@@ -50,6 +50,9 @@ public class AlgebricksBuiltinFunctions {
     // numerics
     public final static FunctionIdentifier NUMERIC_ADD = new FunctionIdentifier(ALGEBRICKS_NS, "numeric-add", 2);
 
+    // missings
+    public final static FunctionIdentifier IS_MISSING = new FunctionIdentifier(ALGEBRICKS_NS, "is-missing", 1);
+
     // nulls
     public final static FunctionIdentifier IS_NULL = new FunctionIdentifier(ALGEBRICKS_NS, "is-null", 1);
 

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/535d86b5/hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/algebra/operators/logical/AbstractLogicalOperator.java
----------------------------------------------------------------------
diff --git a/hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/algebra/operators/logical/AbstractLogicalOperator.java b/hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/algebra/operators/logical/AbstractLogicalOperator.java
index 61a2353..1a7e224 100644
--- a/hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/algebra/operators/logical/AbstractLogicalOperator.java
+++ b/hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/algebra/operators/logical/AbstractLogicalOperator.java
@@ -190,7 +190,7 @@ public abstract class AbstractLogicalOperator implements ILogicalOperator {
         for (int i = 0; i < n; i++) {
             envPointers[i] = new OpRefTypeEnvPointer(inputs.get(i), ctx);
         }
-        return new PropagatingTypeEnvironment(ctx.getExpressionTypeComputer(), ctx.getNullableTypeComputer(),
+        return new PropagatingTypeEnvironment(ctx.getExpressionTypeComputer(), ctx.getMissableTypeComputer(),
                 ctx.getMetadataProvider(), TypePropagationPolicy.ALL, envPointers);
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/535d86b5/hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/algebra/operators/logical/GroupByOperator.java
----------------------------------------------------------------------
diff --git a/hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/algebra/operators/logical/GroupByOperator.java b/hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/algebra/operators/logical/GroupByOperator.java
index 1d26148..5b0fd14 100644
--- a/hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/algebra/operators/logical/GroupByOperator.java
+++ b/hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/algebra/operators/logical/GroupByOperator.java
@@ -256,7 +256,7 @@ public class GroupByOperator extends AbstractOperatorWithNestedPlans {
             }
         }
         IVariableTypeEnvironment env = new PropagatingTypeEnvironment(ctx.getExpressionTypeComputer(),
-                ctx.getNullableTypeComputer(), ctx.getMetadataProvider(), TypePropagationPolicy.ALL, envPointers);
+                ctx.getMissableTypeComputer(), ctx.getMetadataProvider(), TypePropagationPolicy.ALL, envPointers);
         ILogicalOperator child = inputs.get(0).getValue();
         IVariableTypeEnvironment env2 = ctx.getOutputTypeEnvironment(child);
         for (Pair<LogicalVariable, Mutable<ILogicalExpression>> p : getGroupByList()) {

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/535d86b5/hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/algebra/operators/logical/LeftOuterJoinOperator.java
----------------------------------------------------------------------
diff --git a/hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/algebra/operators/logical/LeftOuterJoinOperator.java b/hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/algebra/operators/logical/LeftOuterJoinOperator.java
index b5e4330..9470ab8 100644
--- a/hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/algebra/operators/logical/LeftOuterJoinOperator.java
+++ b/hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/algebra/operators/logical/LeftOuterJoinOperator.java
@@ -22,7 +22,6 @@ import java.util.ArrayList;
 import java.util.List;
 
 import org.apache.commons.lang3.mutable.Mutable;
-
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.base.ILogicalExpression;
 import org.apache.hyracks.algebricks.core.algebra.base.ILogicalOperator;
@@ -66,7 +65,8 @@ public class LeftOuterJoinOperator extends AbstractBinaryJoinOperator {
             envPointers[i] = new OpRefTypeEnvPointer(inputs.get(i), ctx);
         }
         PropagatingTypeEnvironment env = new PropagatingTypeEnvironment(ctx.getExpressionTypeComputer(),
-                ctx.getNullableTypeComputer(), ctx.getMetadataProvider(), TypePropagationPolicy.LEFT_OUTER, envPointers);
+                ctx.getMissableTypeComputer(), ctx.getMetadataProvider(), TypePropagationPolicy.LEFT_OUTER,
+                envPointers);
         List<LogicalVariable> liveVars = new ArrayList<LogicalVariable>();
         VariableUtilities.getLiveVariables(inputs.get(1).getValue(), liveVars); // live variables from outer branch can be null together
         env.getCorrelatedNullableVariableLists().add(liveVars);

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/535d86b5/hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/algebra/operators/logical/LeftOuterUnnestMapOperator.java
----------------------------------------------------------------------
diff --git a/hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/algebra/operators/logical/LeftOuterUnnestMapOperator.java b/hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/algebra/operators/logical/LeftOuterUnnestMapOperator.java
index 56e2dfb..fbd8619 100644
--- a/hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/algebra/operators/logical/LeftOuterUnnestMapOperator.java
+++ b/hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/algebra/operators/logical/LeftOuterUnnestMapOperator.java
@@ -65,7 +65,7 @@ public class LeftOuterUnnestMapOperator extends AbstractUnnestMapOperator {
         // For the variables from the inner branch, the output type is the union
         // of (original type + null).
         for (int i = 0; i < variables.size(); i++) {
-            env.setVarType(variables.get(i), ctx.getNullableTypeComputer().makeNullableType(variableTypes.get(i)));
+            env.setVarType(variables.get(i), ctx.getMissableTypeComputer().makeMissableType(variableTypes.get(i)));
         }
 
         return env;

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/535d86b5/hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/algebra/operators/logical/NestedTupleSourceOperator.java
----------------------------------------------------------------------
diff --git a/hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/algebra/operators/logical/NestedTupleSourceOperator.java b/hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/algebra/operators/logical/NestedTupleSourceOperator.java
index 2b66e8f..35da55b 100644
--- a/hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/algebra/operators/logical/NestedTupleSourceOperator.java
+++ b/hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/algebra/operators/logical/NestedTupleSourceOperator.java
@@ -103,7 +103,7 @@ public class NestedTupleSourceOperator extends AbstractLogicalOperator {
                 return ctx.getOutputTypeEnvironment(op);
             }
         };
-        return new PropagatingTypeEnvironment(ctx.getExpressionTypeComputer(), ctx.getNullableTypeComputer(),
+        return new PropagatingTypeEnvironment(ctx.getExpressionTypeComputer(), ctx.getMissableTypeComputer(),
                 ctx.getMetadataProvider(), TypePropagationPolicy.ALL, p);
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/535d86b5/hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/algebra/operators/logical/SelectOperator.java
----------------------------------------------------------------------
diff --git a/hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/algebra/operators/logical/SelectOperator.java b/hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/algebra/operators/logical/SelectOperator.java
index 8a8d1f2..e8a9670 100644
--- a/hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/algebra/operators/logical/SelectOperator.java
+++ b/hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/algebra/operators/logical/SelectOperator.java
@@ -21,7 +21,6 @@ package org.apache.hyracks.algebricks.core.algebra.operators.logical;
 import java.util.ArrayList;
 
 import org.apache.commons.lang3.mutable.Mutable;
-
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.base.ILogicalExpression;
 import org.apache.hyracks.algebricks.core.algebra.base.LogicalExpressionTag;
@@ -45,7 +44,8 @@ public class SelectOperator extends AbstractLogicalOperator {
     private final boolean retainNull;
     private final LogicalVariable nullPlaceholderVar;
 
-    public SelectOperator(Mutable<ILogicalExpression> condition, boolean retainNull, LogicalVariable nullPlaceholderVar) {
+    public SelectOperator(Mutable<ILogicalExpression> condition, boolean retainNull,
+            LogicalVariable nullPlaceholderVar) {
         this.condition = condition;
         this.retainNull = retainNull;
         this.nullPlaceholderVar = nullPlaceholderVar;
@@ -98,20 +98,22 @@ public class SelectOperator extends AbstractLogicalOperator {
         ITypeEnvPointer[] envPointers = new ITypeEnvPointer[1];
         envPointers[0] = new OpRefTypeEnvPointer(inputs.get(0), ctx);
         PropagatingTypeEnvironment env = new PropagatingTypeEnvironment(ctx.getExpressionTypeComputer(),
-                ctx.getNullableTypeComputer(), ctx.getMetadataProvider(), TypePropagationPolicy.ALL, envPointers);
-        if (condition.getValue().getExpressionTag() == LogicalExpressionTag.FUNCTION_CALL) {
-            AbstractFunctionCallExpression f1 = (AbstractFunctionCallExpression) condition.getValue();
-            if (f1.getFunctionIdentifier().equals(AlgebricksBuiltinFunctions.NOT)) {
-                ILogicalExpression a1 = f1.getArguments().get(0).getValue();
-                if (a1.getExpressionTag() == LogicalExpressionTag.FUNCTION_CALL) {
-                    AbstractFunctionCallExpression f2 = (AbstractFunctionCallExpression) a1;
-                    if (f2.getFunctionIdentifier().equals(AlgebricksBuiltinFunctions.IS_NULL)) {
-                        ILogicalExpression a2 = f2.getArguments().get(0).getValue();
-                        if (a2.getExpressionTag() == LogicalExpressionTag.VARIABLE) {
-                            LogicalVariable var = ((VariableReferenceExpression) a2).getVariableReference();
-                            env.getNonNullVariables().add(var);
-                        }
-                    }
+                ctx.getMissableTypeComputer(), ctx.getMetadataProvider(), TypePropagationPolicy.ALL, envPointers);
+        if (condition.getValue().getExpressionTag() != LogicalExpressionTag.FUNCTION_CALL) {
+            return env;
+        }
+        AbstractFunctionCallExpression f1 = (AbstractFunctionCallExpression) condition.getValue();
+        if (!f1.getFunctionIdentifier().equals(AlgebricksBuiltinFunctions.NOT)) {
+            return env;
+        }
+        ILogicalExpression a1 = f1.getArguments().get(0).getValue();
+        if (a1.getExpressionTag() == LogicalExpressionTag.FUNCTION_CALL) {
+            AbstractFunctionCallExpression f2 = (AbstractFunctionCallExpression) a1;
+            if (f2.getFunctionIdentifier().equals(AlgebricksBuiltinFunctions.IS_MISSING)) {
+                ILogicalExpression a2 = f2.getArguments().get(0).getValue();
+                if (a2.getExpressionTag() == LogicalExpressionTag.VARIABLE) {
+                    LogicalVariable var = ((VariableReferenceExpression) a2).getVariableReference();
+                    env.getNonNullVariables().add(var);
                 }
             }
         }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/535d86b5/hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/algebra/operators/logical/SinkOperator.java
----------------------------------------------------------------------
diff --git a/hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/algebra/operators/logical/SinkOperator.java b/hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/algebra/operators/logical/SinkOperator.java
index af85fdd..5205959 100644
--- a/hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/algebra/operators/logical/SinkOperator.java
+++ b/hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/algebra/operators/logical/SinkOperator.java
@@ -75,7 +75,7 @@ public class SinkOperator extends AbstractLogicalOperator {
             envPointers[i] = new OpRefTypeEnvPointer(inputs.get(i), ctx);
         }
         PropagatingTypeEnvironment env = new PropagatingTypeEnvironment(ctx.getExpressionTypeComputer(),
-                ctx.getNullableTypeComputer(), ctx.getMetadataProvider(), TypePropagationPolicy.ALL, envPointers);
+                ctx.getMissableTypeComputer(), ctx.getMetadataProvider(), TypePropagationPolicy.ALL, envPointers);
         return env;
 
     }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/535d86b5/hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/algebra/operators/logical/SubplanOperator.java
----------------------------------------------------------------------
diff --git a/hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/algebra/operators/logical/SubplanOperator.java b/hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/algebra/operators/logical/SubplanOperator.java
index cf11b3e..9dcc402 100644
--- a/hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/algebra/operators/logical/SubplanOperator.java
+++ b/hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/algebra/operators/logical/SubplanOperator.java
@@ -108,7 +108,7 @@ public class SubplanOperator extends AbstractOperatorWithNestedPlans {
                 i++;
             }
         }
-        return new PropagatingTypeEnvironment(ctx.getExpressionTypeComputer(), ctx.getNullableTypeComputer(),
+        return new PropagatingTypeEnvironment(ctx.getExpressionTypeComputer(), ctx.getMissableTypeComputer(),
                 ctx.getMetadataProvider(), TypePropagationPolicy.LEFT_OUTER, envPointers);
     }
 


Mime
View raw message