Package io.trino.type

Class TypeCoercion


  • public final class TypeCoercion
    extends Object
    • Method Detail

      • isTypeOnlyCoercion

        public boolean isTypeOnlyCoercion​(Type source,
                                          Type result)
      • isInjectiveCoercion

        public boolean isInjectiveCoercion​(Type source,
                                           Type result)
      • getCommonSuperType

        public Optional<Type> getCommonSuperType​(Type firstType,
                                                 Type secondType)
      • isCompatible

        public boolean isCompatible​(Type fromType,
                                    Type toType)
      • canCoerce

        public boolean canCoerce​(Type fromType,
                                 Type toType)
      • coerceTypeBase

        public Optional<Type> coerceTypeBase​(Type sourceType,
                                             String resultTypeBase)
        coerceTypeBase and isCovariantParametrizedType defines all hand-coded rules for type coercion. Other methods should reference these two functions instead of hand-code new rules.
      • isCovariantTypeBase

        public static boolean isCovariantTypeBase​(String typeBase)