/** * Determines whether two types both have different character sets. If one * or the other type has no character set (e.g. in cast from INT to * VARCHAR), that is not a mismatch. * * @param t1 first type * @param t2 second type * @return true iff mismatched */ public static boolean areCharacterSetsMismatched( RelDataType t1, RelDataType t2) { if (isAny(t1) || isAny(t2)) { return false; } Charset cs1 = t1.getCharset(); Charset cs2 = t2.getCharset(); if ((cs1 != null) && (cs2 != null)) { if (!cs1.equals(cs2)) { return true; } } return false; }
/** * Determines whether two types both have different character sets. If one * or the other type has no character set (e.g. in cast from INT to * VARCHAR), that is not a mismatch. * * @param t1 first type * @param t2 second type * @return true iff mismatched */ public static boolean areCharacterSetsMismatched( RelDataType t1, RelDataType t2) { if (isAny(t1) || isAny(t2)) { return false; } Charset cs1 = t1.getCharset(); Charset cs2 = t2.getCharset(); if ((cs1 != null) && (cs2 != null)) { if (!cs1.equals(cs2)) { return true; } } return false; }
/** * Determines whether two types both have different character sets. If one * or the other type has no character set (e.g. in cast from INT to * VARCHAR), that is not a mismatch. * * @param t1 first type * @param t2 second type * @return true iff mismatched */ public static boolean areCharacterSetsMismatched( RelDataType t1, RelDataType t2) { if (isAny(t1) || isAny(t2)) { return false; } Charset cs1 = t1.getCharset(); Charset cs2 = t2.getCharset(); if ((cs1 != null) && (cs2 != null)) { if (!cs1.equals(cs2)) { return true; } } return false; }
/** * Returns whether two types are equal, ignoring nullability. * * <p>They need not come from the same factory. * * @param factory Type factory * @param type1 First type * @param type2 Second type * @return whether types are equal, ignoring nullability */ public static boolean equalSansNullability( RelDataTypeFactory factory, RelDataType type1, RelDataType type2) { if (type1.equals(type2)) { return true; } if (isAny(type1) || isAny(type2)) { return true; } if (type1.isNullable() == type2.isNullable()) { // If types have the same nullability and they weren't equal above, // they must be different. return false; } return type1.equals( factory.createTypeWithNullability(type2, type1.isNullable())); }
if (!isAny(t)) { argTypes2.add(t);
if (!isAny(t)) { argTypes2.add(t);
if (!isAny(t)) { argTypes2.add(t);