Class WildcardUtil


  • public class WildcardUtil
    extends Object
    This class consists of utility functions with respect to wildcard strings that are required in building SQL queries
    • Constructor Detail

      • WildcardUtil

        public WildcardUtil()
    • Method Detail

      • isMatchAnything

        public static boolean isMatchAnything​(String s)
        This function checks if the input string is a "match anything" string i.e. "*"
        Parameters:
        s - the input string
        Returns:
        true if the input string is "*"
      • isNullOrEmpty

        public static boolean isNullOrEmpty​(String s)
      • isNullOrWildcard

        public static boolean isNullOrWildcard​(String s)
      • isWildcard

        public static boolean isWildcard​(String s)
        This function checks if the input string is a wildcard string
        Parameters:
        s - the input string
        Returns:
        true if the input string is wildcard
      • escapeCatalogName

        public static String escapeCatalogName​(String catalogName)
        Escapes unescaped _ wildcard characters in a catalog name by prepending \. Already-escaped sequences (\_) are left unchanged.
        Parameters:
        catalogName - the catalog name to escape
        Returns:
        the escaped catalog name, or null if the input is null
      • stripJdbcEscapes

        public static String stripJdbcEscapes​(String value)
        Strips JDBC escape sequences from a string, producing the literal value. Use this for SQL identifiers (e.g. catalog names inside backticks) where JDBC wildcard semantics don't apply. \_ becomes _, \\ becomes \, and unescaped characters (including % and _) are kept as-is since they are literals in identifier context.
        Parameters:
        value - the string potentially containing JDBC escape sequences
        Returns:
        the unescaped string, or null if the input is null
      • jdbcPatternToHive

        public static String jdbcPatternToHive​(String pattern)