@Override public void init() throws HyracksDataException { unionList = unionType.getUnionList(); printers = new IPrinter[unionType.getUnionList().size()]; for (int i = 0; i < printers.length; i++) { printers[i] = (LosslessJSONPrinterFactoryProvider.INSTANCE .getPrinterFactory(unionType.getUnionList().get(i))).createPrinter(); printers[i].init(); } }
@Override public void init() throws HyracksDataException { unionList = unionType.getUnionList(); printers = new IPrinter[unionType.getUnionList().size()]; for (int i = 0; i < printers.length; i++) { printers[i] = (CSVPrinterFactoryProvider.INSTANCE.getPrinterFactory(unionType.getUnionList().get(i))) .createPrinter(); printers[i].init(); } }
@Override public boolean deepEqual(IAObject obj) { if (!(obj instanceof AUnionType)) { return false; } AUnionType ut = (AUnionType) obj; if (ut.getUnionList().size() != unionList.size()) { return false; } for (int i = 0; i < unionList.size(); i++) { if (!unionList.get(i).deepEqual(ut.getUnionList().get(i))) { return false; } } return true; }
@Override public void init() throws HyracksDataException { unionList = unionType.getUnionList(); printers = new IPrinter[unionType.getUnionList().size()]; for (int i = 0; i < printers.length; i++) { printers[i] = (ADMPrinterFactoryProvider.INSTANCE.getPrinterFactory(unionType.getUnionList().get(i))) .createPrinter(); printers[i].init(); } }
@Override public void init() throws HyracksDataException { unionList = unionType.getUnionList(); printers = new IPrinter[unionType.getUnionList().size()]; for (int i = 0; i < printers.length; i++) { printers[i] = (CleanJSONPrinterFactoryProvider.INSTANCE .getPrinterFactory(unionType.getUnionList().get(i))).createPrinter(); printers[i].init(); } }
public static IAType createMissableType(IAType type, String typeName) { if (type != null && type.getTypeTag() == ATypeTag.MISSING) { return type; } List<IAType> unionList = new ArrayList<>(); if (type != null && type.getTypeTag() == ATypeTag.UNION) { AUnionType unionType = (AUnionType) type; unionList.addAll(unionType.getUnionList()); } else { unionList.add(type); } unionList.add(BuiltinType.AMISSING); return new AUnionType(unionList, typeName); }
public static IAType createNullableType(IAType type, String typeName) { if (type != null && type.getTypeTag() == ATypeTag.NULL) { return type; } List<IAType> unionList = new ArrayList<>(); if (type != null && type.getTypeTag() == ATypeTag.UNION) { AUnionType unionType = (AUnionType) type; unionList.addAll(unionType.getUnionList()); } else { unionList.add(type); } unionList.add(BuiltinType.ANULL); return new AUnionType(unionList, typeName); }
if (reqType.getTypeTag() == ATypeTag.UNION) { AUnionType unionType = (AUnionType) reqType; reqTypePossible.addAll(unionType.getUnionList()); } else { reqTypePossible.add(reqType); inputTypePossible.addAll(unionType.getUnionList()); } else { inputTypePossible.add(inputType);
public static IAType getComplexType(IAType aObjectType, ATypeTag tag) { if (aObjectType == null) { return null; } if (aObjectType.getTypeTag() == tag) { return aObjectType; } if (aObjectType.getTypeTag() == ATypeTag.UNION) { List<IAType> unionList = ((AUnionType) aObjectType).getUnionList(); for (int i = 0; i < unionList.size(); i++) { if (unionList.get(i).getTypeTag() == tag) { return unionList.get(i); } } } return null; // wont get here }
private List<String> getNestedComplexDatatypeNamesForThisDatatype(TxnId txnId, String dataverseName, String datatypeName) throws AlgebricksException, RemoteException { // Return all field types that aren't builtin types Datatype parentType = getDatatype(txnId, 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; }
private ATypeTag getTargetTypeTag(ATypeTag expectedTypeTag, IAType aObjectType) throws HyracksDataException { if (aObjectType == null) { return expectedTypeTag; } if (aObjectType.getTypeTag() != ATypeTag.UNION) { ATypeTag typeTag = aObjectType.getTypeTag(); if (ATypeHierarchy.canPromote(expectedTypeTag, typeTag) || ATypeHierarchy.canDemote(expectedTypeTag, typeTag)) { return typeTag; } else { return null; } } else { // union List<IAType> unionList = ((AUnionType) aObjectType).getUnionList(); for (IAType t : unionList) { final ATypeTag typeTag = t.getTypeTag(); if (ATypeHierarchy.canPromote(expectedTypeTag, typeTag) || ATypeHierarchy.canDemote(expectedTypeTag, typeTag)) { return typeTag; } } } return null; }
private ATypeTag getTargetTypeTag(ATypeTag expectedTypeTag, IAType aObjectType) throws IOException { if (aObjectType == null) { return expectedTypeTag; } if (aObjectType.getTypeTag() != ATypeTag.UNION) { final ATypeTag typeTag = aObjectType.getTypeTag(); if (ATypeHierarchy.canPromote(expectedTypeTag, typeTag) || ATypeHierarchy.canDemote(expectedTypeTag, typeTag)) { return typeTag; } else { return null; } } else { // union List<IAType> unionList = ((AUnionType) aObjectType).getUnionList(); for (IAType t : unionList) { final ATypeTag typeTag = t.getTypeTag(); if (ATypeHierarchy.canPromote(expectedTypeTag, typeTag) || ATypeHierarchy.canDemote(expectedTypeTag, typeTag)) { return typeTag; } } } return null; }