Search in sources :

Example 1 with BuiltinType

use of org.apache.asterix.om.types.BuiltinType in project asterixdb by apache.

the class MetadataNode method getNestedComplexDatatypeNamesForThisDatatype.

private List<String> getNestedComplexDatatypeNamesForThisDatatype(JobId jobId, String dataverseName, String datatypeName) throws MetadataException, RemoteException {
    //Return all field types that aren't builtin types
    Datatype parentType = getDatatype(jobId, dataverseName, datatypeName);
    List<IAType> subTypes = null;
    if (parentType.getDatatype().getTypeTag() == ATypeTag.OBJECT) {
        ARecordType recType = (ARecordType) parentType.getDatatype();
        subTypes = Arrays.asList(recType.getFieldTypes());
    } else if (parentType.getDatatype().getTypeTag() == ATypeTag.UNION) {
        AUnionType recType = (AUnionType) parentType.getDatatype();
        subTypes = recType.getUnionList();
    }
    List<String> nestedTypes = new ArrayList<>();
    if (subTypes != null) {
        for (IAType subType : subTypes) {
            if (!(subType instanceof BuiltinType)) {
                nestedTypes.add(subType.getTypeName());
            }
        }
    }
    return nestedTypes;
}
Also used : BuiltinType(org.apache.asterix.om.types.BuiltinType) AUnionType(org.apache.asterix.om.types.AUnionType) ArrayList(java.util.ArrayList) AString(org.apache.asterix.om.base.AString) AMutableString(org.apache.asterix.om.base.AMutableString) ARecordType(org.apache.asterix.om.types.ARecordType) Datatype(org.apache.asterix.metadata.entities.Datatype) IAType(org.apache.asterix.om.types.IAType)

Aggregations

ArrayList (java.util.ArrayList)1 Datatype (org.apache.asterix.metadata.entities.Datatype)1 AMutableString (org.apache.asterix.om.base.AMutableString)1 AString (org.apache.asterix.om.base.AString)1 ARecordType (org.apache.asterix.om.types.ARecordType)1 AUnionType (org.apache.asterix.om.types.AUnionType)1 BuiltinType (org.apache.asterix.om.types.BuiltinType)1 IAType (org.apache.asterix.om.types.IAType)1