Class SqlFunctionUtils


  • public class SqlFunctionUtils
    extends Object
    Built-in scalar runtime functions.

    NOTE: Before you add functions here, check if Calcite provides it in org.apache.calcite.runtime.SqlFunctions. Furthermore, make sure to implement the function efficiently. Sometimes it makes sense to create a org.apache.flink.table.codegen.calls.CallGenerator instead to avoid massive object creation and reuse instances.

    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static byte abs​(byte b0)
      SQL ABS operator applied to byte values.
      static double abs​(double b0)
      SQL ABS operator applied to double values.
      static float abs​(float b0)
      SQL ABS operator applied to float values.
      static int abs​(int b0)
      SQL ABS operator applied to int values.
      static long abs​(long b0)
      SQL ABS operator applied to long values.
      static short abs​(short b0)
      SQL ABS operator applied to short values.
      static org.apache.flink.table.data.DecimalData abs​(org.apache.flink.table.data.DecimalData a)  
      static double acos​(org.apache.flink.table.data.DecimalData a)  
      static double asin​(org.apache.flink.table.data.DecimalData a)  
      static double atan​(org.apache.flink.table.data.DecimalData a)  
      static double atan2​(org.apache.flink.table.data.DecimalData y, org.apache.flink.table.data.DecimalData x)  
      static Byte bitAnd​(Byte a, Byte b)  
      static Integer bitAnd​(Integer a, Integer b)  
      static Long bitAnd​(Long a, Long b)  
      static Short bitAnd​(Short a, Short b)  
      static Byte bitNot​(Byte a)  
      static Integer bitNot​(Integer a)  
      static Long bitNot​(Long a)  
      static Short bitNot​(Short a)  
      static Byte bitOr​(Byte a, Byte b)  
      static Integer bitOr​(Integer a, Integer b)  
      static Long bitOr​(Long a, Long b)  
      static Short bitOr​(Short a, Short b)  
      static Byte bitXor​(Byte a, Byte b)  
      static Integer bitXor​(Integer a, Integer b)  
      static Long bitXor​(Long a, Long b)  
      static Short bitXor​(Short a, Short b)  
      static int byteArrayCompare​(byte[] array1, byte[] array2)
      Compares two byte arrays in lexicographical order.
      static double ceil​(double b0)  
      static float ceil​(float b0)  
      static int ceil​(int b0, int b1)
      SQL CEIL operator applied to int values.
      static long ceil​(long b0, long b1)
      SQL CEIL operator applied to long values.
      static org.apache.flink.table.data.DecimalData ceil​(org.apache.flink.table.data.DecimalData a)  
      static String chr​(long chr)  
      static double cos​(org.apache.flink.table.data.DecimalData a)  
      static double cosh​(org.apache.flink.table.data.DecimalData x)  
      static double cot​(double b0)
      SQL COT operator applied to double values.
      static double cot​(org.apache.flink.table.data.DecimalData a)  
      static double degrees​(org.apache.flink.table.data.DecimalData angrad)  
      static int divideInt​(int a, int b)  
      static double exp​(org.apache.flink.table.data.DecimalData d)  
      static double floor​(double b0)  
      static float floor​(float b0)  
      static int floor​(int b0, int b1)
      SQL FLOOR operator applied to int values.
      static long floor​(long b0, long b1)
      SQL FLOOR operator applied to long values.
      static org.apache.flink.table.data.DecimalData floor​(org.apache.flink.table.data.DecimalData a)  
      static org.apache.flink.table.data.binary.BinaryStringData fromBase64​(byte[] bytes)  
      static org.apache.flink.table.data.binary.BinaryStringData fromBase64​(org.apache.flink.table.data.binary.BinaryStringData bs)  
      static Matcher getRegexpMatcher​(org.apache.flink.table.data.StringData str, org.apache.flink.table.data.StringData regex)
      Returns a Matcher object that represents the result of matching given StringData against a specified regular expression pattern.
      static String hash​(String algorithm, String str)
      Calculate the hash value of a given string.
      static String hash​(String algorithm, String str, String charsetName)
      Calculate the hash value of a given string.
      static Integer hashCode​(String str)  
      static String hex​(long x)
      Returns the hex string of a long argument.
      static String hex​(String x)
      Returns the hex string of a string argument.
      static String initcap​(String s)
      SQL INITCAP(string) function.
      static int instr​(org.apache.flink.table.data.binary.BinaryStringData str, org.apache.flink.table.data.binary.BinaryStringData subString, int startPosition, int nthAppearance)  
      static boolean isAlpha​(Object obj)  
      static boolean isDecimal​(Object obj)  
      static boolean isDigit​(Object obj)  
      static org.apache.flink.table.data.binary.BinaryStringData keyValue​(org.apache.flink.table.data.binary.BinaryStringData str, org.apache.flink.table.data.binary.BinaryStringData pairSeparator, org.apache.flink.table.data.binary.BinaryStringData kvSeparator, org.apache.flink.table.data.binary.BinaryStringData keyName)
      Parse string as key-value string and return the value matches key name. example: keyvalue('k1=v1;k2=v2', ';', '=', 'k2') = 'v2' keyvalue('k1:v1,k2:v2', ',', ':', 'k3') = NULL
      static double log​(double x)
      Returns the natural logarithm of "x".
      static double log​(double base, double x)
      Returns the logarithm of "x" with base "base".
      static double log​(double base, org.apache.flink.table.data.DecimalData x)  
      static double log​(org.apache.flink.table.data.DecimalData x)  
      static double log​(org.apache.flink.table.data.DecimalData base, double x)  
      static double log​(org.apache.flink.table.data.DecimalData base, org.apache.flink.table.data.DecimalData x)  
      static double log10​(double x)  
      static double log10​(org.apache.flink.table.data.DecimalData x)  
      static double log2​(double x)
      Returns the logarithm of "a" with base 2.
      static double log2​(org.apache.flink.table.data.DecimalData x)  
      static String lpad​(String base, int len, String pad)
      Returns the string str left-padded with the string pad to a length of len characters.
      static String overlay​(String s, String r, long start)  
      static String overlay​(String s, String r, long start, long length)  
      static String parseUrl​(String urlStr, String partToExtract)
      Parse url and return various components of the URL.
      static String parseUrl​(String urlStr, String partToExtract, String key)
      Parse url and return various parameter of the URL.
      static int position​(org.apache.flink.table.data.binary.BinaryStringData seek, org.apache.flink.table.data.binary.BinaryStringData s)  
      static int position​(org.apache.flink.table.data.binary.BinaryStringData seek, org.apache.flink.table.data.binary.BinaryStringData s, int from)  
      static double power​(double base, org.apache.flink.table.data.DecimalData exponent)  
      static double power​(org.apache.flink.table.data.DecimalData base, double exponent)  
      static double power​(org.apache.flink.table.data.DecimalData base, org.apache.flink.table.data.DecimalData exponent)  
      static double radians​(org.apache.flink.table.data.DecimalData angdeg)  
      static Boolean regExp​(String s, String regex)  
      static String regexpExtract​(String str, String regex)
      Returns the first string extracted with a specified regular expression.
      static String regexpExtract​(String str, String regex, int extractIndex)
      Returns a string extracted with a specified regular expression and a regex match group index.
      static String regexpExtract​(String str, String regex, long extractIndex)  
      static String regexpReplace​(String str, String regex, String replacement)
      Returns a string resulting from replacing all substrings that match the regular expression with replacement.
      static String repeat​(String str, int repeat)
      Returns a string that repeats the base string n times.
      static String replace​(String str, String oldStr, String replacement)
      Replaces all the old strings with the replacement string.
      static String rpad​(String base, int len, String pad)
      Returns the string str right-padded with the string pad to a length of len characters.
      static org.apache.flink.table.data.DecimalData sign​(org.apache.flink.table.data.DecimalData b0)  
      static double sin​(org.apache.flink.table.data.DecimalData a)  
      static double sinh​(org.apache.flink.table.data.DecimalData a)  
      static String splitIndex​(String str, int character, int index)
      Split target string with custom separator and pick the index-th(start with 0) result.
      static String splitIndex​(String str, String separator, int index)
      Split target string with custom separator and pick the index-th(start with 0) result.
      static byte sround​(byte b0)
      SQL ROUND operator applied to byte values.
      static byte sround​(byte b0, int b1)
      SQL ROUND operator applied to byte values.
      static double sround​(double b0)
      SQL ROUND operator applied to double values.
      static double sround​(double b0, int b1)
      SQL ROUND operator applied to double values.
      static float sround​(float b0)
      SQL ROUND operator applied to float values.
      static float sround​(float b0, int b1)
      SQL ROUND operator applied to float values.
      static int sround​(int b0)
      SQL ROUND operator applied to int values.
      static int sround​(int b0, int b1)
      SQL ROUND operator applied to int values.
      static long sround​(long b0)
      SQL ROUND operator applied to long values.
      static long sround​(long b0, int b1)
      SQL ROUND operator applied to long values.
      static short sround​(short b0)
      SQL ROUND operator applied to short values.
      static short sround​(short b0, int b1)
      SQL ROUND operator applied to short values.
      static BigDecimal sround​(BigDecimal b0)
      SQL ROUND operator applied to BigDecimal values.
      static BigDecimal sround​(BigDecimal b0, int b1)
      SQL ROUND operator applied to BigDecimal values.
      static org.apache.flink.table.data.DecimalData sround​(org.apache.flink.table.data.DecimalData b0)
      SQL ROUND operator applied to DecimalData values.
      static org.apache.flink.table.data.DecimalData sround​(org.apache.flink.table.data.DecimalData b0, int b1)
      SQL ROUND operator applied to DecimalData values.
      static Map<String,​String> strToMap​(String text)
      Creates a map by parsing text.
      static Map<String,​String> strToMap​(String text, String listDelimiter, String keyValueDelimiter)
      Creates a map by parsing text.
      static double struncate​(double b0)
      SQL TRUNCATE operator applied to double values.
      static double struncate​(double b0, int b1)  
      static float struncate​(float b0)
      SQL TRUNCATE operator applied to double values.
      static float struncate​(float b0, int b1)  
      static int struncate​(int b0)
      SQL TRUNCATE operator applied to int values.
      static int struncate​(int b0, int b1)  
      static long struncate​(long b0)
      SQL TRUNCATE operator applied to long values.
      static long struncate​(long b0, int b1)  
      static org.apache.flink.table.data.DecimalData struncate​(org.apache.flink.table.data.DecimalData b0)
      SQL TRUNCATE operator applied to BigDecimal values.
      static org.apache.flink.table.data.DecimalData struncate​(org.apache.flink.table.data.DecimalData b0, int b1)  
      static String subString​(String str, long start)  
      static String subString​(String str, long start, long len)  
      static double tan​(org.apache.flink.table.data.DecimalData a)  
      static double tanh​(org.apache.flink.table.data.DecimalData a)
      Calculates the hyperbolic tangent of a big decimal number.
      static String toBase64​(byte[] bytes)  
      static String toBase64​(org.apache.flink.table.data.binary.BinaryStringData bs)  
      static String uuid()  
      static String uuid​(byte[] b)  
    • Constructor Detail

      • SqlFunctionUtils

        public SqlFunctionUtils()
    • Method Detail

      • exp

        public static double exp​(org.apache.flink.table.data.DecimalData d)
      • power

        public static double power​(double base,
                                   org.apache.flink.table.data.DecimalData exponent)
      • power

        public static double power​(org.apache.flink.table.data.DecimalData base,
                                   org.apache.flink.table.data.DecimalData exponent)
      • power

        public static double power​(org.apache.flink.table.data.DecimalData base,
                                   double exponent)
      • cosh

        public static double cosh​(org.apache.flink.table.data.DecimalData x)
      • acos

        public static double acos​(org.apache.flink.table.data.DecimalData a)
      • asin

        public static double asin​(org.apache.flink.table.data.DecimalData a)
      • atan

        public static double atan​(org.apache.flink.table.data.DecimalData a)
      • atan2

        public static double atan2​(org.apache.flink.table.data.DecimalData y,
                                   org.apache.flink.table.data.DecimalData x)
      • sin

        public static double sin​(org.apache.flink.table.data.DecimalData a)
      • sinh

        public static double sinh​(org.apache.flink.table.data.DecimalData a)
      • cos

        public static double cos​(org.apache.flink.table.data.DecimalData a)
      • tan

        public static double tan​(org.apache.flink.table.data.DecimalData a)
      • tanh

        public static double tanh​(org.apache.flink.table.data.DecimalData a)
        Calculates the hyperbolic tangent of a big decimal number.
      • cot

        public static double cot​(double b0)
        SQL COT operator applied to double values.
      • cot

        public static double cot​(org.apache.flink.table.data.DecimalData a)
      • degrees

        public static double degrees​(org.apache.flink.table.data.DecimalData angrad)
      • radians

        public static double radians​(org.apache.flink.table.data.DecimalData angdeg)
      • abs

        public static byte abs​(byte b0)
        SQL ABS operator applied to byte values.
      • abs

        public static short abs​(short b0)
        SQL ABS operator applied to short values.
      • abs

        public static int abs​(int b0)
        SQL ABS operator applied to int values.
      • abs

        public static long abs​(long b0)
        SQL ABS operator applied to long values.
      • abs

        public static float abs​(float b0)
        SQL ABS operator applied to float values.
      • abs

        public static double abs​(double b0)
        SQL ABS operator applied to double values.
      • abs

        public static org.apache.flink.table.data.DecimalData abs​(org.apache.flink.table.data.DecimalData a)
      • floor

        public static double floor​(double b0)
      • floor

        public static float floor​(float b0)
      • floor

        public static int floor​(int b0,
                                int b1)
        SQL FLOOR operator applied to int values.
      • floor

        public static long floor​(long b0,
                                 long b1)
        SQL FLOOR operator applied to long values.
      • floor

        public static org.apache.flink.table.data.DecimalData floor​(org.apache.flink.table.data.DecimalData a)
      • ceil

        public static double ceil​(double b0)
      • ceil

        public static float ceil​(float b0)
      • ceil

        public static int ceil​(int b0,
                               int b1)
        SQL CEIL operator applied to int values.
      • ceil

        public static long ceil​(long b0,
                                long b1)
        SQL CEIL operator applied to long values.
      • ceil

        public static org.apache.flink.table.data.DecimalData ceil​(org.apache.flink.table.data.DecimalData a)
      • log

        public static double log​(double x)
        Returns the natural logarithm of "x".
      • log

        public static double log​(org.apache.flink.table.data.DecimalData x)
      • log

        public static double log​(double base,
                                 double x)
        Returns the logarithm of "x" with base "base".
      • log

        public static double log​(double base,
                                 org.apache.flink.table.data.DecimalData x)
      • log

        public static double log​(org.apache.flink.table.data.DecimalData base,
                                 double x)
      • log

        public static double log​(org.apache.flink.table.data.DecimalData base,
                                 org.apache.flink.table.data.DecimalData x)
      • log2

        public static double log2​(double x)
        Returns the logarithm of "a" with base 2.
      • log2

        public static double log2​(org.apache.flink.table.data.DecimalData x)
      • log10

        public static double log10​(double x)
      • log10

        public static double log10​(org.apache.flink.table.data.DecimalData x)
      • lpad

        public static String lpad​(String base,
                                  int len,
                                  String pad)
        Returns the string str left-padded with the string pad to a length of len characters. If str is longer than len, the return value is shortened to len characters.
      • rpad

        public static String rpad​(String base,
                                  int len,
                                  String pad)
        Returns the string str right-padded with the string pad to a length of len characters. If str is longer than len, the return value is shortened to len characters.
      • repeat

        public static String repeat​(String str,
                                    int repeat)
        Returns a string that repeats the base string n times.
      • replace

        public static String replace​(String str,
                                     String oldStr,
                                     String replacement)
        Replaces all the old strings with the replacement string.
      • splitIndex

        public static String splitIndex​(String str,
                                        String separator,
                                        int index)
        Split target string with custom separator and pick the index-th(start with 0) result.
        Parameters:
        str - target string.
        separator - custom separator.
        index - index of the result which you want.
        Returns:
        the string at the index of split results.
      • splitIndex

        public static String splitIndex​(String str,
                                        int character,
                                        int index)
        Split target string with custom separator and pick the index-th(start with 0) result.
        Parameters:
        str - target string.
        character - int value of the separator character
        index - index of the result which you want.
        Returns:
        the string at the index of split results.
      • regexpReplace

        public static String regexpReplace​(String str,
                                           String regex,
                                           String replacement)
        Returns a string resulting from replacing all substrings that match the regular expression with replacement.
      • regexpExtract

        public static String regexpExtract​(String str,
                                           String regex,
                                           int extractIndex)
        Returns a string extracted with a specified regular expression and a regex match group index.
      • regexpExtract

        public static String regexpExtract​(String str,
                                           String regex,
                                           long extractIndex)
      • regexpExtract

        public static String regexpExtract​(String str,
                                           String regex)
        Returns the first string extracted with a specified regular expression.
      • getRegexpMatcher

        public static Matcher getRegexpMatcher​(@Nullable
                                               org.apache.flink.table.data.StringData str,
                                               @Nullable
                                               org.apache.flink.table.data.StringData regex)
        Returns a Matcher object that represents the result of matching given StringData against a specified regular expression pattern.
      • keyValue

        public static org.apache.flink.table.data.binary.BinaryStringData keyValue​(org.apache.flink.table.data.binary.BinaryStringData str,
                                                                                   org.apache.flink.table.data.binary.BinaryStringData pairSeparator,
                                                                                   org.apache.flink.table.data.binary.BinaryStringData kvSeparator,
                                                                                   org.apache.flink.table.data.binary.BinaryStringData keyName)
        Parse string as key-value string and return the value matches key name. example: keyvalue('k1=v1;k2=v2', ';', '=', 'k2') = 'v2' keyvalue('k1:v1,k2:v2', ',', ':', 'k3') = NULL
        Parameters:
        str - target string.
        pairSeparator - separator between key-value tuple.
        kvSeparator - separator between key and value.
        keyName - name of the key whose value you want return.
        Returns:
        target value.
      • hash

        public static String hash​(String algorithm,
                                  String str)
        Calculate the hash value of a given string.
        Parameters:
        algorithm - message digest algorithm.
        str - string to hash.
        Returns:
        hash value of string.
      • hash

        public static String hash​(String algorithm,
                                  String str,
                                  String charsetName)
        Calculate the hash value of a given string.
        Parameters:
        algorithm - message digest algorithm.
        str - string to hash.
        charsetName - charset of string.
        Returns:
        hash value of string.
      • parseUrl

        public static String parseUrl​(String urlStr,
                                      String partToExtract)
        Parse url and return various components of the URL. If accept any null arguments, return null.
        Parameters:
        urlStr - URL string.
        partToExtract - determines which components would return. accept values: HOST,PATH,QUERY,REF, PROTOCOL,FILE,AUTHORITY,USERINFO
        Returns:
        target value.
      • parseUrl

        public static String parseUrl​(String urlStr,
                                      String partToExtract,
                                      String key)
        Parse url and return various parameter of the URL. If accept any null arguments, return null.
        Parameters:
        urlStr - URL string.
        partToExtract - must be QUERY, or return null.
        key - parameter name.
        Returns:
        target value.
      • divideInt

        public static int divideInt​(int a,
                                    int b)
      • subString

        public static String subString​(String str,
                                       long start,
                                       long len)
      • subString

        public static String subString​(String str,
                                       long start)
      • chr

        public static String chr​(long chr)
      • overlay

        public static String overlay​(String s,
                                     String r,
                                     long start,
                                     long length)
      • position

        public static int position​(org.apache.flink.table.data.binary.BinaryStringData seek,
                                   org.apache.flink.table.data.binary.BinaryStringData s)
      • position

        public static int position​(org.apache.flink.table.data.binary.BinaryStringData seek,
                                   org.apache.flink.table.data.binary.BinaryStringData s,
                                   int from)
      • instr

        public static int instr​(org.apache.flink.table.data.binary.BinaryStringData str,
                                org.apache.flink.table.data.binary.BinaryStringData subString,
                                int startPosition,
                                int nthAppearance)
      • hex

        public static String hex​(long x)
        Returns the hex string of a long argument.
      • hex

        public static String hex​(String x)
        Returns the hex string of a string argument.
      • strToMap

        public static Map<String,​String> strToMap​(String text)
        Creates a map by parsing text. Split text into key-value pairs using two delimiters. The first delimiter separates pairs, and the second delimiter separates key and value. If only one parameter is given, default delimiters are used: ',' as delimiter1 and '=' as delimiter2. Both delimiters are treated as regular expressions.
        Parameters:
        text - the input text
        Returns:
        the map
      • strToMap

        public static Map<String,​String> strToMap​(String text,
                                                        String listDelimiter,
                                                        String keyValueDelimiter)
        Creates a map by parsing text. Split text into key-value pairs using two delimiters. The first delimiter separates pairs, and the second delimiter separates key and value. Both listDelimiter and keyValueDelimiter are treated as regular expressions.
        Parameters:
        text - the input text
        listDelimiter - the delimiter to separates pairs
        keyValueDelimiter - the delimiter to separates key and value
        Returns:
        the map
      • sround

        public static byte sround​(byte b0)
        SQL ROUND operator applied to byte values.
      • sround

        public static byte sround​(byte b0,
                                  int b1)
        SQL ROUND operator applied to byte values.
      • sround

        public static short sround​(short b0)
        SQL ROUND operator applied to short values.
      • sround

        public static short sround​(short b0,
                                   int b1)
        SQL ROUND operator applied to short values.
      • sround

        public static int sround​(int b0)
        SQL ROUND operator applied to int values.
      • sround

        public static int sround​(int b0,
                                 int b1)
        SQL ROUND operator applied to int values.
      • sround

        public static long sround​(long b0)
        SQL ROUND operator applied to long values.
      • sround

        public static long sround​(long b0,
                                  int b1)
        SQL ROUND operator applied to long values.
      • sround

        public static BigDecimal sround​(BigDecimal b0)
        SQL ROUND operator applied to BigDecimal values.
      • sround

        public static BigDecimal sround​(BigDecimal b0,
                                        int b1)
        SQL ROUND operator applied to BigDecimal values.
      • sround

        public static float sround​(float b0)
        SQL ROUND operator applied to float values.
      • sround

        public static float sround​(float b0,
                                   int b1)
        SQL ROUND operator applied to float values.
      • sround

        public static double sround​(double b0)
        SQL ROUND operator applied to double values.
      • sround

        public static double sround​(double b0,
                                    int b1)
        SQL ROUND operator applied to double values.
      • sround

        public static org.apache.flink.table.data.DecimalData sround​(org.apache.flink.table.data.DecimalData b0)
        SQL ROUND operator applied to DecimalData values.
      • sround

        public static org.apache.flink.table.data.DecimalData sround​(org.apache.flink.table.data.DecimalData b0,
                                                                     int b1)
        SQL ROUND operator applied to DecimalData values.
      • sign

        public static org.apache.flink.table.data.DecimalData sign​(org.apache.flink.table.data.DecimalData b0)
      • isDecimal

        public static boolean isDecimal​(Object obj)
      • isDigit

        public static boolean isDigit​(Object obj)
      • isAlpha

        public static boolean isAlpha​(Object obj)
      • bitNot

        public static Byte bitNot​(Byte a)
      • bitNot

        public static Short bitNot​(Short a)
      • bitNot

        public static Long bitNot​(Long a)
      • toBase64

        public static String toBase64​(org.apache.flink.table.data.binary.BinaryStringData bs)
      • toBase64

        public static String toBase64​(byte[] bytes)
      • fromBase64

        public static org.apache.flink.table.data.binary.BinaryStringData fromBase64​(org.apache.flink.table.data.binary.BinaryStringData bs)
      • fromBase64

        public static org.apache.flink.table.data.binary.BinaryStringData fromBase64​(byte[] bytes)
      • uuid

        public static String uuid()
      • uuid

        public static String uuid​(byte[] b)
      • struncate

        public static int struncate​(int b0)
        SQL TRUNCATE operator applied to int values.
      • struncate

        public static int struncate​(int b0,
                                    int b1)
      • struncate

        public static long struncate​(long b0)
        SQL TRUNCATE operator applied to long values.
      • struncate

        public static long struncate​(long b0,
                                     int b1)
      • struncate

        public static org.apache.flink.table.data.DecimalData struncate​(org.apache.flink.table.data.DecimalData b0)
        SQL TRUNCATE operator applied to BigDecimal values.
      • struncate

        public static org.apache.flink.table.data.DecimalData struncate​(org.apache.flink.table.data.DecimalData b0,
                                                                        int b1)
      • struncate

        public static float struncate​(float b0)
        SQL TRUNCATE operator applied to double values.
      • struncate

        public static float struncate​(float b0,
                                      int b1)
      • struncate

        public static double struncate​(double b0)
        SQL TRUNCATE operator applied to double values.
      • struncate

        public static double struncate​(double b0,
                                       int b1)
      • byteArrayCompare

        public static int byteArrayCompare​(byte[] array1,
                                           byte[] array2)
        Compares two byte arrays in lexicographical order.

        The result is positive if array1 is great than array2, negative if array1 is less than array2 and 0 if array1 is equal to array2.

        Note: Currently, this is used in ScalarOperatorGens for comparing two fields of binary or varbinary type.

        Parameters:
        array1 - byte array to compare.
        array2 - byte array to compare.
        Returns:
        an Integer indicating which one is bigger
      • initcap

        public static String initcap​(String s)
        SQL INITCAP(string) function.