Class SqlFunctions

java.lang.Object
org.apache.calcite.runtime.SqlFunctions

public class SqlFunctions extends Object
Helper methods to implement SQL functions in generated code.

Not present: and, or, not (builtin operators are better, because they use lazy evaluation. Implementations do not check for null values; the calling code must do that.

Many of the functions do not check for null values. This is intentional. If null arguments are possible, the code-generation framework checks for nulls before calling the functions.

  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static enum 
  • Method Summary

    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 BigDecimal
    SQL ABS operator applied to BigDecimal values.
    static double
    acos(double b0)
    SQL ACOS operator applied to double values.
    static double
    SQL ACOS operator applied to BigDecimal values.
    static Object[]
    array(Object... args)
     
    static @Nullable Object
    arrayItem(List list, int item)
    Helper for "array element reference".
    static @Nullable Object
    arrayItemOptional(@Nullable List list, int item)
    As arrayItem(java.util.List, int) method, but allows array to be nullable.
    static @PolyNull List
    arrayToList(@PolyNull Array a)
    Converts a JDBC array to a list.
    static int
    SQL ASCII(string) function.
    static double
    asin(double b0)
    SQL ASIN operator applied to double values.
    static double
    SQL ASIN operator applied to BigDecimal values.
    static double
    atan(double b0)
    SQL ATAN operator applied to double values.
    static double
    SQL ATAN operator applied to BigDecimal values.
    static double
    atan2(double b0, double b1)
    SQL ATAN2 operator applied to double values.
    static double
    atan2(double b0, BigDecimal b1)
    SQL ATAN2 operator applied to double/BigDecimal values.
    static double
    atan2(BigDecimal b0, double b1)
    SQL ATAN2 operator applied to BigDecimal/double values.
    static double
    SQL ATAN2 operator applied to BigDecimal values.
    static long
    bitAnd(long b0, long b1)
    Bitwise function BIT_AND applied to integer values.
    static org.apache.calcite.avatica.util.ByteString
    bitAnd(org.apache.calcite.avatica.util.ByteString b0, org.apache.calcite.avatica.util.ByteString b1)
    Bitwise function BIT_AND applied to binary values.
    static long
    bitOr(long b0, long b1)
    Bitwise function BIT_OR applied to integer values.
    static org.apache.calcite.avatica.util.ByteString
    bitOr(org.apache.calcite.avatica.util.ByteString b0, org.apache.calcite.avatica.util.ByteString b1)
    Bitwise function BIT_OR applied to binary values.
    static long
    bitXor(long b0, long b1)
    Bitwise function BIT_XOR applied to integer values.
    static org.apache.calcite.avatica.util.ByteString
    bitXor(org.apache.calcite.avatica.util.ByteString b0, org.apache.calcite.avatica.util.ByteString b1)
    Bitwise function BIT_XOR applied to binary values.
    static double
    cbrt(double b)
    SQL CBRT operator applied to double values.
    static double
    SQL CBRT operator applied to BigDecimal values.
    static byte
    ceil(byte b0, byte b1)
    SQL CEIL operator applied to byte values.
    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 int
    ceil(int b0, BigDecimal b1)
     
    static long
    ceil(long b0, long b1)
    SQL CEIL operator applied to long values.
    static short
    ceil(short b0, short b1)
    SQL CEIL operator applied to short values.
    static BigDecimal
     
    static BigDecimal
    ceil(BigDecimal b0, int b1)
     
    static BigDecimal
     
    static @Nullable String
    SQL CHAR(integer) function, as in MySQL and Spark.
    static String
    charFromUtf8(int n)
    SQL CHR(integer) function, as in Oracle and Postgres.
    static int
    SQL CHARACTER_LENGTH(string) function.
    static String
    concat(String s0, String s1)
    SQL string || string operator.
    static org.apache.calcite.avatica.util.ByteString
    concat(org.apache.calcite.avatica.util.ByteString s0, org.apache.calcite.avatica.util.ByteString s1)
    SQL binary || binary operator.
    static String
    SQL CONCAT(arg0, arg1, arg2, ...) function.
    static double
    cos(double b0)
    SQL COS operator applied to double values.
    static double
    SQL COS operator applied to BigDecimal values.
    static double
    cosh(double b)
    SQL COSH operator applied to double values.
    static double
    SQL COSH operator applied to BigDecimal values.
    static double
    cot(double b0)
    SQL COT operator applied to double values.
    static double
    SQL COT operator applied to BigDecimal values.
    static int
    SQL CURRENT_DATE function.
    static int
    SQL CURRENT_TIME function.
    static long
    SQL CURRENT_TIMESTAMP function.
    static int
    customDateAdd(DataContext root, String timeFrameName, int interval, int date)
    SQL DATEADD function applied to a custom time frame.
    static int
    customDateCeil(DataContext root, String timeFrameName, int date)
    SQL CEIL function applied to a DATE value and a custom time frame.
    static int
    customDateDiff(DataContext root, String timeFrameName, int date, int date2)
    SQL DATEDIFF function applied to a custom time frame.
    static int
    customDateFloor(DataContext root, String timeFrameName, int date)
    SQL FLOOR function applied to a DATE value and a custom time frame.
    static long
    customTimestampAdd(DataContext root, String timeFrameName, long interval, long timestamp)
    SQL TIMESTAMPADD function applied to a custom time frame.
    static long
    customTimestampCeil(DataContext root, String timeFrameName, long timestamp)
    SQL CEIL function applied to a TIMESTAMP value and a custom time frame.
    static long
    customTimestampDiff(DataContext root, String timeFrameName, long timestamp, long timestamp2)
    SQL TIMESTAMPDIFF function applied to a custom time frame.
    static long
    customTimestampFloor(DataContext root, String timeFrameName, long timestamp)
    SQL FLOOR function applied to a TIMESTAMP value and a custom time frame.
    static int
    date(int year, int month, int day)
    SQL DATE(year, month, day) function.
    static int
    date(long timestampMillis)
    SQL DATE(TIMESTAMP) and DATE(TIMESTAMP WITH LOCAL TIME ZONE) functions.
    static int
    date(long timestampMillis, String timeZone)
    SQL DATE(TIMESTAMP WITH LOCAL TIME, timeZone) function.
    static int
    static long
    datetime(int daysSinceEpoch)
    SQL DATETIME(DATE) function; returns a Calcite TIMESTAMP.
    static long
    datetime(int daysSinceEpoch, int millisSinceMidnight)
    SQL DATETIME(DATE, TIME) function; returns a Calcite TIMESTAMP.
    static long
    datetime(int year, int month, int day, int hour, int minute, int second)
    SQL DATETIME(<year>, <month>, <day>, <hour>, <minute>, <second>) function.
    static long
    datetime(long millisSinceEpoch)
    SQL DATETIME(TIMESTAMP WITH LOCAL TIME ZONE) function; returns a Calcite TIMESTAMP.
    static long
    datetime(long millisSinceEpoch, String timeZone)
    SQL DATETIME(TIMESTAMP, timeZone) function; returns a Calcite TIMESTAMP.
    static String
    dayNameWithDate(int date, Locale locale)
    SQL DAYNAME function, applied to a DATE argument.
    static String
    dayNameWithTimestamp(long timestamp, Locale locale)
    SQL DAYNAME function, applied to a TIMESTAMP argument.
    static double
    degrees(double b0)
    SQL DEGREES operator applied to double values.
    static double
    SQL DEGREES operator applied to BigDecimal values.
    static int
    SQL DIFFERENCE(string, string) function.
    static int
    divide(int b0, int b1)
    SQL / operator applied to int values.
    static @PolyNull Integer
    divide(int b0, @PolyNull Integer b1)
    SQL / operator applied to int values; right side may be null.
    static int
    divide(int b0, BigDecimal b1)
     
    static long
    divide(long b0, BigDecimal b1)
     
    static @PolyNull Integer
    divide(@PolyNull Integer b0, int b1)
    SQL / operator applied to int values; left side may be null.
    static @PolyNull Integer
    divide(@PolyNull Integer b0, @PolyNull Integer b1)
    SQL / operator applied to nullable int values.
    static @PolyNull Long
    divide(@PolyNull Integer b0, @PolyNull Long b1)
    SQL / operator applied to nullable int and long values.
    static @PolyNull BigDecimal
    divide(@PolyNull BigDecimal b0, @PolyNull BigDecimal b1)
    SQL / operator applied to BigDecimal values.
    static @PolyNull Long
    divide(Long b0, @PolyNull Integer b1)
    SQL / operator applied to nullable long and int values.
    static @PolyNull Object
    divideAny(@PolyNull Object b0, @PolyNull Object b1)
    SQL / operator applied to Object values (at least one operand has ANY type; either may be null).
    static @Nullable Object
    element(List list)
    Support the ELEMENT function.
    static boolean
    SQL ENDS_WITH(string, string) function.
    static boolean
    endsWith(org.apache.calcite.avatica.util.ByteString s0, org.apache.calcite.avatica.util.ByteString s1)
    SQL ENDS_WITH(binary, binary) function.
    static boolean
    eq(@Nullable Object @Nullable [] b0, @Nullable Object @Nullable [] b1)
    SQL = operator applied to Object[] values (neither may be null).
    static boolean
    eq(Object b0, Object b1)
    SQL = operator applied to Object values (including String; neither side may be null).
    static boolean
    eq(String s0, String s1, Comparator<String> comparator)
    SQL = operator applied to String values with a certain Comparator.
    static boolean
    SQL = operator applied to BigDecimal values (neither may be null).
    static boolean
    eqAny(Object b0, Object b1)
    SQL = operator applied to Object values (at least one operand has ANY type; neither may be null).
    static double
    exp(double b0)
    SQL EXP operator applied to double values.
    static double
     
    Function that, given a certain List containing single-item structs (i.e.
    flatProduct(int[] fieldCounts, boolean withOrdinality, SqlFunctions.FlatProductInputType[] inputTypes)
     
    static byte
    floor(byte b0, byte b1)
    SQL FLOOR operator applied to byte values.
    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 int
    floor(int b0, BigDecimal b1)
     
    static long
    floor(long b0, long b1)
    SQL FLOOR operator applied to long values.
    static short
    floor(short b0, short b1)
    SQL FLOOR operator applied to short values.
    static BigDecimal
     
    static BigDecimal
    floor(BigDecimal b0, int b1)
     
    static BigDecimal
     
    static String
    formatDate(DataContext ctx, String fmtString, int date)
     
    static String
    formatTime(DataContext ctx, String fmtString, int time)
     
    static String
    formatTimestamp(DataContext ctx, String fmtString, long timestamp)
     
    static @Nullable org.apache.calcite.avatica.util.ByteString
    SQL FROM_BASE64(string) function.
    static boolean
    ge(boolean b0, boolean b1)
    SQL operator applied to boolean values.
    static boolean
    ge(String b0, String b1)
    SQL operator applied to String values.
    static boolean
    ge(String b0, String b1, Comparator<String> comparator)
    SQL operator applied to String values.
    static boolean
    SQL operator applied to BigDecimal values.
    static boolean
    ge(org.apache.calcite.avatica.util.ByteString b0, org.apache.calcite.avatica.util.ByteString b1)
    SQL operator applied to ByteString values.
    static boolean
    geAny(Object b0, Object b1)
    SQL operator applied to Object values (at least one operand has ANY type; neither may be null).
    static boolean
    greater(boolean b0, boolean b1)
     
    static byte
    greater(byte b0, byte b1)
     
    static char
    greater(char b0, char b1)
     
    static double
    greater(double b0, double b1)
     
    static float
    greater(float b0, float b1)
     
    static int
    greater(int b0, int b1)
     
    static long
    greater(long b0, long b1)
     
    static short
    greater(short b0, short b1)
     
    static <T extends Comparable<T>>
    T
    greater(T b0, T b1)
    Helper for implementing MAX.
    static <T extends Comparable<T>>
    T
    greatest(T b0, T b1)
    GREATEST operator.
    static boolean
    gt(boolean b0, boolean b1)
    SQL > operator applied to boolean values.
    static boolean
    gt(byte b0, byte b1)
     
    static boolean
    gt(char b0, char b1)
     
    static boolean
    gt(double b0, double b1)
     
    static boolean
    gt(float b0, float b1)
     
    static boolean
    gt(int b0, int b1)
     
    static boolean
    gt(long b0, long b1)
     
    static boolean
    gt(short b0, short b1)
     
    static boolean
    gt(String b0, String b1)
    SQL > operator applied to String values.
    static boolean
    gt(String b0, String b1, Comparator<String> comparator)
    SQL > operator applied to String values.
    static boolean
    SQL > operator applied to BigDecimal values.
    static boolean
    gt(org.apache.calcite.avatica.util.ByteString b0, org.apache.calcite.avatica.util.ByteString b1)
    SQL > operator applied to ByteString values.
    static boolean
    gtAny(Object b0, Object b1)
    SQL > operator applied to Object values (at least one operand has ANY type; neither may be null).
    static <T extends Comparable<T>>
    boolean
    gtNullable(T b0, T b1)
    Returns whether b0 is greater than b1 (or b1 is null).
    static boolean
    ilike(String s, String pattern)
    SQL ILIKE function.
    static boolean
    ilike(String s, String pattern, String escape)
    SQL ILIKE function with escape.
    static String
    SQL INITCAP(string) function.
    static Date
    Converts a SQL DATE value from the internal representation type (number of days since January 1st, 1970) to the Java type (Date).
    static @PolyNull Date
    internalToDate(@PolyNull Integer v)
    Converts a nullable SQL DATE value from the internal representation type (number of days since January 1st, 1970) to the Java type (Date).
    static Time
    Converts a SQL TIME value from the internal representation type (number of milliseconds since January 1st, 1970) to the Java type (Time).
    static @PolyNull Time
    internalToTime(@PolyNull Integer v)
    Converts a nullable SQL TIME value from the internal representation type (number of milliseconds since January 1st, 1970) to the Java type (Time).
    static Timestamp
    Converts a SQL TIMESTAMP value from the internal representation type (number of milliseconds since January 1st, 1970) to the Java Type (Timestamp) in the local time zone.
    static @PolyNull Timestamp
    Converts a nullable SQL TIMESTAMP value from the internal representation type (number of milliseconds since January 1st, 1970) to the Java Type (Timestamp) in the local time zone.
    static boolean
    isASet(Collection collection)
    Support the IS A SET function.
    static boolean
    isFalse(@Nullable Boolean b)
    NULL → FALSE, FALSE → TRUE, TRUE → FALSE.
    static boolean
    isNotFalse(@Nullable Boolean b)
    NULL → TRUE, FALSE → FALSE, TRUE → TRUE.
    static boolean
    isNotTrue(@Nullable Boolean b)
    NULL → TRUE, FALSE → TRUE, TRUE → FALSE.
    static boolean
    isTrue(@Nullable Boolean b)
    NULL → FALSE, FALSE → FALSE, TRUE → TRUE.
    static @Nullable Object
    item(Object object, Object index)
    Implements the [ ... ] operator on an object whose type is not known until runtime.
    static @Nullable Object
    itemOptional(@Nullable Object object, Object index)
    As item(java.lang.Object, java.lang.Object) method, but allows object to be nullable.
    static boolean
    le(boolean b0, boolean b1)
    SQL operator applied to boolean values.
    static boolean
    le(String b0, String b1)
    SQL operator applied to String values.
    static boolean
    le(String b0, String b1, Comparator<String> comparator)
    SQL operator applied to String values.
    static boolean
    SQL operator applied to BigDecimal values.
    static boolean
    le(org.apache.calcite.avatica.util.ByteString b0, org.apache.calcite.avatica.util.ByteString b1)
    SQL operator applied to ByteString values.
    static boolean
    leAny(Object b0, Object b1)
    SQL operator applied to Object values (at least one operand has ANY type; neither may be null).
    static <T extends Comparable<T>>
    T
    least(T b0, T b1)
    LEAST operator.
    static String
    left(String s, int n)
    SQL LEFT(string, integer) function.
    static org.apache.calcite.avatica.util.ByteString
    left(org.apache.calcite.avatica.util.ByteString s, int n)
    SQL LEFT(ByteString, integer) function.
    static boolean
    lesser(boolean b0, boolean b1)
     
    static byte
    lesser(byte b0, byte b1)
     
    static char
    lesser(char b0, char b1)
     
    static double
    lesser(double b0, double b1)
     
    static float
    lesser(float b0, float b1)
     
    static int
    lesser(int b0, int b1)
     
    static long
    lesser(long b0, long b1)
     
    static short
    lesser(short b0, short b1)
     
    static <T extends Comparable<T>>
    T
    lesser(T b0, T b1)
    Helper for implementing MIN.
    static boolean
    like(String s, String pattern)
    SQL LIKE function.
    static boolean
    like(String s, String pattern, String escape)
    SQL LIKE function with escape.
    static double
    ln(double d)
    SQL LN(number) function applied to double values.
    static double
    SQL LN(number) function applied to BigDecimal values.
    static Locale
     
    static int
    SQL LOCAL_TIME function.
    static long
    SQL LOCAL_TIMESTAMP function.
    static double
    log10(double b0)
    SQL LOG10(numeric) operator applied to double values.
    static double
    SQL LOG10(number) function applied to BigDecimal values.
    static String
    SQL LOWER(string) function.
    static String
    lpad(String originalValue, int returnLength)
    SQL LPAD(string, integer) function.
    static String
    lpad(String originalValue, int returnLength, String pattern)
    SQL LPAD(string, integer, string) function.
    static org.apache.calcite.avatica.util.ByteString
    lpad(org.apache.calcite.avatica.util.ByteString originalValue, int returnLength)
    SQL LPAD(binary, integer, binary) function.
    static org.apache.calcite.avatica.util.ByteString
    lpad(org.apache.calcite.avatica.util.ByteString originalValue, int returnLength, org.apache.calcite.avatica.util.ByteString pattern)
    SQL LPAD(binary, integer, binary) function.
    static boolean
    lt(boolean b0, boolean b1)
    SQL < operator applied to boolean values.
    static boolean
    lt(byte b0, byte b1)
     
    static boolean
    lt(char b0, char b1)
     
    static boolean
    lt(double b0, double b1)
     
    static boolean
    lt(float b0, float b1)
     
    static boolean
    lt(int b0, int b1)
     
    static boolean
    lt(long b0, long b1)
     
    static boolean
    lt(short b0, short b1)
     
    static boolean
    lt(String b0, String b1)
    SQL < operator applied to String values.
    static boolean
    lt(String b0, String b1, Comparator<String> comparator)
    SQL < operator applied to String values.
    static boolean
    SQL < operator applied to BigDecimal values.
    static boolean
    lt(org.apache.calcite.avatica.util.ByteString b0, org.apache.calcite.avatica.util.ByteString b1)
    SQL < operator applied to ByteString values.
    static boolean
    ltAny(Object b0, Object b1)
    SQL < operator applied to Object values.
    static <T extends Comparable<T>>
    boolean
    ltNullable(T b0, T b1)
    Returns whether b0 is less than b1 (or b1 is null).
    static String
    SQL LTRIM function.
    static @Nullable Object
    mapItem(Map map, Object item)
    Helper for "map element reference".
    static @Nullable Object
    mapItemOptional(@Nullable Map map, Object item)
    As mapItem(java.util.Map, java.lang.Object) method, but allows map to be nullable.
    static String
    md5(String string)
    SQL MD5(string) function.
    static String
    md5(org.apache.calcite.avatica.util.ByteString string)
    SQL MD5(string) function for binary string.
    static boolean
    memberOf(@Nullable Object object, Collection collection)
    Support the MEMBER OF function.
    static int
    minus(int b0, int b1)
    SQL - operator applied to int values.
    static @PolyNull Integer
    minus(int b0, @PolyNull Integer b1)
    SQL - operator applied to int values; right side may be null.
    static @PolyNull Integer
    minus(@PolyNull Integer b0, int b1)
    SQL - operator applied to int values; left side may be null.
    static @PolyNull Integer
    minus(@PolyNull Integer b0, @PolyNull Integer b1)
    SQL - operator applied to nullable int values.
    static @PolyNull Long
    minus(@PolyNull Integer b0, @PolyNull Long b1)
    SQL - operator applied to nullable int and long values.
    static @PolyNull Long
    minus(@PolyNull Long b0, @PolyNull Integer b1)
    SQL - operator applied to nullable long and int values.
    static @PolyNull BigDecimal
    minus(@PolyNull BigDecimal b0, @PolyNull BigDecimal b1)
    SQL - operator applied to nullable BigDecimal values.
    static @PolyNull Object
    minusAny(@PolyNull Object b0, @PolyNull Object b1)
    SQL - operator applied to Object values (at least one operand has ANY type; either may be null).
    static byte
    mod(byte b0, byte b1)
    SQL MOD operator applied to byte values.
    static int
    mod(int b0, int b1)
    SQL MOD operator applied to int values.
    static BigDecimal
    mod(int b0, BigDecimal b1)
     
    static long
    mod(long b0, long b1)
    SQL MOD operator applied to long values.
    static short
    mod(short b0, short b1)
    SQL MOD operator applied to short values.
    static BigDecimal
    mod(BigDecimal b0, int b1)
     
    static BigDecimal
     
    static String
    monthNameWithDate(int date, Locale locale)
    SQL MONTHNAME function, applied to a DATE argument.
    static String
    monthNameWithTimestamp(long timestamp, Locale locale)
    SQL MONTHNAME function, applied to a TIMESTAMP argument.
    static int
    multiply(int b0, int b1)
    SQL * operator applied to int values.
    static @PolyNull Integer
    multiply(int b0, @PolyNull Integer b1)
    SQL * operator applied to int values; right side may be null.
    static @PolyNull Integer
    multiply(@PolyNull Integer b0, int b1)
    SQL * operator applied to int values; left side may be null.
    static @PolyNull Integer
    multiply(@PolyNull Integer b0, @PolyNull Integer b1)
    SQL * operator applied to nullable int values.
    static @PolyNull Long
    multiply(@PolyNull Integer b0, @PolyNull Long b1)
    SQL * operator applied to nullable int and long values.
    static @PolyNull Long
    multiply(@PolyNull Long b0, @PolyNull Integer b1)
    SQL * operator applied to nullable long and int values.
    static @PolyNull BigDecimal
    multiply(@PolyNull BigDecimal b0, @PolyNull BigDecimal b1)
    SQL * operator applied to nullable BigDecimal values.
    static @PolyNull Object
    multiplyAny(@PolyNull Object b0, @PolyNull Object b1)
    SQL * operator applied to Object values (at least one operand has ANY type; either may be null).
    static <E> Collection<E>
    Support the MULTISET EXCEPT ALL function.
    static <E> Collection<E>
    Support the MULTISET EXCEPT DISTINCT function.
    static <E> Collection<E>
    Support the MULTISET INTERSECT ALL function.
    static <E> Collection<E>
    Support the MULTISET INTERSECT DISTINCT function.
    static Collection
    multisetUnionAll(Collection collection1, Collection collection2)
    Support the MULTISET UNION ALL function.
    static Collection
    multisetUnionDistinct(Collection collection1, Collection collection2)
    Support the MULTISET UNION function.
    static boolean
    ne(Object b0, Object b1)
    SQL <gt; operator applied to Object values (including String; neither side may be null).
    static boolean
    ne(String s0, String s1, Comparator<String> comparator)
    SQL <gt; operator applied to OString values with a certain Comparator.
    static boolean
    SQL <gt; operator applied to BigDecimal values.
    static boolean
    neAny(Object b0, Object b1)
    SQL <gt; operator applied to Object values (at least one operand has ANY type, including String; neither may be null).
    static @PolyNull Boolean
    not(@PolyNull Boolean b)
    NULL → NULL, FALSE → TRUE, TRUE → FALSE.
    static int
    octetLength(org.apache.calcite.avatica.util.ByteString s)
    SQL OCTET_LENGTH(binary) function.
    static String
    overlay(String s, String r, int start)
    SQL OVERLAY function.
    static String
    overlay(String s, String r, int start, int length)
    SQL OVERLAY function.
    static org.apache.calcite.avatica.util.ByteString
    overlay(org.apache.calcite.avatica.util.ByteString s, org.apache.calcite.avatica.util.ByteString r, int start)
    SQL OVERLAY function applied to binary strings.
    static org.apache.calcite.avatica.util.ByteString
    overlay(org.apache.calcite.avatica.util.ByteString s, org.apache.calcite.avatica.util.ByteString r, int start, int length)
    SQL OVERLAY function applied to binary strings.
    static int
    plus(int b0, int b1)
    SQL + operator applied to int values.
    static @PolyNull Integer
    plus(int b0, @PolyNull Integer b1)
    SQL + operator applied to int values; right side may be null.
    static @PolyNull Integer
    plus(@PolyNull Integer b0, int b1)
    SQL + operator applied to int values; left side may be null.
    static @PolyNull Integer
    plus(@PolyNull Integer b0, @PolyNull Integer b1)
    SQL + operator applied to nullable int values.
    static @PolyNull Long
    plus(@PolyNull Integer b0, @PolyNull Long b1)
    SQL + operator applied to nullable int and long values.
    static @PolyNull Long
    plus(@PolyNull Long b0, @PolyNull Integer b1)
    SQL + operator applied to nullable long and int values.
    static @PolyNull BigDecimal
    plus(@PolyNull BigDecimal b0, @PolyNull BigDecimal b1)
    SQL + operator applied to BigDecimal values.
    static @PolyNull Object
    plusAny(@PolyNull Object b0, @PolyNull Object b1)
    SQL + operator applied to Object values (at least one operand has ANY type; either may be null).
    static int
    SQL POSITION(seek IN string) function.
    static int
    position(String seek, String s, int from)
    SQL POSITION(seek IN string FROM integer) function.
    static int
    position(org.apache.calcite.avatica.util.ByteString seek, org.apache.calcite.avatica.util.ByteString s)
    SQL POSITION(seek IN string) function for byte strings.
    static int
    position(org.apache.calcite.avatica.util.ByteString seek, org.apache.calcite.avatica.util.ByteString s, int from)
    SQL POSITION(seek IN string FROM integer) function for byte strings.
    static boolean
    posixRegex(String s, String regex, boolean caseSensitive)
     
    static double
    power(double b0, double b1)
    SQL POWER operator applied to double values.
    static double
    power(double b0, BigDecimal b1)
     
    static double
    power(BigDecimal b0, double b1)
     
    static double
     
    product(List<Enumerator<List<E>>> enumerators, int fieldCount, boolean withOrdinality)
    Similar to Linq4j.product(Iterable) but each resulting list implements FlatLists.ComparableList.
    static double
    radians(double b0)
    SQL RADIANS operator applied to double values.
    static double
    SQL RADIANS operator applied to BigDecimal values.
    static String
    regexpReplace(String s, String regex, String replacement)
    SQL REGEXP_REPLACE function with 3 arguments.
    static String
    regexpReplace(String s, String regex, String replacement, int pos)
    SQL REGEXP_REPLACE function with 4 arguments.
    static String
    regexpReplace(String s, String regex, String replacement, int pos, int occurrence)
    SQL REGEXP_REPLACE function with 5 arguments.
    static String
    regexpReplace(String s, String regex, String replacement, int pos, int occurrence, @Nullable String matchType)
    SQL REGEXP_REPLACE function with 6 arguments.
    static String
    repeat(String s, int n)
    SQL REPEAT(string, int) function.
    static String
    replace(String s, String search, String replacement)
    SQL REPLACE(string, search, replacement) function.
    static String
    SQL REVERSE(string) function.
    static List
    reverse(List list)
    Support the ARRAY_REVERSE function.
    static String
    right(String s, int n)
    SQL RIGHT(string, integer) function.
    static org.apache.calcite.avatica.util.ByteString
    right(org.apache.calcite.avatica.util.ByteString s, int n)
    SQL RIGHT(ByteString, integer) function.
    static boolean
    rlike(String s, String pattern)
    SQL RLIKE function.
    static int
    round(int v, int x)
    Helper for rounding.
    static long
    round(long v, long x)
    Helper for rounding.
    static String
    rpad(String originalValue, int returnLength)
    SQL RPAD(string, integer) function.
    static String
    rpad(String originalValue, int returnLength, String pattern)
    SQL RPAD(string, integer, string) function.
    static org.apache.calcite.avatica.util.ByteString
    rpad(org.apache.calcite.avatica.util.ByteString originalValue, int returnLength)
    SQL RPAD(binary, integer) function.
    static org.apache.calcite.avatica.util.ByteString
    rpad(org.apache.calcite.avatica.util.ByteString originalValue, int returnLength, org.apache.calcite.avatica.util.ByteString pattern)
    SQL RPAD(binary, integer, binary) function.
    static String
    SQL RTRIM function applied to string.
    static org.apache.calcite.avatica.util.ByteString
    rtrim(org.apache.calcite.avatica.util.ByteString s)
    Helper for CAST.
    static long
    Support the CURRENT VALUE OF sequence operator.
    static long
    Support the NEXT VALUE OF sequence operator.
    static String
    sha1(String string)
    SQL SHA1(string) function.
    static String
    sha1(org.apache.calcite.avatica.util.ByteString string)
    SQL SHA1(string) function for binary string.
    static double
    sign(double b0)
    SQL SIGN operator applied to double values.
    static int
    sign(int b0)
    SQL SIGN operator applied to int values.
    static long
    sign(long b0)
    SQL SIGN operator applied to long values.
    static BigDecimal
    SQL SIGN operator applied to BigDecimal values.
    static boolean
    similar(String s, String pattern)
    SQL SIMILAR function.
    static boolean
    similar(String s, String pattern, String escape)
    SQL SIMILAR function with escape.
    static double
    sin(double b0)
    SQL SIN operator applied to double values.
    static double
    SQL SIN operator applied to BigDecimal values.
    static double
    sinh(double b)
    SQL SINH operator applied to double values.
    static double
    SQL SINH operator applied to BigDecimal values.
    static List
    slice(List list)
    Support the SLICE function.
    static String
    SQL SOUNDEX(string) function.
    static String
    space(int n)
    SQL SPACE(int) function.
    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 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 BigDecimal
    SQL ROUND operator applied to BigDecimal values.
    static BigDecimal
    sround(BigDecimal b0, int b1)
    SQL ROUND operator applied to BigDecimal values.
    static boolean
    SQL STARTS_WITH(string, string) function.
    static boolean
    startsWith(org.apache.calcite.avatica.util.ByteString s0, org.apache.calcite.avatica.util.ByteString s1)
    SQL STARTS_WITH(binary, binary) function.
    static int
    strcmp(String s0, String s1)
    SQL STRCMP(String,String) function.
    static @Nullable Object
    structAccess(@Nullable Object structObject, int index, @Nullable String fieldName)
    Implements the . (field access) operator on an object whose type is not known until runtime.
    static double
    struncate(double b0)
    SQL TRUNCATE operator applied to double values.
    static double
    struncate(double 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 BigDecimal
    SQL TRUNCATE operator applied to BigDecimal values.
    static BigDecimal
    struncate(BigDecimal b0, int b1)
     
    static boolean
    submultisetOf(Collection possibleSubMultiset, Collection multiset)
    Support the SUBMULTISET OF function.
    static String
    substring(String c, int s)
    SQL SUBSTRING(string FROM ...) function.
    static String
    substring(String c, int s, int l)
    SQL SUBSTRING(string FROM ...
    static org.apache.calcite.avatica.util.ByteString
    substring(org.apache.calcite.avatica.util.ByteString c, int s)
    SQL SUBSTRING(binary FROM ...) function for binary.
    static org.apache.calcite.avatica.util.ByteString
    substring(org.apache.calcite.avatica.util.ByteString c, int s, int l)
    SQL SUBSTRING(binary FROM ...
    static String
    SQL SYSTEM_USER function.
    static double
    tan(double b0)
    SQL TAN operator applied to double values.
    static double
    SQL TAN operator applied to BigDecimal values.
    static double
    tanh(double b)
    SQL TANH operator applied to double values.
    static double
    SQL TANH operator applied to BigDecimal values.
    static boolean
    throwUnless(boolean condition, String message)
    Internal THROW_UNLESS(condition, message) function.
    static int
    time(int hour, int minute, int second)
    SQL TIME(<hour>, <minute>, <second>) function.
    static int
    time(long timestampMillis)
    SQL TIME(<timestamp>) and TIME(<timestampLtz>) functions.
    static int
    time(long timestampMillis, String timeZone)
    SQL TIME(<timestampLtz>, <timeZone>) function.
    static long
    timestamp(int days)
    SQL TIMESTAMP(<date>) function.
    static long
    timestamp(int days, String timeZone)
    SQL TIMESTAMP(<date>, <timeZone>) function.
    static long
    timestamp(long millisSinceEpoch)
    SQL TIMESTAMP(<timestamp>) function; returns a TIMESTAMP WITH LOCAL TIME ZONE.
    static long
    timestamp(long millisSinceEpoch, String timeZone)
    SQL TIMESTAMP(<timestamp>, <timeZone>) function; returns a TIMESTAMP WITH LOCAL TIME ZONE.
    static long
    timestamp(String expression)
    SQL TIMESTAMP(<string>) function.
    static long
    timestamp(String expression, String timeZone)
    SQL TIMESTAMP(<string>, <timeZone>) function.
    static long
    static long
    static long
    static int
    timestampToDate(long timestamp)
    Converts a timestamp (milliseconds since epoch) to a date (days since epoch).
    static int
    timestampToTime(long timestamp)
    Converts a timestamp (milliseconds since epoch) to a time (milliseconds since midnight).
    static int
     
    static String
     
    static int
     
    static long
     
    static int
     
    static String
     
    static int
     
    static long
     
    static long
     
    static TimeZone
     
    static String
    toBase64(String string)
    SQL TO_BASE64(string) function.
    static String
    toBase64(org.apache.calcite.avatica.util.ByteString string)
    SQL TO_BASE64(string) function for binary string.
    static BigDecimal
     
    static BigDecimal
     
    static BigDecimal
     
    static boolean
    toBoolean(Number number)
     
    static boolean
     
    static boolean
    CAST(VARCHAR AS BOOLEAN).
    static byte
    toByte(Number number)
     
    static byte
     
    static char
     
    static Character
     
    static double
    toDouble(Number number)
     
    static double
     
    static double
     
    static float
    toFloat(Number number)
     
    static float
     
    static float
     
    static int
    toInt(Number number)
     
    static int
     
    static int
     
    static int
    Converts a SQL DATE value from the Java type (Date) to the internal representation type (number of days since January 1st, 1970 as int) in the local time zone.
    static int
    toInt(Date v, TimeZone timeZone)
    Converts a SQL DATE value from the Java type (Date) to the internal representation type (number of days since January 1st, 1970 as int).
    static int
    Converts a SQL TIME value from the Java type (Time) to the internal representation type (number of milliseconds since January 1st, 1970 as int) in the local time zone.
    static @PolyNull Integer
    toIntOptional(@PolyNull Object o)
     
    static @PolyNull Integer
    toIntOptional(@PolyNull Date v)
    Converts a nullable SQL DATE value from the Java type (Date) to the internal representation type (number of days since January 1st, 1970 as Integer) in the local time zone.
    static @PolyNull Integer
    toIntOptional(@PolyNull Date v, TimeZone timeZone)
    Converts a nullable SQL DATE value from the Java type (Date) to the internal representation type (number of days since January 1st, 1970 as Integer).
    static @PolyNull Integer
    toIntOptional(@PolyNull Time v)
    Converts a nullable SQL TIME value from the Java type (Time) to the internal representation type (number of milliseconds since January 1st, 1970 as Integer).
    static long
    toLong(Number number)
     
    static long
     
    static long
     
    static long
    Converts a SQL TIMESTAMP value from the Java type (Timestamp) to the internal representation type (number of milliseconds since January 1st, 1970 as long).
    static long
    toLong(Timestamp v, TimeZone timeZone)
    Converts a SQL TIMESTAMP value from the Java type (Timestamp) to the internal representation type (number of milliseconds since January 1st, 1970 as long).
    static long
    Converts a SQL TIMESTAMP value from the Java type (Date) to the internal representation type (number of milliseconds since January 1st, 1970 as long).
    static @PolyNull Long
    toLongOptional(@PolyNull Object o)
     
    static @PolyNull Long
    Converts a nullable SQL TIMESTAMP value from the Java type (Timestamp) to the internal representation type (number of milliseconds since January 1st, 1970 as Long) in the local time zone.
    static @PolyNull Long
    toLongOptional(@PolyNull Timestamp v, TimeZone timeZone)
    Converts a nullable SQL TIMESTAMP value from the Java type (Timestamp) to the internal representation type (number of milliseconds since January 1st, 1970 as Long).
    static short
    toShort(Number number)
     
    static short
     
    static short
     
    static String
    toString(boolean x)
    CAST(BOOLEAN AS VARCHAR).
    static String
    toString(double x)
    CAST(DOUBLE AS VARCHAR).
    static String
    toString(float x)
    CAST(FLOAT AS VARCHAR).
    static String
    CAST(DECIMAL AS VARCHAR).
    static @PolyNull Long
     
    static @PolyNull Long
     
    static @PolyNull Integer
     
    static @PolyNull Integer
    toTimeWithLocalTimeZone(@PolyNull String v, TimeZone timeZone)
     
    static String
    translate3(String s, String search, String replacement)
    SQL TRANSLATE(string, search_chars, replacement_chars) function.
    static String
    trim(boolean left, boolean right, String seek, String s)
    SQL TRIM(... seek FROM s) function.
    static String
    trim(boolean left, boolean right, String seek, String s, boolean strict)
     
    static org.apache.calcite.avatica.util.ByteString
    trim(org.apache.calcite.avatica.util.ByteString s)
    SQL TRIM function applied to binary string.
    static int
    truncate(int v, int x)
    Helper for rounding.
    static long
    truncate(long v, long x)
    Helper for rounding.
    static @PolyNull String
    truncate(@PolyNull String s, int maxLength)
    Helper for CAST(...
    static @PolyNull org.apache.calcite.avatica.util.ByteString
    truncate(@PolyNull org.apache.calcite.avatica.util.ByteString s, int maxLength)
    Helper for CAST(...
    static @PolyNull String
    truncateOrPad(@PolyNull String s, int maxLength)
    Helper for CAST(...
    static @PolyNull org.apache.calcite.avatica.util.ByteString
    truncateOrPad(@PolyNull org.apache.calcite.avatica.util.ByteString s, int maxLength)
    Helper for CAST(...
    static int
    unixDate(int v)
    static long
    unixMicros(long v)
    static long
    unixMillis(long v)
    static long
    unixSeconds(long v)
    static String
    SQL UPPER(string) function.
    static String
    SQL USER function.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • throwUnless

      public static boolean throwUnless(boolean condition, String message)
      Internal THROW_UNLESS(condition, message) function.

      The method is marked NonDeterministic to prevent the generator from storing its value as a constant.

    • toBase64

      public static String toBase64(String string)
      SQL TO_BASE64(string) function.
    • toBase64

      public static String toBase64(org.apache.calcite.avatica.util.ByteString string)
      SQL TO_BASE64(string) function for binary string.
    • fromBase64

      public static @Nullable org.apache.calcite.avatica.util.ByteString fromBase64(String base64)
      SQL FROM_BASE64(string) function.
    • md5

      public static String md5(String string)
      SQL MD5(string) function.
    • md5

      public static String md5(org.apache.calcite.avatica.util.ByteString string)
      SQL MD5(string) function for binary string.
    • sha1

      public static String sha1(String string)
      SQL SHA1(string) function.
    • sha1

      public static String sha1(org.apache.calcite.avatica.util.ByteString string)
      SQL SHA1(string) function for binary string.
    • regexpReplace

      public static String regexpReplace(String s, String regex, String replacement)
      SQL REGEXP_REPLACE function with 3 arguments.
    • regexpReplace

      public static String regexpReplace(String s, String regex, String replacement, int pos)
      SQL REGEXP_REPLACE function with 4 arguments.
    • regexpReplace

      public static String regexpReplace(String s, String regex, String replacement, int pos, int occurrence)
      SQL REGEXP_REPLACE function with 5 arguments.
    • regexpReplace

      public static String regexpReplace(String s, String regex, String replacement, int pos, int occurrence, @Nullable String matchType)
      SQL REGEXP_REPLACE function with 6 arguments.
    • lpad

      public static String lpad(String originalValue, int returnLength, String pattern)
      SQL LPAD(string, integer, string) function.
    • lpad

      public static String lpad(String originalValue, int returnLength)
      SQL LPAD(string, integer) function.
    • lpad

      public static org.apache.calcite.avatica.util.ByteString lpad(org.apache.calcite.avatica.util.ByteString originalValue, int returnLength, org.apache.calcite.avatica.util.ByteString pattern)
      SQL LPAD(binary, integer, binary) function.
    • lpad

      public static org.apache.calcite.avatica.util.ByteString lpad(org.apache.calcite.avatica.util.ByteString originalValue, int returnLength)
      SQL LPAD(binary, integer, binary) function.
    • rpad

      public static String rpad(String originalValue, int returnLength, String pattern)
      SQL RPAD(string, integer, string) function.
    • rpad

      public static String rpad(String originalValue, int returnLength)
      SQL RPAD(string, integer) function.
    • rpad

      public static org.apache.calcite.avatica.util.ByteString rpad(org.apache.calcite.avatica.util.ByteString originalValue, int returnLength, org.apache.calcite.avatica.util.ByteString pattern)
      SQL RPAD(binary, integer, binary) function.
    • rpad

      public static org.apache.calcite.avatica.util.ByteString rpad(org.apache.calcite.avatica.util.ByteString originalValue, int returnLength)
      SQL RPAD(binary, integer) function.
    • endsWith

      public static boolean endsWith(String s0, String s1)
      SQL ENDS_WITH(string, string) function.
    • endsWith

      public static boolean endsWith(org.apache.calcite.avatica.util.ByteString s0, org.apache.calcite.avatica.util.ByteString s1)
      SQL ENDS_WITH(binary, binary) function.
    • startsWith

      public static boolean startsWith(String s0, String s1)
      SQL STARTS_WITH(string, string) function.
    • startsWith

      public static boolean startsWith(org.apache.calcite.avatica.util.ByteString s0, org.apache.calcite.avatica.util.ByteString s1)
      SQL STARTS_WITH(binary, binary) function.
    • substring

      public static String substring(String c, int s)
      SQL SUBSTRING(string FROM ...) function.
    • substring

      public static String substring(String c, int s, int l)
      SQL SUBSTRING(string FROM ... FOR ...) function.
    • substring

      public static org.apache.calcite.avatica.util.ByteString substring(org.apache.calcite.avatica.util.ByteString c, int s)
      SQL SUBSTRING(binary FROM ...) function for binary.
    • substring

      public static org.apache.calcite.avatica.util.ByteString substring(org.apache.calcite.avatica.util.ByteString c, int s, int l)
      SQL SUBSTRING(binary FROM ... FOR ...) function for binary.
    • upper

      public static String upper(String s)
      SQL UPPER(string) function.
    • lower

      public static String lower(String s)
      SQL LOWER(string) function.
    • initcap

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

      public static String reverse(String s)
      SQL REVERSE(string) function.
    • ascii

      public static int ascii(String s)
      SQL ASCII(string) function.
    • repeat

      public static String repeat(String s, int n)
      SQL REPEAT(string, int) function.
    • space

      public static String space(int n)
      SQL SPACE(int) function.
    • strcmp

      public static int strcmp(String s0, String s1)
      SQL STRCMP(String,String) function.
    • soundex

      public static String soundex(String s)
      SQL SOUNDEX(string) function.
    • difference

      public static int difference(String s0, String s1)
      SQL DIFFERENCE(string, string) function.
    • left

      public static String left(String s, int n)
      SQL LEFT(string, integer) function.
    • left

      public static org.apache.calcite.avatica.util.ByteString left(org.apache.calcite.avatica.util.ByteString s, int n)
      SQL LEFT(ByteString, integer) function.
    • right

      public static String right(String s, int n)
      SQL RIGHT(string, integer) function.
    • right

      public static org.apache.calcite.avatica.util.ByteString right(org.apache.calcite.avatica.util.ByteString s, int n)
      SQL RIGHT(ByteString, integer) function.
    • charFromAscii

      public static @Nullable String charFromAscii(int n)
      SQL CHAR(integer) function, as in MySQL and Spark.

      Returns the ASCII character of n modulo 256, or null if n < 0.

    • charFromUtf8

      public static String charFromUtf8(int n)
      SQL CHR(integer) function, as in Oracle and Postgres.

      Returns the UTF-8 character whose code is n.

    • octetLength

      public static int octetLength(org.apache.calcite.avatica.util.ByteString s)
      SQL OCTET_LENGTH(binary) function.
    • charLength

      public static int charLength(String s)
      SQL CHARACTER_LENGTH(string) function.
    • concat

      public static String concat(String s0, String s1)
      SQL string || string operator.
    • concat

      public static org.apache.calcite.avatica.util.ByteString concat(org.apache.calcite.avatica.util.ByteString s0, org.apache.calcite.avatica.util.ByteString s1)
      SQL binary || binary operator.
    • concatMulti

      public static String concatMulti(String... args)
      SQL CONCAT(arg0, arg1, arg2, ...) function.
    • rtrim

      public static String rtrim(String s)
      SQL RTRIM function applied to string.
    • ltrim

      public static String ltrim(String s)
      SQL LTRIM function.
    • trim

      public static String trim(boolean left, boolean right, String seek, String s)
      SQL TRIM(... seek FROM s) function.
    • trim

      public static String trim(boolean left, boolean right, String seek, String s, boolean strict)
    • trim

      public static org.apache.calcite.avatica.util.ByteString trim(org.apache.calcite.avatica.util.ByteString s)
      SQL TRIM function applied to binary string.
    • rtrim

      public static org.apache.calcite.avatica.util.ByteString rtrim(org.apache.calcite.avatica.util.ByteString s)
      Helper for CAST.
    • overlay

      public static String overlay(String s, String r, int start)
      SQL OVERLAY function.
    • overlay

      public static String overlay(String s, String r, int start, int length)
      SQL OVERLAY function.
    • overlay

      public static org.apache.calcite.avatica.util.ByteString overlay(org.apache.calcite.avatica.util.ByteString s, org.apache.calcite.avatica.util.ByteString r, int start)
      SQL OVERLAY function applied to binary strings.
    • overlay

      public static org.apache.calcite.avatica.util.ByteString overlay(org.apache.calcite.avatica.util.ByteString s, org.apache.calcite.avatica.util.ByteString r, int start, int length)
      SQL OVERLAY function applied to binary strings.
    • like

      public static boolean like(String s, String pattern)
      SQL LIKE function.
    • like

      public static boolean like(String s, String pattern, String escape)
      SQL LIKE function with escape.
    • ilike

      public static boolean ilike(String s, String pattern)
      SQL ILIKE function.
    • ilike

      public static boolean ilike(String s, String pattern, String escape)
      SQL ILIKE function with escape.
    • rlike

      public static boolean rlike(String s, String pattern)
      SQL RLIKE function.
    • similar

      public static boolean similar(String s, String pattern)
      SQL SIMILAR function.
    • similar

      public static boolean similar(String s, String pattern, String escape)
      SQL SIMILAR function with escape.
    • posixRegex

      public static boolean posixRegex(String s, String regex, boolean caseSensitive)
    • eq

      public static boolean eq(BigDecimal b0, BigDecimal b1)
      SQL = operator applied to BigDecimal values (neither may be null).
    • eq

      public static boolean eq(@Nullable Object @Nullable [] b0, @Nullable Object @Nullable [] b1)
      SQL = operator applied to Object[] values (neither may be null).
    • eq

      public static boolean eq(Object b0, Object b1)
      SQL = operator applied to Object values (including String; neither side may be null).
    • eq

      public static boolean eq(String s0, String s1, Comparator<String> comparator)
      SQL = operator applied to String values with a certain Comparator.
    • eqAny

      public static boolean eqAny(Object b0, Object b1)
      SQL = operator applied to Object values (at least one operand has ANY type; neither may be null).
    • ne

      public static boolean ne(BigDecimal b0, BigDecimal b1)
      SQL <gt; operator applied to BigDecimal values.
    • ne

      public static boolean ne(Object b0, Object b1)
      SQL <gt; operator applied to Object values (including String; neither side may be null).
    • ne

      public static boolean ne(String s0, String s1, Comparator<String> comparator)
      SQL <gt; operator applied to OString values with a certain Comparator.
    • neAny

      public static boolean neAny(Object b0, Object b1)
      SQL <gt; operator applied to Object values (at least one operand has ANY type, including String; neither may be null).
    • lt

      public static boolean lt(boolean b0, boolean b1)
      SQL < operator applied to boolean values.
    • lt

      public static boolean lt(String b0, String b1)
      SQL < operator applied to String values.
    • lt

      public static boolean lt(String b0, String b1, Comparator<String> comparator)
      SQL < operator applied to String values.
    • lt

      public static boolean lt(org.apache.calcite.avatica.util.ByteString b0, org.apache.calcite.avatica.util.ByteString b1)
      SQL < operator applied to ByteString values.
    • lt

      public static boolean lt(BigDecimal b0, BigDecimal b1)
      SQL < operator applied to BigDecimal values.
    • ltNullable

      public static <T extends Comparable<T>> boolean ltNullable(T b0, T b1)
      Returns whether b0 is less than b1 (or b1 is null). Helper for ARG_MIN.
    • lt

      public static boolean lt(byte b0, byte b1)
    • lt

      public static boolean lt(char b0, char b1)
    • lt

      public static boolean lt(short b0, short b1)
    • lt

      public static boolean lt(int b0, int b1)
    • lt

      public static boolean lt(long b0, long b1)
    • lt

      public static boolean lt(float b0, float b1)
    • lt

      public static boolean lt(double b0, double b1)
    • ltAny

      public static boolean ltAny(Object b0, Object b1)
      SQL < operator applied to Object values.
    • le

      public static boolean le(boolean b0, boolean b1)
      SQL operator applied to boolean values.
    • le

      public static boolean le(String b0, String b1)
      SQL operator applied to String values.
    • le

      public static boolean le(String b0, String b1, Comparator<String> comparator)
      SQL operator applied to String values.
    • le

      public static boolean le(org.apache.calcite.avatica.util.ByteString b0, org.apache.calcite.avatica.util.ByteString b1)
      SQL operator applied to ByteString values.
    • le

      public static boolean le(BigDecimal b0, BigDecimal b1)
      SQL operator applied to BigDecimal values.
    • leAny

      public static boolean leAny(Object b0, Object b1)
      SQL operator applied to Object values (at least one operand has ANY type; neither may be null).
    • gt

      public static boolean gt(boolean b0, boolean b1)
      SQL > operator applied to boolean values.
    • gt

      public static boolean gt(String b0, String b1)
      SQL > operator applied to String values.
    • gt

      public static boolean gt(String b0, String b1, Comparator<String> comparator)
      SQL > operator applied to String values.
    • gt

      public static boolean gt(org.apache.calcite.avatica.util.ByteString b0, org.apache.calcite.avatica.util.ByteString b1)
      SQL > operator applied to ByteString values.
    • gt

      public static boolean gt(BigDecimal b0, BigDecimal b1)
      SQL > operator applied to BigDecimal values.
    • gtNullable

      public static <T extends Comparable<T>> boolean gtNullable(T b0, T b1)
      Returns whether b0 is greater than b1 (or b1 is null). Helper for ARG_MAX.
    • gt

      public static boolean gt(byte b0, byte b1)
    • gt

      public static boolean gt(char b0, char b1)
    • gt

      public static boolean gt(short b0, short b1)
    • gt

      public static boolean gt(int b0, int b1)
    • gt

      public static boolean gt(long b0, long b1)
    • gt

      public static boolean gt(float b0, float b1)
    • gt

      public static boolean gt(double b0, double b1)
    • gtAny

      public static boolean gtAny(Object b0, Object b1)
      SQL > operator applied to Object values (at least one operand has ANY type; neither may be null).
    • ge

      public static boolean ge(boolean b0, boolean b1)
      SQL operator applied to boolean values.
    • ge

      public static boolean ge(String b0, String b1)
      SQL operator applied to String values.
    • ge

      public static boolean ge(String b0, String b1, Comparator<String> comparator)
      SQL operator applied to String values.
    • ge

      public static boolean ge(org.apache.calcite.avatica.util.ByteString b0, org.apache.calcite.avatica.util.ByteString b1)
      SQL operator applied to ByteString values.
    • ge

      public static boolean ge(BigDecimal b0, BigDecimal b1)
      SQL operator applied to BigDecimal values.
    • geAny

      public static boolean geAny(Object b0, Object b1)
      SQL operator applied to Object values (at least one operand has ANY type; neither may be null).
    • plus

      public static int plus(int b0, int b1)
      SQL + operator applied to int values.
    • plus

      public static @PolyNull Integer plus(@PolyNull Integer b0, int b1)
      SQL + operator applied to int values; left side may be null.
    • plus

      public static @PolyNull Integer plus(int b0, @PolyNull Integer b1)
      SQL + operator applied to int values; right side may be null.
    • plus

      public static @PolyNull Integer plus(@PolyNull Integer b0, @PolyNull Integer b1)
      SQL + operator applied to nullable int values.
    • plus

      public static @PolyNull Long plus(@PolyNull Long b0, @PolyNull Integer b1)
      SQL + operator applied to nullable long and int values.
    • plus

      public static @PolyNull Long plus(@PolyNull Integer b0, @PolyNull Long b1)
      SQL + operator applied to nullable int and long values.
    • plus

      public static @PolyNull BigDecimal plus(@PolyNull BigDecimal b0, @PolyNull BigDecimal b1)
      SQL + operator applied to BigDecimal values.
    • plusAny

      public static @PolyNull Object plusAny(@PolyNull Object b0, @PolyNull Object b1)
      SQL + operator applied to Object values (at least one operand has ANY type; either may be null).
    • minus

      public static int minus(int b0, int b1)
      SQL - operator applied to int values.
    • minus

      public static @PolyNull Integer minus(@PolyNull Integer b0, int b1)
      SQL - operator applied to int values; left side may be null.
    • minus

      public static @PolyNull Integer minus(int b0, @PolyNull Integer b1)
      SQL - operator applied to int values; right side may be null.
    • minus

      public static @PolyNull Integer minus(@PolyNull Integer b0, @PolyNull Integer b1)
      SQL - operator applied to nullable int values.
    • minus

      public static @PolyNull Long minus(@PolyNull Long b0, @PolyNull Integer b1)
      SQL - operator applied to nullable long and int values.
    • minus

      public static @PolyNull Long minus(@PolyNull Integer b0, @PolyNull Long b1)
      SQL - operator applied to nullable int and long values.
    • minus

      public static @PolyNull BigDecimal minus(@PolyNull BigDecimal b0, @PolyNull BigDecimal b1)
      SQL - operator applied to nullable BigDecimal values.
    • minusAny

      public static @PolyNull Object minusAny(@PolyNull Object b0, @PolyNull Object b1)
      SQL - operator applied to Object values (at least one operand has ANY type; either may be null).
    • divide

      public static int divide(int b0, int b1)
      SQL / operator applied to int values.
    • divide

      public static @PolyNull Integer divide(@PolyNull Integer b0, int b1)
      SQL / operator applied to int values; left side may be null.
    • divide

      public static @PolyNull Integer divide(int b0, @PolyNull Integer b1)
      SQL / operator applied to int values; right side may be null.
    • divide

      public static @PolyNull Integer divide(@PolyNull Integer b0, @PolyNull Integer b1)
      SQL / operator applied to nullable int values.
    • divide

      public static @PolyNull Long divide(Long b0, @PolyNull Integer b1)
      SQL / operator applied to nullable long and int values.
    • divide

      public static @PolyNull Long divide(@PolyNull Integer b0, @PolyNull Long b1)
      SQL / operator applied to nullable int and long values.
    • divide

      public static @PolyNull BigDecimal divide(@PolyNull BigDecimal b0, @PolyNull BigDecimal b1)
      SQL / operator applied to BigDecimal values.
    • divideAny

      public static @PolyNull Object divideAny(@PolyNull Object b0, @PolyNull Object b1)
      SQL / operator applied to Object values (at least one operand has ANY type; either may be null).
    • divide

      public static int divide(int b0, BigDecimal b1)
    • divide

      public static long divide(long b0, BigDecimal b1)
    • multiply

      public static int multiply(int b0, int b1)
      SQL * operator applied to int values.
    • multiply

      public static @PolyNull Integer multiply(@PolyNull Integer b0, int b1)
      SQL * operator applied to int values; left side may be null.
    • multiply

      public static @PolyNull Integer multiply(int b0, @PolyNull Integer b1)
      SQL * operator applied to int values; right side may be null.
    • multiply

      public static @PolyNull Integer multiply(@PolyNull Integer b0, @PolyNull Integer b1)
      SQL * operator applied to nullable int values.
    • multiply

      public static @PolyNull Long multiply(@PolyNull Long b0, @PolyNull Integer b1)
      SQL * operator applied to nullable long and int values.
    • multiply

      public static @PolyNull Long multiply(@PolyNull Integer b0, @PolyNull Long b1)
      SQL * operator applied to nullable int and long values.
    • multiply

      public static @PolyNull BigDecimal multiply(@PolyNull BigDecimal b0, @PolyNull BigDecimal b1)
      SQL * operator applied to nullable BigDecimal values.
    • multiplyAny

      public static @PolyNull Object multiplyAny(@PolyNull Object b0, @PolyNull Object b1)
      SQL * operator applied to Object values (at least one operand has ANY type; either may be null).
    • bitAnd

      public static long bitAnd(long b0, long b1)
      Bitwise function BIT_AND applied to integer values.
    • bitAnd

      public static org.apache.calcite.avatica.util.ByteString bitAnd(org.apache.calcite.avatica.util.ByteString b0, org.apache.calcite.avatica.util.ByteString b1)
      Bitwise function BIT_AND applied to binary values.
    • bitOr

      public static long bitOr(long b0, long b1)
      Bitwise function BIT_OR applied to integer values.
    • bitOr

      public static org.apache.calcite.avatica.util.ByteString bitOr(org.apache.calcite.avatica.util.ByteString b0, org.apache.calcite.avatica.util.ByteString b1)
      Bitwise function BIT_OR applied to binary values.
    • bitXor

      public static long bitXor(long b0, long b1)
      Bitwise function BIT_XOR applied to integer values.
    • bitXor

      public static org.apache.calcite.avatica.util.ByteString bitXor(org.apache.calcite.avatica.util.ByteString b0, org.apache.calcite.avatica.util.ByteString b1)
      Bitwise function BIT_XOR applied to binary values.
    • exp

      public static double exp(double b0)
      SQL EXP operator applied to double values.
    • exp

      public static double exp(BigDecimal b0)
    • power

      public static double power(double b0, double b1)
      SQL POWER operator applied to double values.
    • power

      public static double power(double b0, BigDecimal b1)
    • power

      public static double power(BigDecimal b0, double b1)
    • power

      public static double power(BigDecimal b0, BigDecimal b1)
    • ln

      public static double ln(double d)
      SQL LN(number) function applied to double values.
    • ln

      public static double ln(BigDecimal d)
      SQL LN(number) function applied to BigDecimal values.
    • log10

      public static double log10(double b0)
      SQL LOG10(numeric) operator applied to double values.
    • log10

      public static double log10(BigDecimal d)
      SQL LOG10(number) function applied to BigDecimal values.
    • mod

      public static byte mod(byte b0, byte b1)
      SQL MOD operator applied to byte values.
    • mod

      public static short mod(short b0, short b1)
      SQL MOD operator applied to short values.
    • mod

      public static int mod(int b0, int b1)
      SQL MOD operator applied to int values.
    • mod

      public static long mod(long b0, long b1)
      SQL MOD operator applied to long values.
    • mod

      public static BigDecimal mod(BigDecimal b0, int b1)
    • mod

      public static BigDecimal mod(int b0, BigDecimal b1)
    • mod

      public static BigDecimal mod(BigDecimal b0, BigDecimal b1)
    • floor

      public static double floor(double b0)
    • floor

      public static float floor(float b0)
    • floor

      public static BigDecimal floor(BigDecimal b0)
    • floor

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

      public static short floor(short b0, short b1)
      SQL FLOOR operator applied to short values.
    • 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 BigDecimal floor(BigDecimal b0, int b1)
    • floor

      public static int floor(int b0, BigDecimal b1)
    • floor

      public static BigDecimal floor(BigDecimal b0, BigDecimal b1)
    • ceil

      public static double ceil(double b0)
    • ceil

      public static float ceil(float b0)
    • ceil

      public static BigDecimal ceil(BigDecimal b0)
    • ceil

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

      public static short ceil(short b0, short b1)
      SQL CEIL operator applied to short values.
    • 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 BigDecimal ceil(BigDecimal b0, int b1)
    • ceil

      public static int ceil(int b0, BigDecimal b1)
    • ceil

      public static BigDecimal ceil(BigDecimal b0, BigDecimal b1)
    • 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 BigDecimal abs(BigDecimal b0)
      SQL ABS operator applied to BigDecimal values.
    • acos

      public static double acos(BigDecimal b0)
      SQL ACOS operator applied to BigDecimal values.
    • acos

      public static double acos(double b0)
      SQL ACOS operator applied to double values.
    • asin

      public static double asin(BigDecimal b0)
      SQL ASIN operator applied to BigDecimal values.
    • asin

      public static double asin(double b0)
      SQL ASIN operator applied to double values.
    • atan

      public static double atan(BigDecimal b0)
      SQL ATAN operator applied to BigDecimal values.
    • atan

      public static double atan(double b0)
      SQL ATAN operator applied to double values.
    • atan2

      public static double atan2(double b0, BigDecimal b1)
      SQL ATAN2 operator applied to double/BigDecimal values.
    • atan2

      public static double atan2(BigDecimal b0, double b1)
      SQL ATAN2 operator applied to BigDecimal/double values.
    • atan2

      public static double atan2(BigDecimal b0, BigDecimal b1)
      SQL ATAN2 operator applied to BigDecimal values.
    • atan2

      public static double atan2(double b0, double b1)
      SQL ATAN2 operator applied to double values.
    • cbrt

      public static double cbrt(BigDecimal b)
      SQL CBRT operator applied to BigDecimal values.
    • cbrt

      public static double cbrt(double b)
      SQL CBRT operator applied to double values.
    • cos

      public static double cos(BigDecimal b0)
      SQL COS operator applied to BigDecimal values.
    • cos

      public static double cos(double b0)
      SQL COS operator applied to double values.
    • cosh

      public static double cosh(BigDecimal b)
      SQL COSH operator applied to BigDecimal values.
    • cosh

      public static double cosh(double b)
      SQL COSH operator applied to double values.
    • cot

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

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

      public static double degrees(BigDecimal b0)
      SQL DEGREES operator applied to BigDecimal values.
    • degrees

      public static double degrees(double b0)
      SQL DEGREES operator applied to double values.
    • radians

      public static double radians(BigDecimal b0)
      SQL RADIANS operator applied to BigDecimal values.
    • radians

      public static double radians(double b0)
      SQL RADIANS operator applied to double 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 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.
    • 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 BigDecimal struncate(BigDecimal b0)
      SQL TRUNCATE operator applied to BigDecimal values.
    • struncate

      public static BigDecimal struncate(BigDecimal 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)
    • sign

      public static int sign(int b0)
      SQL SIGN operator applied to int values.
    • sign

      public static long sign(long b0)
      SQL SIGN operator applied to long values.
    • sign

      public static BigDecimal sign(BigDecimal b0)
      SQL SIGN operator applied to BigDecimal values.
    • sign

      public static double sign(double b0)
      SQL SIGN operator applied to double values.
    • sin

      public static double sin(BigDecimal b0)
      SQL SIN operator applied to BigDecimal values.
    • sin

      public static double sin(double b0)
      SQL SIN operator applied to double values.
    • sinh

      public static double sinh(BigDecimal b)
      SQL SINH operator applied to BigDecimal values.
    • sinh

      public static double sinh(double b)
      SQL SINH operator applied to double values.
    • tan

      public static double tan(BigDecimal b0)
      SQL TAN operator applied to BigDecimal values.
    • tan

      public static double tan(double b0)
      SQL TAN operator applied to double values.
    • tanh

      public static double tanh(BigDecimal b)
      SQL TANH operator applied to BigDecimal values.
    • tanh

      public static double tanh(double b)
      SQL TANH operator applied to double values.
    • lesser

      public static <T extends Comparable<T>> T lesser(T b0, T b1)
      Helper for implementing MIN. Somewhat similar to LEAST operator.
    • least

      public static <T extends Comparable<T>> T least(T b0, T b1)
      LEAST operator.
    • greater

      public static boolean greater(boolean b0, boolean b1)
    • lesser

      public static boolean lesser(boolean b0, boolean b1)
    • greater

      public static byte greater(byte b0, byte b1)
    • lesser

      public static byte lesser(byte b0, byte b1)
    • greater

      public static char greater(char b0, char b1)
    • lesser

      public static char lesser(char b0, char b1)
    • greater

      public static short greater(short b0, short b1)
    • lesser

      public static short lesser(short b0, short b1)
    • greater

      public static int greater(int b0, int b1)
    • lesser

      public static int lesser(int b0, int b1)
    • greater

      public static long greater(long b0, long b1)
    • lesser

      public static long lesser(long b0, long b1)
    • greater

      public static float greater(float b0, float b1)
    • lesser

      public static float lesser(float b0, float b1)
    • greater

      public static double greater(double b0, double b1)
    • lesser

      public static double lesser(double b0, double b1)
    • greater

      public static <T extends Comparable<T>> T greater(T b0, T b1)
      Helper for implementing MAX. Somewhat similar to GREATEST operator.
    • greatest

      public static <T extends Comparable<T>> T greatest(T b0, T b1)
      GREATEST operator.
    • toString

      public static String toString(float x)
      CAST(FLOAT AS VARCHAR).
    • toString

      public static String toString(double x)
      CAST(DOUBLE AS VARCHAR).
    • toString

      public static String toString(BigDecimal x)
      CAST(DECIMAL AS VARCHAR).
    • toString

      public static String toString(boolean x)
      CAST(BOOLEAN AS VARCHAR).
    • toBoolean

      public static boolean toBoolean(String s)
      CAST(VARCHAR AS BOOLEAN).
    • toBoolean

      public static boolean toBoolean(Number number)
    • toBoolean

      public static boolean toBoolean(Object o)
    • toByte

      public static byte toByte(Object o)
    • toByte

      public static byte toByte(Number number)
    • toChar

      public static char toChar(String s)
    • toCharBoxed

      public static Character toCharBoxed(String s)
    • toShort

      public static short toShort(String s)
    • toShort

      public static short toShort(Number number)
    • toShort

      public static short toShort(Object o)
    • toInt

      public static int toInt(Date v)
      Converts a SQL DATE value from the Java type (Date) to the internal representation type (number of days since January 1st, 1970 as int) in the local time zone.

      Since a time zone is not available, the date is converted to represent the same date as a Unix date in UTC as the Date value in the local time zone.

      See Also:
    • toInt

      public static int toInt(Date v, TimeZone timeZone)
      Converts a SQL DATE value from the Java type (Date) to the internal representation type (number of days since January 1st, 1970 as int).

      The Date class uses the standard Gregorian calendar which switches from the Julian calendar to the Gregorian calendar in October 1582. For compatibility with ISO-8601, the internal representation is converted to use the proleptic Gregorian calendar.

      If the date contains a partial day, it will be rounded to a full day depending on the milliseconds value. If the milliseconds value is positive, it will be rounded down to the closest full day. If the milliseconds value is negative, it will be rounded up to the closest full day.

    • toIntOptional

      public static @PolyNull Integer toIntOptional(@PolyNull Date v)
      Converts a nullable SQL DATE value from the Java type (Date) to the internal representation type (number of days since January 1st, 1970 as Integer) in the local time zone.

      Since a time zone is not available, the date is converted to represent the same date as a Unix date in UTC as the Date value in the local time zone.

      See Also:
    • toIntOptional

      public static @PolyNull Integer toIntOptional(@PolyNull Date v, TimeZone timeZone)
      Converts a nullable SQL DATE value from the Java type (Date) to the internal representation type (number of days since January 1st, 1970 as Integer).
      See Also:
    • toInt

      public static int toInt(Time v)
      Converts a SQL TIME value from the Java type (Time) to the internal representation type (number of milliseconds since January 1st, 1970 as int) in the local time zone.
      See Also:
    • toIntOptional

      public static @PolyNull Integer toIntOptional(@PolyNull Time v)
      Converts a nullable SQL TIME value from the Java type (Time) to the internal representation type (number of milliseconds since January 1st, 1970 as Integer).
      See Also:
    • toInt

      public static int toInt(String s)
    • toInt

      public static int toInt(Number number)
    • toInt

      public static int toInt(Object o)
    • toIntOptional

      public static @PolyNull Integer toIntOptional(@PolyNull Object o)
    • toLong

      public static long toLong(Date v)
      Converts a SQL TIMESTAMP value from the Java type (Date) to the internal representation type (number of milliseconds since January 1st, 1970 as long).

      Since a time zone is not available, converts the timestamp to represent the same date and time as a Unix timestamp in UTC as the Date value in the local time zone.

      The Date class uses the standard Gregorian calendar which switches from the Julian calendar to the Gregorian calendar in October 1582. For compatibility with ISO-8601, converts the internal representation to use the proleptic Gregorian calendar.

    • toLong

      public static long toLong(Timestamp v)
      Converts a SQL TIMESTAMP value from the Java type (Timestamp) to the internal representation type (number of milliseconds since January 1st, 1970 as long).

      Since a time zone is not available, converts the timestamp to represent the same date and time as a Unix timestamp in UTC as the Timestamp value in the local time zone.

      See Also:
    • toLong

      public static long toLong(Timestamp v, TimeZone timeZone)
      Converts a SQL TIMESTAMP value from the Java type (Timestamp) to the internal representation type (number of milliseconds since January 1st, 1970 as long).

      For backwards compatibility, time zone offsets are calculated in relation to the local time zone instead of UTC. Providing the default time zone or null will return the timestamp unmodified.

      The Timestamp class uses the standard Gregorian calendar which switches from the Julian calendar to the Gregorian calendar in October 1582. For compatibility with ISO-8601, the internal representation is converted to use the proleptic Gregorian calendar.

    • toLongOptional

      public static @PolyNull Long toLongOptional(@PolyNull Timestamp v)
      Converts a nullable SQL TIMESTAMP value from the Java type (Timestamp) to the internal representation type (number of milliseconds since January 1st, 1970 as Long) in the local time zone.
      See Also:
    • toLongOptional

      public static @PolyNull Long toLongOptional(@PolyNull Timestamp v, TimeZone timeZone)
      Converts a nullable SQL TIMESTAMP value from the Java type (Timestamp) to the internal representation type (number of milliseconds since January 1st, 1970 as Long).
      See Also:
    • toLong

      public static long toLong(String s)
    • toLong

      public static long toLong(Number number)
    • toLong

      public static long toLong(Object o)
    • toLongOptional

      public static @PolyNull Long toLongOptional(@PolyNull Object o)
    • toFloat

      public static float toFloat(String s)
    • toFloat

      public static float toFloat(Number number)
    • toFloat

      public static float toFloat(Object o)
    • toDouble

      public static double toDouble(String s)
    • toDouble

      public static double toDouble(Number number)
    • toDouble

      public static double toDouble(Object o)
    • toBigDecimal

      public static BigDecimal toBigDecimal(String s)
    • toBigDecimal

      public static BigDecimal toBigDecimal(Number number)
    • toBigDecimal

      public static BigDecimal toBigDecimal(Object o)
    • internalToDate

      public static Date internalToDate(int v)
      Converts a SQL DATE value from the internal representation type (number of days since January 1st, 1970) to the Java type (Date).

      Since a time zone is not available, converts the date to represent the same date as a Date in the local time zone as the Unix date in UTC.

      The Unix date should be the number of days since January 1st, 1970 using the proleptic Gregorian calendar as defined by ISO-8601. The returned Date object will use the standard Gregorian calendar which switches from the Julian calendar to the Gregorian calendar in October 1582.

      See Also:
    • internalToDate

      public static @PolyNull Date internalToDate(@PolyNull Integer v)
      Converts a nullable SQL DATE value from the internal representation type (number of days since January 1st, 1970) to the Java type (Date).
      See Also:
    • internalToTime

      public static Time internalToTime(int v)
      Converts a SQL TIME value from the internal representation type (number of milliseconds since January 1st, 1970) to the Java type (Time).
      See Also:
    • internalToTime

      public static @PolyNull Time internalToTime(@PolyNull Integer v)
      Converts a nullable SQL TIME value from the internal representation type (number of milliseconds since January 1st, 1970) to the Java type (Time).
      See Also:
    • toTimeWithLocalTimeZone

      public static @PolyNull Integer toTimeWithLocalTimeZone(@PolyNull String v)
    • toTimeWithLocalTimeZone

      public static @PolyNull Integer toTimeWithLocalTimeZone(@PolyNull String v, TimeZone timeZone)
    • timeWithLocalTimeZoneToTime

      public static int timeWithLocalTimeZoneToTime(int v, TimeZone timeZone)
    • timeWithLocalTimeZoneToTimestamp

      public static long timeWithLocalTimeZoneToTimestamp(String date, int v, TimeZone timeZone)
    • timeWithLocalTimeZoneToTimestampWithLocalTimeZone

      public static long timeWithLocalTimeZoneToTimestampWithLocalTimeZone(String date, int v)
    • timeWithLocalTimeZoneToString

      public static String timeWithLocalTimeZoneToString(int v, TimeZone timeZone)
    • formatTimestamp

      public static String formatTimestamp(DataContext ctx, String fmtString, long timestamp)
    • formatDate

      public static String formatDate(DataContext ctx, String fmtString, int date)
    • formatTime

      public static String formatTime(DataContext ctx, String fmtString, int time)
    • internalToTimestamp

      public static Timestamp internalToTimestamp(long v)
      Converts a SQL TIMESTAMP value from the internal representation type (number of milliseconds since January 1st, 1970) to the Java Type (Timestamp) in the local time zone.

      Since a time zone is not available, the timestamp is converted to represent the same timestamp as a Timestamp in the local time zone as the Unix timestamp in UTC.

      The Unix timestamp should be the number of milliseconds since January 1st, 1970 using the proleptic Gregorian calendar as defined by ISO-8601. The returned Timestamp object will use the standard Gregorian calendar which switches from the Julian calendar to the Gregorian calendar in October 1582.

      See Also:
    • internalToTimestamp

      public static @PolyNull Timestamp internalToTimestamp(@PolyNull Long v)
      Converts a nullable SQL TIMESTAMP value from the internal representation type (number of milliseconds since January 1st, 1970) to the Java Type (Timestamp) in the local time zone.
      See Also:
    • timestampWithLocalTimeZoneToDate

      public static int timestampWithLocalTimeZoneToDate(long v, TimeZone timeZone)
    • timestampWithLocalTimeZoneToTime

      public static int timestampWithLocalTimeZoneToTime(long v, TimeZone timeZone)
    • timestampWithLocalTimeZoneToTimestamp

      public static long timestampWithLocalTimeZoneToTimestamp(long v, TimeZone timeZone)
    • timestampWithLocalTimeZoneToString

      public static String timestampWithLocalTimeZoneToString(long v, TimeZone timeZone)
    • timestampWithLocalTimeZoneToTimeWithLocalTimeZone

      public static int timestampWithLocalTimeZoneToTimeWithLocalTimeZone(long v)
    • timestampSeconds

      public static long timestampSeconds(long v)
    • timestampMillis

      public static long timestampMillis(long v)
    • timestampMicros

      public static long timestampMicros(long v)
    • unixSeconds

      public static long unixSeconds(long v)
    • unixMillis

      public static long unixMillis(long v)
    • unixMicros

      public static long unixMicros(long v)
    • dateFromUnixDate

      public static int dateFromUnixDate(int v)
    • unixDate

      public static int unixDate(int v)
    • date

      public static int date(int year, int month, int day)
      SQL DATE(year, month, day) function.
    • date

      public static int date(long timestampMillis)
      SQL DATE(TIMESTAMP) and DATE(TIMESTAMP WITH LOCAL TIME ZONE) functions.
    • date

      public static int date(long timestampMillis, String timeZone)
      SQL DATE(TIMESTAMP WITH LOCAL TIME, timeZone) function.
    • datetime

      public static long datetime(int year, int month, int day, int hour, int minute, int second)
      SQL DATETIME(<year>, <month>, <day>, <hour>, <minute>, <second>) function.
    • datetime

      public static long datetime(int daysSinceEpoch)
      SQL DATETIME(DATE) function; returns a Calcite TIMESTAMP.
    • datetime

      public static long datetime(int daysSinceEpoch, int millisSinceMidnight)
      SQL DATETIME(DATE, TIME) function; returns a Calcite TIMESTAMP.
    • datetime

      public static long datetime(long millisSinceEpoch)
      SQL DATETIME(TIMESTAMP WITH LOCAL TIME ZONE) function; returns a Calcite TIMESTAMP.
    • datetime

      public static long datetime(long millisSinceEpoch, String timeZone)
      SQL DATETIME(TIMESTAMP, timeZone) function; returns a Calcite TIMESTAMP.
    • timestamp

      public static long timestamp(String expression)
      SQL TIMESTAMP(<string>) function.
    • timestamp

      public static long timestamp(String expression, String timeZone)
      SQL TIMESTAMP(<string>, <timeZone>) function.
    • timestamp

      public static long timestamp(int days)
      SQL TIMESTAMP(<date>) function.
    • timestamp

      public static long timestamp(int days, String timeZone)
      SQL TIMESTAMP(<date>, <timeZone>) function.
    • timestamp

      public static long timestamp(long millisSinceEpoch)
      SQL TIMESTAMP(<timestamp>) function; returns a TIMESTAMP WITH LOCAL TIME ZONE.
    • timestamp

      public static long timestamp(long millisSinceEpoch, String timeZone)
      SQL TIMESTAMP(<timestamp>, <timeZone>) function; returns a TIMESTAMP WITH LOCAL TIME ZONE.
    • time

      public static int time(int hour, int minute, int second)
      SQL TIME(<hour>, <minute>, <second>) function.
    • time

      public static int time(long timestampMillis)
      SQL TIME(<timestamp>) and TIME(<timestampLtz>) functions.
    • time

      public static int time(long timestampMillis, String timeZone)
      SQL TIME(<timestampLtz>, <timeZone>) function.
    • toTimestampWithLocalTimeZone

      public static @PolyNull Long toTimestampWithLocalTimeZone(@PolyNull String v)
    • toTimestampWithLocalTimeZone

      public static @PolyNull Long toTimestampWithLocalTimeZone(@PolyNull String v, TimeZone timeZone)
    • truncate

      public static @PolyNull String truncate(@PolyNull String s, int maxLength)
      Helper for CAST(... AS VARCHAR(maxLength)).
    • truncateOrPad

      public static @PolyNull String truncateOrPad(@PolyNull String s, int maxLength)
      Helper for CAST(... AS CHAR(maxLength)).
    • truncate

      public static @PolyNull org.apache.calcite.avatica.util.ByteString truncate(@PolyNull org.apache.calcite.avatica.util.ByteString s, int maxLength)
      Helper for CAST(... AS VARBINARY(maxLength)).
    • truncateOrPad

      public static @PolyNull org.apache.calcite.avatica.util.ByteString truncateOrPad(@PolyNull org.apache.calcite.avatica.util.ByteString s, int maxLength)
      Helper for CAST(... AS BINARY(maxLength)).
    • position

      public static int position(String seek, String s)
      SQL POSITION(seek IN string) function.
    • position

      public static int position(org.apache.calcite.avatica.util.ByteString seek, org.apache.calcite.avatica.util.ByteString s)
      SQL POSITION(seek IN string) function for byte strings.
    • position

      public static int position(String seek, String s, int from)
      SQL POSITION(seek IN string FROM integer) function.
    • position

      public static int position(org.apache.calcite.avatica.util.ByteString seek, org.apache.calcite.avatica.util.ByteString s, int from)
      SQL POSITION(seek IN string FROM integer) function for byte strings.
    • round

      public static long round(long v, long x)
      Helper for rounding. Truncate(12345, 1000) returns 12000.
    • truncate

      public static long truncate(long v, long x)
      Helper for rounding. Truncate(12345, 1000) returns 12000.
    • round

      public static int round(int v, int x)
      Helper for rounding. Truncate(12345, 1000) returns 12000.
    • truncate

      public static int truncate(int v, int x)
      Helper for rounding. Truncate(12345, 1000) returns 12000.
    • dayNameWithTimestamp

      public static String dayNameWithTimestamp(long timestamp, Locale locale)
      SQL DAYNAME function, applied to a TIMESTAMP argument.
      Parameters:
      timestamp - Milliseconds from epoch
      locale - Locale
      Returns:
      Name of the weekday in the given locale
    • dayNameWithDate

      public static String dayNameWithDate(int date, Locale locale)
      SQL DAYNAME function, applied to a DATE argument.
      Parameters:
      date - Days since epoch
      locale - Locale
      Returns:
      Name of the weekday in the given locale
    • monthNameWithTimestamp

      public static String monthNameWithTimestamp(long timestamp, Locale locale)
      SQL MONTHNAME function, applied to a TIMESTAMP argument.
      Parameters:
      timestamp - Milliseconds from epoch
      locale - Locale
      Returns:
      Name of the month in the given locale
    • monthNameWithDate

      public static String monthNameWithDate(int date, Locale locale)
      SQL MONTHNAME function, applied to a DATE argument.
      Parameters:
      date - Days from epoch
      locale - Locale
      Returns:
      Name of the month in the given locale
    • timestampToDate

      public static int timestampToDate(long timestamp)
      Converts a timestamp (milliseconds since epoch) to a date (days since epoch).
    • timestampToTime

      public static int timestampToTime(long timestamp)
      Converts a timestamp (milliseconds since epoch) to a time (milliseconds since midnight).
    • currentTimestamp

      public static long currentTimestamp(DataContext root)
      SQL CURRENT_TIMESTAMP function.
    • currentTime

      public static int currentTime(DataContext root)
      SQL CURRENT_TIME function.
    • currentDate

      public static int currentDate(DataContext root)
      SQL CURRENT_DATE function.
    • localTimestamp

      public static long localTimestamp(DataContext root)
      SQL LOCAL_TIMESTAMP function.
    • localTime

      public static int localTime(DataContext root)
      SQL LOCAL_TIME function.
    • timeZone

      public static TimeZone timeZone(DataContext root)
    • user

      public static String user(DataContext root)
      SQL USER function.
    • systemUser

      public static String systemUser(DataContext root)
      SQL SYSTEM_USER function.
    • locale

      public static Locale locale(DataContext root)
    • customDateAdd

      public static int customDateAdd(DataContext root, String timeFrameName, int interval, int date)
      SQL DATEADD function applied to a custom time frame.

      Custom time frames are created as part of a TimeFrameSet. This method retrieves the session's time frame set from the DataContext.Variable.TIME_FRAME_SET variable, then looks up the time frame by name.

    • customTimestampAdd

      public static long customTimestampAdd(DataContext root, String timeFrameName, long interval, long timestamp)
      SQL TIMESTAMPADD function applied to a custom time frame.

      Custom time frames are created and accessed as described in customDateAdd(org.apache.calcite.DataContext, java.lang.String, int, int).

    • customDateDiff

      public static int customDateDiff(DataContext root, String timeFrameName, int date, int date2)
      SQL DATEDIFF function applied to a custom time frame.

      Custom time frames are created and accessed as described in customDateAdd(org.apache.calcite.DataContext, java.lang.String, int, int).

    • customTimestampDiff

      public static long customTimestampDiff(DataContext root, String timeFrameName, long timestamp, long timestamp2)
      SQL TIMESTAMPDIFF function applied to a custom time frame.

      Custom time frames are created and accessed as described in customDateAdd(org.apache.calcite.DataContext, java.lang.String, int, int).

    • customDateFloor

      public static int customDateFloor(DataContext root, String timeFrameName, int date)
      SQL FLOOR function applied to a DATE value and a custom time frame.

      Custom time frames are created and accessed as described in customDateAdd(org.apache.calcite.DataContext, java.lang.String, int, int).

    • customDateCeil

      public static int customDateCeil(DataContext root, String timeFrameName, int date)
      SQL CEIL function applied to a DATE value and a custom time frame.

      Custom time frames are created and accessed as described in customDateAdd(org.apache.calcite.DataContext, java.lang.String, int, int).

    • customTimestampFloor

      public static long customTimestampFloor(DataContext root, String timeFrameName, long timestamp)
      SQL FLOOR function applied to a TIMESTAMP value and a custom time frame.

      Custom time frames are created and accessed as described in customDateAdd(org.apache.calcite.DataContext, java.lang.String, int, int).

    • customTimestampCeil

      public static long customTimestampCeil(DataContext root, String timeFrameName, long timestamp)
      SQL CEIL function applied to a TIMESTAMP value and a custom time frame.

      Custom time frames are created and accessed as described in customDateAdd(org.apache.calcite.DataContext, java.lang.String, int, int).

    • translate3

      public static String translate3(String s, String search, String replacement)
      SQL TRANSLATE(string, search_chars, replacement_chars) function.
    • replace

      public static String replace(String s, String search, String replacement)
      SQL REPLACE(string, search, replacement) function.
    • arrayItem

      public static @Nullable Object arrayItem(List list, int item)
      Helper for "array element reference". Caller has already ensured that array and index are not null. Index is 1-based, per SQL.
    • mapItem

      public static @Nullable Object mapItem(Map map, Object item)
      Helper for "map element reference". Caller has already ensured that array and index are not null. Index is 1-based, per SQL.
    • item

      public static @Nullable Object item(Object object, Object index)
      Implements the [ ... ] operator on an object whose type is not known until runtime.
    • arrayItemOptional

      public static @Nullable Object arrayItemOptional(@Nullable List list, int item)
      As arrayItem(java.util.List, int) method, but allows array to be nullable.
    • mapItemOptional

      public static @Nullable Object mapItemOptional(@Nullable Map map, Object item)
      As mapItem(java.util.Map, java.lang.Object) method, but allows map to be nullable.
    • itemOptional

      public static @Nullable Object itemOptional(@Nullable Object object, Object index)
      As item(java.lang.Object, java.lang.Object) method, but allows object to be nullable.
    • isTrue

      public static boolean isTrue(@Nullable Boolean b)
      NULL → FALSE, FALSE → FALSE, TRUE → TRUE.
    • isFalse

      public static boolean isFalse(@Nullable Boolean b)
      NULL → FALSE, FALSE → TRUE, TRUE → FALSE.
    • isNotTrue

      public static boolean isNotTrue(@Nullable Boolean b)
      NULL → TRUE, FALSE → TRUE, TRUE → FALSE.
    • isNotFalse

      public static boolean isNotFalse(@Nullable Boolean b)
      NULL → TRUE, FALSE → FALSE, TRUE → TRUE.
    • not

      public static @PolyNull Boolean not(@PolyNull Boolean b)
      NULL → NULL, FALSE → TRUE, TRUE → FALSE.
    • arrayToList

      public static @PolyNull List arrayToList(@PolyNull Array a)
      Converts a JDBC array to a list.
    • sequenceCurrentValue

      public static long sequenceCurrentValue(String key)
      Support the CURRENT VALUE OF sequence operator.
    • sequenceNextValue

      public static long sequenceNextValue(String key)
      Support the NEXT VALUE OF sequence operator.
    • slice

      public static List slice(List list)
      Support the SLICE function.
    • element

      public static @Nullable Object element(List list)
      Support the ELEMENT function.
    • memberOf

      public static boolean memberOf(@Nullable Object object, Collection collection)
      Support the MEMBER OF function.
    • multisetIntersectDistinct

      public static <E> Collection<E> multisetIntersectDistinct(Collection<E> c1, Collection<E> c2)
      Support the MULTISET INTERSECT DISTINCT function.
    • multisetIntersectAll

      public static <E> Collection<E> multisetIntersectAll(Collection<E> c1, Collection<E> c2)
      Support the MULTISET INTERSECT ALL function.
    • multisetExceptAll

      public static <E> Collection<E> multisetExceptAll(Collection<E> c1, Collection<E> c2)
      Support the MULTISET EXCEPT ALL function.
    • multisetExceptDistinct

      public static <E> Collection<E> multisetExceptDistinct(Collection<E> c1, Collection<E> c2)
      Support the MULTISET EXCEPT DISTINCT function.
    • isASet

      public static boolean isASet(Collection collection)
      Support the IS A SET function.
    • submultisetOf

      public static boolean submultisetOf(Collection possibleSubMultiset, Collection multiset)
      Support the SUBMULTISET OF function.
    • multisetUnionDistinct

      public static Collection multisetUnionDistinct(Collection collection1, Collection collection2)
      Support the MULTISET UNION function.
    • multisetUnionAll

      public static Collection multisetUnionAll(Collection collection1, Collection collection2)
      Support the MULTISET UNION ALL function.
    • reverse

      public static List reverse(List list)
      Support the ARRAY_REVERSE function.
    • flatList

      public static Function1<List<Object>,Enumerable<Object>> flatList()
      Function that, given a certain List containing single-item structs (i.e. arrays / lists with a single item), builds an Enumerable that returns those single items inside the structs.
    • flatProduct

      public static Function1<Object,Enumerable<FlatLists.ComparableList<Comparable>>> flatProduct(int[] fieldCounts, boolean withOrdinality, SqlFunctions.FlatProductInputType[] inputTypes)
    • array

      public static Object[] array(Object... args)
    • product

      public static <E extends Comparable> Enumerable<FlatLists.ComparableList<E>> product(List<Enumerator<List<E>>> enumerators, int fieldCount, boolean withOrdinality)
      Similar to Linq4j.product(Iterable) but each resulting list implements FlatLists.ComparableList.
    • structAccess

      public static @Nullable Object structAccess(@Nullable Object structObject, int index, @Nullable String fieldName)
      Implements the . (field access) operator on an object whose type is not known until runtime.

      A struct object can be represented in various ways by the runtime and depends on the JavaRowFormat.