@Override public IAType computeType(ILogicalExpression expression, IVariableTypeEnvironment env, IMetadataProvider<?, ?> metadataProvider) throws AlgebricksException { return AUnionType.createMissableType(BuiltinType.ABOOLEAN); }
@Override public IAType makeMissableType(Object type) throws AlgebricksException { IAType t = (IAType) type; return AUnionType.createMissableType(t); }
@Override public IAType getResultType(ILogicalExpression expr, IAType... strippedInputTypes) throws AlgebricksException { IAType inputType = strippedInputTypes[0]; return inputType.getTypeTag() == ATypeTag.ANY ? inputType : AUnionType.createMissableType(inputType); } }
public static IAType createUnknownableType(IAType type, String typeName) { IAType resultType = createNullableType(type, typeName); resultType = createMissableType(resultType, typeName); return resultType; }
@Override protected IAType getResultType(ILogicalExpression expr, IAType... strippedInputTypes) throws AlgebricksException { return AUnionType.createMissableType(TypeCastUtils.getRequiredType((AbstractFunctionCallExpression) expr)); } }
public static IAType createMissableType(IAType t) { if (t != null && t.getTypeTag() == ATypeTag.MISSING) { return t; } String s = t != null ? t.getTypeName() : null; return createMissableType(t, s == null ? null : s + "?"); }
private static IAType getResultType(IAType type, byte category) { if (type.getTypeTag() == ATypeTag.ANY) { return type; } if (category == CERTAIN) { return type; } IAType resultType = type; if ((category & NULLABLE) != 0 || (category & NULL) != 0) { resultType = AUnionType.createNullableType(resultType); } if ((category & MISSABLE) != 0 || (category & MISSING) != 0) { resultType = AUnionType.createMissableType(resultType); } return resultType; }
private IAType createOutputType(IAType primeType, ATypeTag quantifier, SourceLocation sourceLoc) throws CompilationException { if (quantifier == null || primeType.getTypeTag() == ATypeTag.ANY) { return primeType; } switch (quantifier) { case MISSING: return AUnionType.createMissableType(primeType); case NULL: return AUnionType.createNullableType(primeType, null); default: throw new CompilationException(ErrorCode.COMPILATION_ILLEGAL_STATE, sourceLoc, "Unexpected quantifier: " + quantifier); } } }
@Override protected IAType getResultType(ILogicalExpression expr, IAType... strippedInputTypes) throws AlgebricksException { IAType type = strippedInputTypes[0]; if (type.getTypeTag() == ATypeTag.ANY) { return BuiltinType.ANY; } IAType itemType = ((AbstractCollectionType) type).getItemType(); if (nullable) { itemType = AUnionType.createNullableType(itemType); } if (missable) { itemType = AUnionType.createMissableType(itemType); } return itemType; } }