asterixdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ima...@apache.org
Subject [1/9] incubator-asterixdb git commit: Changed metadata storage format for nullable field types. Moved field name generation to the client out of metadata node code. Changed naming scheme for autogenerated types. Moved GroupName, CompactionPolicy & Compac
Date Thu, 20 Aug 2015 02:27:46 GMT
Repository: incubator-asterixdb
Updated Branches:
  refs/heads/master bb24f4b39 -> a5895308d


http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/a5895308/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/UnorderedListConstructorResultType.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/UnorderedListConstructorResultType.java
b/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/UnorderedListConstructorResultType.java
index 90c013c..c019a30 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/UnorderedListConstructorResultType.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/UnorderedListConstructorResultType.java
@@ -19,7 +19,6 @@ import java.util.ArrayList;
 
 import edu.uci.ics.asterix.om.typecomputer.base.IResultTypeComputer;
 import edu.uci.ics.asterix.om.typecomputer.base.TypeComputerUtilities;
-import edu.uci.ics.asterix.om.types.ATypeTag;
 import edu.uci.ics.asterix.om.types.AUnionType;
 import edu.uci.ics.asterix.om.types.AUnorderedListType;
 import edu.uci.ics.asterix.om.types.BuiltinType;
@@ -50,8 +49,8 @@ public class UnorderedListConstructorResultType implements IResultTypeComputer
{
         ArrayList<IAType> types = new ArrayList<IAType>();
         for (int k = 0; k < f.getArguments().size(); k++) {
             IAType type = (IAType) env.getType(f.getArguments().get(k).getValue());
-            if (type.getTypeTag() == ATypeTag.UNION && NonTaggedFormatUtil.isOptionalField((AUnionType)
type))
-                type = ((AUnionType) type).getUnionList().get(AUnionType.OPTIONAL_TYPE_INDEX_IN_UNION_LIST);
+            if (NonTaggedFormatUtil.isOptional(type))
+                type = ((AUnionType) type).getNullableType();
             if (types.indexOf(type) < 0) {
                 types.add(type);
             }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/a5895308/asterix-om/src/main/java/edu/uci/ics/asterix/om/types/ARecordType.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/om/types/ARecordType.java b/asterix-om/src/main/java/edu/uci/ics/asterix/om/types/ARecordType.java
index f7e0a19..1a92573 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/om/types/ARecordType.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/om/types/ARecordType.java
@@ -252,8 +252,7 @@ public class ARecordType extends AbstractComplexType {
             }
             if (subRecordType.getTypeTag().equals(ATypeTag.UNION)) {
                 //enforced SubType
-                subRecordType = ((AUnionType) subRecordType).getUnionList().get(
-                        AUnionType.OPTIONAL_TYPE_INDEX_IN_UNION_LIST);
+                subRecordType = ((AUnionType) subRecordType).getNullableType();
                 if (subRecordType.getTypeTag().serialize() != ATypeTag.RECORD.serialize())
{
                     throw new IOException("Field accessor is not defined for values of type
"
                             + subRecordType.getTypeTag());
@@ -566,6 +565,18 @@ public class ARecordType extends AbstractComplexType {
     }
 
     @Override
+    public void generateNestedDerivedTypeNames() {
+        for (int i = 0; i < fieldTypes.length; i++) {
+            IAType fieldType = fieldTypes[i];
+            if (fieldType.getTypeTag().isDerivedType() && fieldType.getTypeName()
== null) {
+                AbstractComplexType nestedType = ((AbstractComplexType) fieldType);
+                nestedType.setTypeName(getTypeName() + "_" + fieldNames[i]);
+                nestedType.generateNestedDerivedTypeNames();
+            }
+        }
+    }
+
+    @Override
     public boolean deepEqual(IAObject obj) {
         if (!(obj instanceof ARecordType)) {
             return false;

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/a5895308/asterix-om/src/main/java/edu/uci/ics/asterix/om/types/AUnionType.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/om/types/AUnionType.java b/asterix-om/src/main/java/edu/uci/ics/asterix/om/types/AUnionType.java
index 21e24fe..9425cf2 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/om/types/AUnionType.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/om/types/AUnionType.java
@@ -49,6 +49,10 @@ public class AUnionType extends AbstractComplexType {
         return unionList.size() == 2 && unionList.get(0).equals(BuiltinType.ANULL);
     }
 
+    public IAType getNullableType() {
+        return unionList.get(AUnionType.OPTIONAL_TYPE_INDEX_IN_UNION_LIST);
+    }
+
     @Override
     public String getDisplayName() {
         return "AUnion";
@@ -85,12 +89,29 @@ public class AUnionType extends AbstractComplexType {
         return BuiltinType.ASTERIX_TYPE;
     }
 
-    public static AUnionType createNullableType(IAType t) {
+    public static AUnionType createNullableType(IAType type, String typeName) {
         List<IAType> unionList = new ArrayList<IAType>();
         unionList.add(BuiltinType.ANULL);
-        unionList.add(t);
-        String s = t.getDisplayName();
-        return new AUnionType(unionList, s == null ? null : s + "?");
+        unionList.add(type);
+        return new AUnionType(unionList, typeName);
+    }
+
+    public static AUnionType createNullableType(IAType t) {
+        String s = t != null ? t.getTypeName() : null;
+        return createNullableType(t, s == null ? null : s + "?");
+    }
+
+    @Override
+    public void generateNestedDerivedTypeNames() {
+        if (isNullableType()) {
+            IAType nullableType = getNullableType();
+            if (nullableType.getTypeTag().isDerivedType() && nullableType.getTypeName()
== null) {
+                AbstractComplexType derivedType = (AbstractComplexType) nullableType;
+                derivedType.setTypeName(getTypeName());
+                derivedType.generateNestedDerivedTypeNames();
+            }
+
+        }
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/a5895308/asterix-om/src/main/java/edu/uci/ics/asterix/om/types/AbstractCollectionType.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/om/types/AbstractCollectionType.java
b/asterix-om/src/main/java/edu/uci/ics/asterix/om/types/AbstractCollectionType.java
index 2895c53..0252964 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/om/types/AbstractCollectionType.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/om/types/AbstractCollectionType.java
@@ -50,6 +50,14 @@ public abstract class AbstractCollectionType extends AbstractComplexType
{
         visitor.visitAType(this);
     }
 
+    @Override
+    public void generateNestedDerivedTypeNames() {
+        if (itemType.getTypeTag().isDerivedType() && itemType.getTypeName() == null)
{
+            AbstractComplexType nestedType = ((AbstractComplexType) itemType);
+            nestedType.setTypeName(getTypeName() + "_Item");
+            nestedType.generateNestedDerivedTypeNames();
+        }
+    }
     // public void serialize(DataOutput out) throws IOException {
     // out.writeBoolean(isTyped());
     // }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/a5895308/asterix-om/src/main/java/edu/uci/ics/asterix/om/types/AbstractComplexType.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/om/types/AbstractComplexType.java
b/asterix-om/src/main/java/edu/uci/ics/asterix/om/types/AbstractComplexType.java
index ba98a9e..f8f044d 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/om/types/AbstractComplexType.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/om/types/AbstractComplexType.java
@@ -34,6 +34,8 @@ public abstract class AbstractComplexType implements IAType {
         this.typeName = typeName;
     }
 
+    public abstract void generateNestedDerivedTypeNames();
+
     @Override
     public boolean equals(Object object) {
         return this.deepEqual((IAObject) object);

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/a5895308/asterix-om/src/main/java/edu/uci/ics/asterix/om/util/NonTaggedFormatUtil.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/om/util/NonTaggedFormatUtil.java
b/asterix-om/src/main/java/edu/uci/ics/asterix/om/util/NonTaggedFormatUtil.java
index db83bf3..2416aa0 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/om/util/NonTaggedFormatUtil.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/om/util/NonTaggedFormatUtil.java
@@ -51,11 +51,10 @@ public final class NonTaggedFormatUtil {
             case ANY:
                 return false;
             case UNION:
-                if (!NonTaggedFormatUtil.isOptionalField((AUnionType) type))
+                if (!((AUnionType) type).isNullableType())
                     return false;
                 else
-                    return isFixedSizedCollection(((AUnionType) type).getUnionList().get(
-                            AUnionType.OPTIONAL_TYPE_INDEX_IN_UNION_LIST));
+                    return isFixedSizedCollection(((AUnionType) type).getNullableType());
             default:
                 return true;
         }
@@ -81,11 +80,14 @@ public final class NonTaggedFormatUtil {
         return false;
     }
 
-    public static boolean isOptionalField(AUnionType unionType) {
-        if (unionType.getUnionList().size() == 2)
-            if (unionType.getUnionList().get(0).getTypeTag() == ATypeTag.NULL)
-                return true;
-        return false;
+    /**
+     * Decide whether a type is an optional type
+     *
+     * @param type
+     * @return true if it is optional; false otherwise
+     */
+    public static boolean isOptional(IAType type) {
+        return type.getTypeTag() == ATypeTag.UNION && ((AUnionType) type).isNullableType();
     }
 
     public static int getFieldValueLength(byte[] serNonTaggedAObject, int offset, ATypeTag
typeTag, boolean tagged)
@@ -206,33 +208,27 @@ public final class NonTaggedFormatUtil {
         }
     }
 
-    public static IAType getTokenType(IAType keyType)
-            throws AlgebricksException {
+    public static IAType getTokenType(IAType keyType) throws AlgebricksException {
         IAType type = keyType;
         ATypeTag typeTag = keyType.getTypeTag();
         // Extract item type from list.
-        if (typeTag == ATypeTag.UNORDEREDLIST
-                || typeTag == ATypeTag.ORDEREDLIST) {
+        if (typeTag == ATypeTag.UNORDEREDLIST || typeTag == ATypeTag.ORDEREDLIST) {
             AbstractCollectionType listType = (AbstractCollectionType) keyType;
             if (!listType.isTyped()) {
-                throw new AlgebricksException(
-                        "Cannot build an inverted index on untyped lists.)");
+                throw new AlgebricksException("Cannot build an inverted index on untyped
lists.)");
             }
             type = listType.getItemType();
         }
         return type;
     }
 
-    public static IBinaryComparatorFactory getTokenBinaryComparatorFactory(
-            IAType keyType) throws AlgebricksException {
+    public static IBinaryComparatorFactory getTokenBinaryComparatorFactory(IAType keyType)
throws AlgebricksException {
         IAType type = getTokenType(keyType);
         // Ignore case for string types.
-        return AqlBinaryComparatorFactoryProvider.INSTANCE
-                .getBinaryComparatorFactory(type, true, true);
+        return AqlBinaryComparatorFactoryProvider.INSTANCE.getBinaryComparatorFactory(type,
true, true);
     }
 
-    public static ITypeTraits getTokenTypeTrait(IAType keyType)
-            throws AlgebricksException {
+    public static ITypeTraits getTokenTypeTrait(IAType keyType) throws AlgebricksException
{
         IAType type = getTokenType(keyType);
         return AqlTypeTraitProvider.INSTANCE.getTypeTrait(type);
     }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/a5895308/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/records/FieldAccessByIndexEvalFactory.java
----------------------------------------------------------------------
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/records/FieldAccessByIndexEvalFactory.java
b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/records/FieldAccessByIndexEvalFactory.java
index 2b9f666..5e7a4ea 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/records/FieldAccessByIndexEvalFactory.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/records/FieldAccessByIndexEvalFactory.java
@@ -108,9 +108,8 @@ public class FieldAccessByIndexEvalFactory implements ICopyEvaluatorFactory
{
 
                     fieldValueType = recordType.getFieldTypes()[fieldIndex];
                     if (fieldValueType.getTypeTag().equals(ATypeTag.UNION)) {
-                        if (NonTaggedFormatUtil.isOptionalField((AUnionType) fieldValueType))
{
-                            fieldValueTypeTag = ((AUnionType) fieldValueType).getUnionList()
-                                    .get(AUnionType.OPTIONAL_TYPE_INDEX_IN_UNION_LIST).getTypeTag();
+                        if (((AUnionType) fieldValueType).isNullableType()) {
+                            fieldValueTypeTag = ((AUnionType) fieldValueType).getNullableType().getTypeTag();
                             fieldValueLength = NonTaggedFormatUtil.getFieldValueLength(serRecord,
fieldValueOffset,
                                     fieldValueTypeTag, false);
                             out.writeByte(fieldValueTypeTag.serialize());

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/a5895308/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/records/FieldAccessUtil.java
----------------------------------------------------------------------
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/records/FieldAccessUtil.java
b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/records/FieldAccessUtil.java
index ef790fc..f12a901 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/records/FieldAccessUtil.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/records/FieldAccessUtil.java
@@ -109,7 +109,7 @@ public class FieldAccessUtil {
             for (; i < abvsFields.length; i++) {
                 if (subType.getTypeTag().equals(ATypeTag.UNION)) {
                     //enforced SubType
-                    subType = ((AUnionType) subType).getUnionList().get(AUnionType.OPTIONAL_TYPE_INDEX_IN_UNION_LIST);
+                    subType = ((AUnionType) subType).getNullableType();
                     if (subType.getTypeTag().serialize() != SER_RECORD_TYPE_TAG) {
                         throw new AlgebricksException("Field accessor is not defined for
values of type " + subTypeTag);
                     }
@@ -130,9 +130,8 @@ public class FieldAccessUtil {
                 }
                 subType = ((ARecordType) subType).getFieldTypes()[subFieldIndex];
                 if (subType.getTypeTag().equals(ATypeTag.UNION)) {
-                    if (NonTaggedFormatUtil.isOptionalField((AUnionType) subType)) {
-                        subTypeTag = ((AUnionType) subType).getUnionList()
-                                .get(AUnionType.OPTIONAL_TYPE_INDEX_IN_UNION_LIST).getTypeTag();
+                    if (((AUnionType) subType).isNullableType()) {
+                        subTypeTag = ((AUnionType) subType).getNullableType().getTypeTag();
                         subFieldLength = NonTaggedFormatUtil.getFieldValueLength(subRecord,
subFieldOffset, subTypeTag,
                                 false);
                     } else {

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/a5895308/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/formats/NonTaggedDataFormat.java
----------------------------------------------------------------------
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/formats/NonTaggedDataFormat.java
b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/formats/NonTaggedDataFormat.java
index ca6fb4d..64775f0 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/formats/NonTaggedDataFormat.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/formats/NonTaggedDataFormat.java
@@ -904,8 +904,7 @@ public class NonTaggedDataFormat implements IDataFormat {
                 IAType itemType = (IAType) context.getType(f.getArguments().get(0).getValue());
                 if (itemType instanceof AUnionType) {
                     if (((AUnionType) itemType).isNullableType())
-                        itemType = ((AUnionType) itemType).getUnionList().get(
-                                AUnionType.OPTIONAL_TYPE_INDEX_IN_UNION_LIST);
+                        itemType = ((AUnionType) itemType).getNullableType();
                     else
                         // Convert UNION types into ANY.
                         itemType = BuiltinType.ANY;
@@ -969,7 +968,7 @@ public class NonTaggedDataFormat implements IDataFormat {
                 case UNION: {
                     AUnionType unionT = (AUnionType) t;
                     if (unionT.isNullableType()) {
-                        IAType t2 = unionT.getUnionList().get(1);
+                        IAType t2 = unionT.getNullableType();
                         if (t2.getTypeTag() == ATypeTag.RECORD) {
                             ARecordType recType = (ARecordType) t2;
                             ((FieldAccessByIndexDescriptor) fd).reset(recType);

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/a5895308/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/operators/file/ADMDataParser.java
----------------------------------------------------------------------
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/operators/file/ADMDataParser.java
b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/operators/file/ADMDataParser.java
index e7198d3..09f0a26 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/operators/file/ADMDataParser.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/operators/file/ADMDataParser.java
@@ -607,11 +607,9 @@ public class ADMDataParser extends AbstractDataParser {
                         if (fieldValueBuffer.getByteArray()[0] != ATypeTag.NULL.serialize())
{
                             recBuilder.addField(fieldNameBuffer, fieldValueBuffer);
                         }
-                    } else if (recType.getFieldTypes()[fieldId].getTypeTag() == ATypeTag.UNION)
{
-                        if (NonTaggedFormatUtil.isOptionalField((AUnionType) recType.getFieldTypes()[fieldId]))
{
-                            if (fieldValueBuffer.getByteArray()[0] != ATypeTag.NULL.serialize())
{
-                                recBuilder.addField(fieldId, fieldValueBuffer);
-                            }
+                    } else if (NonTaggedFormatUtil.isOptional(recType)) {
+                        if (fieldValueBuffer.getByteArray()[0] != ATypeTag.NULL.serialize())
{
+                            recBuilder.addField(fieldId, fieldValueBuffer);
                         }
                     } else {
                         recBuilder.addField(fieldId, fieldValueBuffer);

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/a5895308/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/operators/file/DelimitedDataParser.java
----------------------------------------------------------------------
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/operators/file/DelimitedDataParser.java
b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/operators/file/DelimitedDataParser.java
index fc38d37..f9f2952 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/operators/file/DelimitedDataParser.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/operators/file/DelimitedDataParser.java
@@ -27,7 +27,6 @@ import edu.uci.ics.asterix.om.base.AMutableString;
 import edu.uci.ics.asterix.om.base.ANull;
 import edu.uci.ics.asterix.om.types.ARecordType;
 import edu.uci.ics.asterix.om.types.ATypeTag;
-import edu.uci.ics.asterix.om.types.AUnionType;
 import edu.uci.ics.asterix.om.util.NonTaggedFormatUtil;
 import edu.uci.ics.hyracks.api.exceptions.HyracksDataException;
 import edu.uci.ics.hyracks.data.std.util.ArrayBackedValueStorage;
@@ -113,7 +112,7 @@ public class DelimitedDataParser extends AbstractDataParser implements
IDataPars
             recBuilder.reset(recordType);
             recBuilder.init();
             areAllNullFields = true;
-            
+
             for (int i = 0; i < valueParsers.length; ++i) {
                 if (!cursor.nextField()) {
                     break;
@@ -125,8 +124,7 @@ public class DelimitedDataParser extends AbstractDataParser implements
IDataPars
                     // if the field is empty and the type is optional, insert
                     // NULL. Note that string type can also process empty field as an
                     // empty string
-                    if (recordType.getFieldTypes()[i].getTypeTag() != ATypeTag.UNION
-                            || !NonTaggedFormatUtil.isOptionalField((AUnionType) recordType.getFieldTypes()[i]))
{
+                    if (!NonTaggedFormatUtil.isOptional(recordType.getFieldTypes()[i])) {
                         throw new AsterixException("At record: " + cursor.recordCount + "
- Field " + cursor.fieldCount
                                 + " is not an optional type so it cannot accept null value.
");
                     }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/a5895308/asterix-tools/src/main/java/edu/uci/ics/asterix/tools/datagen/AdmDataGen.java
----------------------------------------------------------------------
diff --git a/asterix-tools/src/main/java/edu/uci/ics/asterix/tools/datagen/AdmDataGen.java
b/asterix-tools/src/main/java/edu/uci/ics/asterix/tools/datagen/AdmDataGen.java
index 2c2f44d..d794ec1 100644
--- a/asterix-tools/src/main/java/edu/uci/ics/asterix/tools/datagen/AdmDataGen.java
+++ b/asterix-tools/src/main/java/edu/uci/ics/asterix/tools/datagen/AdmDataGen.java
@@ -61,6 +61,7 @@ import edu.uci.ics.asterix.om.types.AbstractCollectionType;
 import edu.uci.ics.asterix.om.types.BuiltinType;
 import edu.uci.ics.asterix.om.types.IAType;
 import edu.uci.ics.asterix.om.types.TypeSignature;
+import edu.uci.ics.asterix.om.util.NonTaggedFormatUtil;
 import edu.uci.ics.asterix.tools.translator.ADGenDmlTranslator;
 import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
 import edu.uci.ics.hyracks.algebricks.common.exceptions.NotImplementedException;
@@ -665,12 +666,9 @@ public class AdmDataGen {
                 nullable = new boolean[m];
                 for (int i = 0; i < m; i++) {
                     IAType ti = recType.getFieldTypes()[i];
-                    if (ti.getTypeTag() == ATypeTag.UNION) {
-                        AUnionType ut = (AUnionType) ti;
-                        if (ut.isNullableType()) {
-                            ti = ut.getUnionList().get(1);
-                            nullable[i] = true;
-                        }
+                    if (NonTaggedFormatUtil.isOptional(ti)) {
+                        ti = ((AUnionType) ti).getNullableType();
+                        nullable[i] = true;
                     }
                     IRecordFieldDataGen rfdg = annot.getDeclaredFieldsDatagen()[i];
                     if (rfdg == null) {


Mime
View raw message