Class SqlFunctions
- java.lang.Object
-
- org.apache.calcite.runtime.SqlFunctions
-
public class SqlFunctions extends java.lang.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 class
SqlFunctions.FlatProductInputType
Type of argument passed intoflatProduct(int[], boolean, org.apache.calcite.runtime.SqlFunctions.FlatProductInputType[])
.static class
SqlFunctions.PathContext
Returned path context of JsonApiCommonSyntax, public for testing.static class
SqlFunctions.PathMode
Path spec has two different modes: lax mode and strict mode.private static class
SqlFunctions.ProductComparableListEnumerator<E extends java.lang.Comparable>
Enumerates over the cartesian product of the given lists, returning a comparable list for each row.
-
Field Summary
Fields Modifier and Type Field Description private static Function1<java.lang.Object[],Enumerable<java.lang.Object[]>>
ARRAY_CARTESIAN_PRODUCT
private static java.text.DecimalFormat
DOUBLE_FORMAT
private static java.util.regex.Pattern
JSON_PATH_BASE
private static com.jayway.jsonpath.spi.json.JsonProvider
JSON_PATH_JSON_PROVIDER
private static com.jayway.jsonpath.spi.mapper.MappingProvider
JSON_PATH_MAPPING_PROVIDER
private static Function1<java.util.List<java.lang.Object>,Enumerable<java.lang.Object>>
LIST_AS_ENUMERABLE
private static java.util.TimeZone
LOCAL_TZ
private static java.lang.ThreadLocal<java.util.Map<java.lang.String,java.util.concurrent.atomic.AtomicLong>>
THREAD_SEQUENCES
Holds, for each thread, a map from sequence name to sequence current value.
-
Constructor Summary
Constructors Modifier Constructor Description private
SqlFunctions()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static byte
abs(byte b0)
SQLABS
operator applied to byte values.static double
abs(double b0)
SQLABS
operator applied to double values.static float
abs(float b0)
SQLABS
operator applied to float values.static int
abs(int b0)
SQLABS
operator applied to int values.static long
abs(long b0)
SQLABS
operator applied to long values.static short
abs(short b0)
SQLABS
operator applied to short values.static java.math.BigDecimal
abs(java.math.BigDecimal b0)
SQLABS
operator applied to BigDecimal values.static double
acos(double b0)
SQLACOS
operator applied to double values.static double
acos(java.math.BigDecimal b0)
SQLACOS
operator applied to BigDecimal values.static int
addMonths(int date, int m)
Adds a given number of months to a date, represented as the number of days since the epoch.static long
addMonths(long timestamp, int m)
Adds a given number of months to a timestamp, represented as the number of milliseconds since the epoch.private static boolean
allAssignable(java.lang.Class clazz, java.lang.Object o0, java.lang.Object o1)
Returns whether two objects can both be assigned to a given class.static java.lang.Object[]
array(java.lang.Object... args)
static java.lang.Object
arrayItem(java.util.List list, int item)
Helper for "array element reference".static java.lang.Object
arrayItemOptional(java.util.List list, int item)
AsarrayItem(java.util.List, int)
method, but allows array to be nullable.static java.util.List
arrayToList(java.sql.Array a)
Converts a JDBC array to a list.static double
asin(double b0)
SQLASIN
operator applied to double values.static double
asin(java.math.BigDecimal b0)
SQLASIN
operator applied to BigDecimal values.static double
atan(double b0)
SQLATAN
operator applied to double values.static double
atan(java.math.BigDecimal b0)
SQLATAN
operator applied to BigDecimal values.static double
atan2(double b0, double b1)
SQLATAN2
operator applied to double values.static double
atan2(double b0, java.math.BigDecimal b1)
SQLATAN2
operator applied to double/BigDecimal values.static double
atan2(java.math.BigDecimal b0, double b1)
SQLATAN2
operator applied to BigDecimal/double values.static double
atan2(java.math.BigDecimal b0, java.math.BigDecimal b1)
SQLATAN2
operator applied to BigDecimal values.private static java.lang.Object
cannotConvert(java.lang.Object o, java.lang.Class toType)
static byte
ceil(byte b0, byte b1)
SQLCEIL
operator applied to byte values.static double
ceil(double b0)
static float
ceil(float b0)
static int
ceil(int b0, int b1)
SQLCEIL
operator applied to int values.static int
ceil(int b0, java.math.BigDecimal b1)
static long
ceil(long b0, long b1)
SQLCEIL
operator applied to long values.static short
ceil(short b0, short b1)
SQLCEIL
operator applied to short values.static java.math.BigDecimal
ceil(java.math.BigDecimal b0)
static java.math.BigDecimal
ceil(java.math.BigDecimal b0, int b1)
static java.math.BigDecimal
ceil(java.math.BigDecimal b0, java.math.BigDecimal b1)
static int
charLength(java.lang.String s)
SQL CHARACTER_LENGTH(string) function.static int
compare(boolean x, boolean y)
Boolean comparison.static java.lang.String
concat(java.lang.String s0, java.lang.String s1)
SQLstring || string
operator.static org.apache.calcite.avatica.util.ByteString
concat(org.apache.calcite.avatica.util.ByteString s0, org.apache.calcite.avatica.util.ByteString s1)
SQLbinary || binary
operator.static double
cos(double b0)
SQLCOS
operator applied to double values.static double
cos(java.math.BigDecimal b0)
SQLCOS
operator applied to BigDecimal values.static double
cot(double b0)
SQLCOT
operator applied to double values.static double
cot(java.math.BigDecimal b0)
SQLCOT
operator applied to BigDecimal values.static int
currentDate(DataContext root)
SQLCURRENT_DATE
function.static int
currentTime(DataContext root)
SQLCURRENT_TIME
function.static long
currentTimestamp(DataContext root)
SQLCURRENT_TIMESTAMP
function.static double
degrees(double b0)
SQLDEGREES
operator applied to double values.static double
degrees(java.math.BigDecimal b0)
SQLDEGREES
operator applied to BigDecimal values.static java.lang.Object
dejsonize(java.lang.String input)
static int
divide(int b0, int b1)
SQL/
operator applied to int values.static java.lang.Integer
divide(int b0, java.lang.Integer b1)
SQL/
operator applied to int values; right side may be null.static int
divide(int b0, java.math.BigDecimal b1)
static long
divide(long b0, java.math.BigDecimal b1)
static java.lang.Integer
divide(java.lang.Integer b0, int b1)
SQL/
operator applied to int values; left side may be null.static java.lang.Integer
divide(java.lang.Integer b0, java.lang.Integer b1)
SQL/
operator applied to nullable int values.static java.lang.Long
divide(java.lang.Integer b0, java.lang.Long b1)
SQL/
operator applied to nullable int and long values.static java.lang.Long
divide(java.lang.Long b0, java.lang.Integer b1)
SQL/
operator applied to nullable long and int values.static java.math.BigDecimal
divide(java.math.BigDecimal b0, java.math.BigDecimal b1)
SQL/
operator applied to BigDecimal values.static java.lang.Object
divideAny(java.lang.Object b0, java.lang.Object b1)
SQL/
operator applied to Object values (at least one operand has ANY type; either may be null).static java.lang.Object
element(java.util.List list)
Support the ELEMENT function.static boolean
eq(java.lang.Object b0, java.lang.Object b1)
SQL=
operator applied to Object values (including String; neither side may be null).static boolean
eq(java.math.BigDecimal b0, java.math.BigDecimal b1)
SQL=
operator applied to BigDecimal values (neither may be null).static boolean
eqAny(java.lang.Object b0, java.lang.Object b1)
SQL=
operator applied to Object values (at least one operand has ANY type; neither may be null).static double
exp(double b0)
SQLEXP
operator applied to double values.static double
exp(java.math.BigDecimal b0)
static Function1<java.lang.Object,Enumerable<FlatLists.ComparableList<java.lang.Comparable>>>
flatProduct(int[] fieldCounts, boolean withOrdinality, SqlFunctions.FlatProductInputType[] inputTypes)
static byte
floor(byte b0, byte b1)
SQLFLOOR
operator applied to byte values.static double
floor(double b0)
static float
floor(float b0)
static int
floor(int b0, int b1)
SQLFLOOR
operator applied to int values.static int
floor(int b0, java.math.BigDecimal b1)
static long
floor(long b0, long b1)
SQLFLOOR
operator applied to long values.static short
floor(short b0, short b1)
SQLFLOOR
operator applied to short values.static java.math.BigDecimal
floor(java.math.BigDecimal b0)
static java.math.BigDecimal
floor(java.math.BigDecimal b0, int b1)
static java.math.BigDecimal
floor(java.math.BigDecimal b0, java.math.BigDecimal b1)
static boolean
ge(boolean b0, boolean b1)
SQL≥
operator applied to boolean values.static boolean
ge(java.lang.String b0, java.lang.String b1)
SQL≥
operator applied to String values.static boolean
ge(java.math.BigDecimal b0, java.math.BigDecimal b1)
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(java.lang.Object b0, java.lang.Object b1)
SQL≥
operator applied to Object values (at least one operand has ANY type; neither may be null).private static java.util.concurrent.atomic.AtomicLong
getAtomicLong(java.lang.String key)
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 java.lang.Comparable<T>>
Tgreater(T b0, T b1)
Helper for implementing MAX.static <T extends java.lang.Comparable<T>>
Tgreatest(T b0, T b1)
GREATEST operator.static boolean
gt(boolean b0, boolean b1)
SQL>
operator applied to boolean values.static boolean
gt(java.lang.String b0, java.lang.String b1)
SQL>
operator applied to String values.static boolean
gt(java.math.BigDecimal b0, java.math.BigDecimal b1)
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(java.lang.Object b0, java.lang.Object b1)
SQL>
operator applied to Object values (at least one operand has ANY type; neither may be null).static java.lang.String
initcap(java.lang.String s)
SQL INITCAP(string) function.static java.sql.Date
internalToDate(int v)
Converts the internal representation of a SQL DATE (int) to the Java type used for UDF parameters (Date
).static java.sql.Date
internalToDate(java.lang.Integer v)
AsinternalToDate(int)
but allows nulls.static java.sql.Time
internalToTime(int v)
Converts the internal representation of a SQL TIME (int) to the Java type used for UDF parameters (Time
).static java.sql.Time
internalToTime(java.lang.Integer v)
static java.sql.Timestamp
internalToTimestamp(long v)
Converts the internal representation of a SQL TIMESTAMP (long) to the Java type used for UDF parameters (Timestamp
).static java.sql.Timestamp
internalToTimestamp(java.lang.Long v)
static boolean
isASet(java.util.Collection collection)
Support the IS A SET function.static boolean
isFalse(java.lang.Boolean b)
NULL → FALSE, FALSE → TRUE, TRUE → FALSE.static boolean
isJsonArray(java.lang.String input)
static boolean
isJsonObject(java.lang.String input)
static boolean
isJsonScalar(java.lang.String input)
static boolean
isJsonValue(java.lang.String input)
static boolean
isNotFalse(java.lang.Boolean b)
NULL → TRUE, FALSE → FALSE, TRUE → TRUE.static boolean
isNotTrue(java.lang.Boolean b)
NULL → TRUE, FALSE → TRUE, TRUE → FALSE.private static boolean
isScalarObject(java.lang.Object obj)
static boolean
isTrue(java.lang.Boolean b)
NULL → FALSE, FALSE → FALSE, TRUE → TRUE.static java.lang.Object
item(java.lang.Object object, java.lang.Object index)
Implements the[ ... ]
operator on an object whose type is not known until runtime.static java.lang.Object
itemOptional(java.lang.Object object, java.lang.Object index)
Asitem(java.lang.Object, java.lang.Object)
method, but allows object to be nullable.static SqlFunctions.PathContext
jsonApiCommonSyntax(java.lang.Object input, java.lang.String pathSpec)
static java.lang.String
jsonArray(SqlJsonConstructorNullClause nullClause, java.lang.Object... elements)
static void
jsonArrayAggAdd(java.util.List list, java.lang.Object element, SqlJsonConstructorNullClause nullClause)
static java.lang.Boolean
jsonExists(java.lang.Object input)
static java.lang.Boolean
jsonExists(java.lang.Object input, SqlJsonExistsErrorBehavior errorBehavior)
static java.lang.String
jsonize(java.lang.Object input)
static java.lang.String
jsonObject(SqlJsonConstructorNullClause nullClause, java.lang.Object... kvs)
static void
jsonObjectAggAdd(java.util.Map map, java.lang.String k, java.lang.Object v, SqlJsonConstructorNullClause nullClause)
static java.lang.String
jsonQuery(java.lang.Object input, SqlJsonQueryWrapperBehavior wrapperBehavior, SqlJsonQueryEmptyOrErrorBehavior emptyBehavior, SqlJsonQueryEmptyOrErrorBehavior errorBehavior)
static java.lang.Object
jsonStructuredValueExpression(java.lang.Object input)
static java.lang.Object
jsonValueAny(java.lang.Object input, SqlJsonValueEmptyOrErrorBehavior emptyBehavior, java.lang.Object defaultValueOnEmpty, SqlJsonValueEmptyOrErrorBehavior errorBehavior, java.lang.Object defaultValueOnError)
static java.lang.Object
jsonValueExpression(java.lang.String input)
private static int
lastDay(int y, int m)
static boolean
le(boolean b0, boolean b1)
SQL≤
operator applied to boolean values.static boolean
le(java.lang.String b0, java.lang.String b1)
SQL≤
operator applied to String values.static boolean
le(java.math.BigDecimal b0, java.math.BigDecimal b1)
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(java.lang.Object b0, java.lang.Object b1)
SQL≤
operator applied to Object values (at least one operand has ANY type; neither may be null).static <T extends java.lang.Comparable<T>>
Tleast(T b0, T b1)
LEAST operator.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 java.lang.Comparable<T>>
Tlesser(T b0, T b1)
Helper for implementing MIN.static boolean
like(java.lang.String s, java.lang.String pattern)
SQLLIKE
function.static boolean
like(java.lang.String s, java.lang.String pattern, java.lang.String escape)
SQLLIKE
function with escape.static double
ln(double d)
SQLLN(number)
function applied to double values.static double
ln(java.math.BigDecimal d)
SQLLN(number)
function applied to BigDecimal values.static int
localTime(DataContext root)
SQLLOCAL_TIME
function.static long
localTimestamp(DataContext root)
SQLLOCAL_TIMESTAMP
function.static double
log10(double b0)
SQLLOG10(numeric)
operator applied to double values.static double
log10(java.math.BigDecimal d)
SQLLOG10(number)
function applied to BigDecimal values.static java.lang.String
lower(java.lang.String s)
SQL LOWER(string) function.static boolean
lt(boolean b0, boolean b1)
SQL<
operator applied to boolean values.static boolean
lt(java.lang.String b0, java.lang.String b1)
SQL<
operator applied to String values.static boolean
lt(java.math.BigDecimal b0, java.math.BigDecimal b1)
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(java.lang.Object b0, java.lang.Object b1)
SQL<
operator applied to Object values.static java.lang.String
ltrim(java.lang.String s)
SQLLTRIM
function.static java.lang.Object
mapItem(java.util.Map map, java.lang.Object item)
Helper for "map element reference".static java.lang.Object
mapItemOptional(java.util.Map map, java.lang.Object item)
AsmapItem(java.util.Map, java.lang.Object)
method, but allows map to be nullable.static boolean
memberOf(java.lang.Object object, java.util.Collection collection)
Support the MEMBER OF function.static int
minus(int b0, int b1)
SQL-
operator applied to int values.static java.lang.Integer
minus(int b0, java.lang.Integer b1)
SQL-
operator applied to int values; right side may be null.static java.lang.Integer
minus(java.lang.Integer b0, int b1)
SQL-
operator applied to int values; left side may be null.static java.lang.Integer
minus(java.lang.Integer b0, java.lang.Integer b1)
SQL-
operator applied to nullable int values.static java.lang.Long
minus(java.lang.Integer b0, java.lang.Long b1)
SQL-
operator applied to nullable int and long values.static java.lang.Long
minus(java.lang.Long b0, java.lang.Integer b1)
SQL-
operator applied to nullable long and int values.static java.math.BigDecimal
minus(java.math.BigDecimal b0, java.math.BigDecimal b1)
SQL-
operator applied to BigDecimal values.static java.lang.Object
minusAny(java.lang.Object b0, java.lang.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)
SQLMOD
operator applied to byte values.static int
mod(int b0, int b1)
SQLMOD
operator applied to int values.static int
mod(int b0, java.math.BigDecimal b1)
static long
mod(long b0, long b1)
SQLMOD
operator applied to long values.static short
mod(short b0, short b1)
SQLMOD
operator applied to short values.static java.math.BigDecimal
mod(java.math.BigDecimal b0, int b1)
static java.math.BigDecimal
mod(java.math.BigDecimal b0, java.math.BigDecimal b1)
static int
multiply(int b0, int b1)
SQL*
operator applied to int values.static java.lang.Integer
multiply(int b0, java.lang.Integer b1)
SQL*
operator applied to int values; right side may be null.static java.lang.Integer
multiply(java.lang.Integer b0, int b1)
SQL*
operator applied to int values; left side may be null.static java.lang.Integer
multiply(java.lang.Integer b0, java.lang.Integer b1)
SQL*
operator applied to nullable int values.static java.lang.Long
multiply(java.lang.Integer b0, java.lang.Long b1)
SQL*
operator applied to nullable int and long values.static java.lang.Long
multiply(java.lang.Long b0, java.lang.Integer b1)
SQL*
operator applied to nullable long and int values.static java.math.BigDecimal
multiply(java.math.BigDecimal b0, java.math.BigDecimal b1)
SQL*
operator applied to BigDecimal values.static java.lang.Object
multiplyAny(java.lang.Object b0, java.lang.Object b1)
SQL*
operator applied to Object values (at least one operand has ANY type; either may be null).static <E> java.util.Collection<E>
multisetExceptAll(java.util.Collection<E> c1, java.util.Collection<E> c2)
Support the MULTISET EXCEPT ALL function.static <E> java.util.Collection<E>
multisetExceptDistinct(java.util.Collection<E> c1, java.util.Collection<E> c2)
Support the MULTISET EXCEPT DISTINCT function.static <E> java.util.Collection<E>
multisetIntersectAll(java.util.Collection<E> c1, java.util.Collection<E> c2)
Support the MULTISET INTERSECT ALL function.static <E> java.util.Collection<E>
multisetIntersectDistinct(java.util.Collection<E> c1, java.util.Collection<E> c2)
Support the MULTISET INTERSECT DISTINCT function.static java.util.Collection
multisetUnionAll(java.util.Collection collection1, java.util.Collection collection2)
Support the MULTISET UNION ALL function.static java.util.Collection
multisetUnionDistinct(java.util.Collection collection1, java.util.Collection collection2)
Support the MULTISET UNION function.static boolean
ne(java.lang.Object b0, java.lang.Object b1)
SQL<gt;
operator applied to Object values (including String; neither side may be null).static boolean
ne(java.math.BigDecimal b0, java.math.BigDecimal b1)
SQL<gt;
operator applied to BigDecimal values.static boolean
neAny(java.lang.Object b0, java.lang.Object b1)
SQL<gt;
operator applied to Object values (at least one operand has ANY type, including String; neither may be null).static java.lang.Boolean
not(java.lang.Boolean b)
NULL → NULL, FALSE → TRUE, TRUE → FALSE.private static java.lang.RuntimeException
notArithmetic(java.lang.String op, java.lang.Object b0, java.lang.Object b1)
private static java.lang.RuntimeException
notComparable(java.lang.String op, java.lang.Object b0, java.lang.Object b1)
static java.lang.String
overlay(java.lang.String s, java.lang.String r, int start)
SQLOVERLAY
function.static java.lang.String
overlay(java.lang.String s, java.lang.String r, int start, int length)
SQLOVERLAY
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)
SQLOVERLAY
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)
SQLOVERLAY
function applied to binary strings.private static Enumerable<FlatLists.ComparableList<java.lang.Comparable>>
p2(java.lang.Object[] lists, int[] fieldCounts, boolean withOrdinality, SqlFunctions.FlatProductInputType[] inputTypes)
static int
plus(int b0, int b1)
SQL+
operator applied to int values.static java.lang.Integer
plus(int b0, java.lang.Integer b1)
SQL+
operator applied to int values; right side may be null.static java.lang.Integer
plus(java.lang.Integer b0, int b1)
SQL+
operator applied to int values; left side may be null.static java.lang.Integer
plus(java.lang.Integer b0, java.lang.Integer b1)
SQL+
operator applied to nullable int values.static java.lang.Long
plus(java.lang.Integer b0, java.lang.Long b1)
SQL+
operator applied to nullable int and long values.static java.lang.Long
plus(java.lang.Long b0, java.lang.Integer b1)
SQL+
operator applied to nullable long and int values.static java.math.BigDecimal
plus(java.math.BigDecimal b0, java.math.BigDecimal b1)
SQL+
operator applied to BigDecimal values.static java.lang.Object
plusAny(java.lang.Object b0, java.lang.Object b1)
SQL+
operator applied to Object values (at least one operand has ANY type; either may be null).static int
position(java.lang.String seek, java.lang.String s)
SQLPOSITION(seek IN string)
function.static int
position(java.lang.String seek, java.lang.String s, int from)
SQLPOSITION(seek IN string FROM integer)
function.static int
position(org.apache.calcite.avatica.util.ByteString seek, org.apache.calcite.avatica.util.ByteString s)
SQLPOSITION(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)
SQLPOSITION(seek IN string FROM integer)
function for byte strings.static double
power(double b0, double b1)
SQLPOWER
operator applied to double values.static double
power(double b0, java.math.BigDecimal b1)
static double
power(java.math.BigDecimal b0, double b1)
static double
power(java.math.BigDecimal b0, java.math.BigDecimal b1)
static <E extends java.lang.Comparable>
Enumerable<FlatLists.ComparableList<E>>product(java.util.List<Enumerator<java.util.List<E>>> enumerators, int fieldCount, boolean withOrdinality)
Similar toLinq4j.product(Iterable)
but each resulting list implementsFlatLists.ComparableList
.static double
radians(double b0)
SQLRADIANS
operator applied to double values.static double
radians(java.math.BigDecimal b0)
SQLRADIANS
operator applied to BigDecimal values.static java.lang.String
replace(java.lang.String s, java.lang.String search, java.lang.String replacement)
SQLREPLACE(string, search, replacement)
function.static int
round(int v, int x)
Helper for rounding.static long
round(long v, long x)
Helper for rounding.static java.lang.String
rtrim(java.lang.String s)
SQLRTRIM
function applied to string.static org.apache.calcite.avatica.util.ByteString
rtrim(org.apache.calcite.avatica.util.ByteString s)
Helper for CAST.static long
sequenceCurrentValue(java.lang.String key)
Support theCURRENT VALUE OF sequence
operator.static long
sequenceNextValue(java.lang.String key)
Support theNEXT VALUE OF sequence
operator.static double
sign(double b0)
SQLSIGN
operator applied to double values.static int
sign(int b0)
SQLSIGN
operator applied to int values.static long
sign(long b0)
SQLSIGN
operator applied to long values.static java.math.BigDecimal
sign(java.math.BigDecimal b0)
SQLSIGN
operator applied to BigDecimal values.static boolean
similar(java.lang.String s, java.lang.String pattern)
SQLSIMILAR
function.static boolean
similar(java.lang.String s, java.lang.String pattern, java.lang.String escape)
SQLSIMILAR
function with escape.static double
sin(double b0)
SQLSIN
operator applied to double values.static double
sin(java.math.BigDecimal b0)
SQLSIN
operator applied to BigDecimal values.static java.util.List
slice(java.util.List list)
Support the SLICE function.static double
sround(double b0)
SQLROUND
operator applied to double values.static double
sround(double b0, int b1)
SQLROUND
operator applied to double values.static int
sround(int b0)
SQLROUND
operator applied to int values.static int
sround(int b0, int b1)
SQLROUND
operator applied to int values.static long
sround(long b0)
SQLROUND
operator applied to long values.static long
sround(long b0, int b1)
SQLROUND
operator applied to long values.static java.math.BigDecimal
sround(java.math.BigDecimal b0)
SQLROUND
operator applied to BigDecimal values.static java.math.BigDecimal
sround(java.math.BigDecimal b0, int b1)
SQLROUND
operator applied to BigDecimal values.static java.lang.Object
structAccess(java.lang.Object structObject, int index, java.lang.String fieldName)
Implements the.
(field access) operator on an object whose type is not known until runtime.static double
struncate(double b0)
SQLTRUNCATE
operator applied to double values.static double
struncate(double b0, int b1)
static int
struncate(int b0)
SQLTRUNCATE
operator applied to int values.static int
struncate(int b0, int b1)
static long
struncate(long b0)
SQLTRUNCATE
operator applied to long values.static long
struncate(long b0, int b1)
static java.math.BigDecimal
struncate(java.math.BigDecimal b0)
SQLTRUNCATE
operator applied to BigDecimal values.static java.math.BigDecimal
struncate(java.math.BigDecimal b0, int b1)
static boolean
submultisetOf(java.util.Collection possibleSubMultiset, java.util.Collection multiset)
Support the SUBMULTISET OF function.static java.lang.String
substring(java.lang.String c, int s)
SQL SUBSTRING(string FROM ...) function.static java.lang.String
substring(java.lang.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.static org.apache.calcite.avatica.util.ByteString
substring(org.apache.calcite.avatica.util.ByteString c, int s, int l)
SQL SUBSTRING(binary FROM ...static int
subtractMonths(int date0, int date1)
Finds the number of months between two dates, each represented as the number of days since the epoch.static int
subtractMonths(long t0, long t1)
static double
tan(double b0)
SQLTAN
operator applied to double values.static double
tan(java.math.BigDecimal b0)
SQLTAN
operator applied to BigDecimal values.static int
timestampWithLocalTimeZoneToDate(long v, java.util.TimeZone timeZone)
static java.lang.String
timestampWithLocalTimeZoneToString(long v, java.util.TimeZone timeZone)
static int
timestampWithLocalTimeZoneToTime(long v, java.util.TimeZone timeZone)
static long
timestampWithLocalTimeZoneToTimestamp(long v, java.util.TimeZone timeZone)
static int
timestampWithLocalTimeZoneToTimeWithLocalTimeZone(long v)
static java.lang.String
timeWithLocalTimeZoneToString(int v, java.util.TimeZone timeZone)
static int
timeWithLocalTimeZoneToTime(int v, java.util.TimeZone timeZone)
static long
timeWithLocalTimeZoneToTimestamp(java.lang.String date, int v, java.util.TimeZone timeZone)
static long
timeWithLocalTimeZoneToTimestampWithLocalTimeZone(java.lang.String date, int v)
static java.util.TimeZone
timeZone(DataContext root)
static java.math.BigDecimal
toBigDecimal(java.lang.Number number)
static java.math.BigDecimal
toBigDecimal(java.lang.Object o)
static java.math.BigDecimal
toBigDecimal(java.lang.String s)
static boolean
toBoolean(java.lang.Number number)
static boolean
toBoolean(java.lang.Object o)
static boolean
toBoolean(java.lang.String s)
CAST(VARCHAR AS BOOLEAN).static byte
toByte(java.lang.Number number)
static byte
toByte(java.lang.Object o)
static char
toChar(java.lang.String s)
static java.lang.Character
toCharBoxed(java.lang.String s)
static double
toDouble(java.lang.Number number)
static double
toDouble(java.lang.Object o)
static double
toDouble(java.lang.String s)
static float
toFloat(java.lang.Number number)
static float
toFloat(java.lang.Object o)
static float
toFloat(java.lang.String s)
static int
toInt(java.lang.Number number)
static int
toInt(java.lang.Object o)
static int
toInt(java.lang.String s)
static int
toInt(java.sql.Time v)
Converts the Java type used for UDF parameters of SQL TIME type (Time
) to internal representation (int).static int
toInt(java.util.Date v)
Converts the Java type used for UDF parameters of SQL DATE type (Date
) to internal representation (int).static int
toInt(java.util.Date v, java.util.TimeZone timeZone)
static java.lang.Integer
toIntOptional(java.sql.Time v)
static java.lang.Integer
toIntOptional(java.util.Date v)
static java.lang.Integer
toIntOptional(java.util.Date v, java.util.TimeZone timeZone)
static long
toLong(java.lang.Number number)
static long
toLong(java.lang.Object o)
static long
toLong(java.lang.String s)
static long
toLong(java.sql.Timestamp v)
Converts the Java type used for UDF parameters of SQL TIMESTAMP type (Timestamp
) to internal representation (long).static long
toLong(java.util.Date v)
static long
toLong(java.util.Date v, java.util.TimeZone timeZone)
static java.lang.Long
toLongOptional(java.sql.Timestamp v, java.util.TimeZone timeZone)
static java.lang.Long
toLongOptional(java.util.Date v)
static short
toShort(java.lang.Number number)
static short
toShort(java.lang.Object o)
static short
toShort(java.lang.String s)
static java.lang.String
toString(boolean x)
CAST(BOOLEAN AS VARCHAR).static java.lang.String
toString(double x)
CAST(DOUBLE AS VARCHAR).static java.lang.String
toString(float x)
CAST(FLOAT AS VARCHAR).static java.lang.String
toString(java.math.BigDecimal x)
CAST(DECIMAL AS VARCHAR).static java.lang.Long
toTimestampWithLocalTimeZone(java.lang.String v)
static java.lang.Long
toTimestampWithLocalTimeZone(java.lang.String v, java.util.TimeZone timeZone)
static java.lang.Integer
toTimeWithLocalTimeZone(java.lang.String v)
static java.lang.Integer
toTimeWithLocalTimeZone(java.lang.String v, java.util.TimeZone timeZone)
private static java.lang.RuntimeException
toUnchecked(java.lang.Exception e)
static java.lang.String
translate3(java.lang.String s, java.lang.String search, java.lang.String replacement)
SQLTRANSLATE(string, search_chars, replacement_chars)
function.static java.lang.String
trim(boolean left, boolean right, java.lang.String seek, java.lang.String s)
SQLTRIM(... seek FROM s)
function.static java.lang.String
trim(boolean left, boolean right, java.lang.String seek, java.lang.String s, boolean strict)
static org.apache.calcite.avatica.util.ByteString
trim(org.apache.calcite.avatica.util.ByteString s)
SQLTRIM
function applied to binary string.private static org.apache.calcite.avatica.util.ByteString
trim_(org.apache.calcite.avatica.util.ByteString s, boolean left, boolean right)
SQLTRIM
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 java.lang.String
truncate(java.lang.String s, int maxLength)
Helper for CAST(...static org.apache.calcite.avatica.util.ByteString
truncate(org.apache.calcite.avatica.util.ByteString s, int maxLength)
Helper for CAST(...static java.lang.String
truncateOrPad(java.lang.String s, int maxLength)
Helper for CAST(...static org.apache.calcite.avatica.util.ByteString
truncateOrPad(org.apache.calcite.avatica.util.ByteString s, int maxLength)
Helper for CAST(...static java.lang.String
upper(java.lang.String s)
SQL UPPER(string) function.
-
-
-
Field Detail
-
DOUBLE_FORMAT
private static final java.text.DecimalFormat DOUBLE_FORMAT
-
LOCAL_TZ
private static final java.util.TimeZone LOCAL_TZ
-
LIST_AS_ENUMERABLE
private static final Function1<java.util.List<java.lang.Object>,Enumerable<java.lang.Object>> LIST_AS_ENUMERABLE
-
ARRAY_CARTESIAN_PRODUCT
private static final Function1<java.lang.Object[],Enumerable<java.lang.Object[]>> ARRAY_CARTESIAN_PRODUCT
-
THREAD_SEQUENCES
private static final java.lang.ThreadLocal<java.util.Map<java.lang.String,java.util.concurrent.atomic.AtomicLong>> THREAD_SEQUENCES
Holds, for each thread, a map from sequence name to sequence current value.This is a straw man of an implementation whose main goal is to prove that sequences can be parsed, validated and planned. A real application will want persistent values for sequences, shared among threads.
-
JSON_PATH_BASE
private static final java.util.regex.Pattern JSON_PATH_BASE
-
JSON_PATH_JSON_PROVIDER
private static final com.jayway.jsonpath.spi.json.JsonProvider JSON_PATH_JSON_PROVIDER
-
JSON_PATH_MAPPING_PROVIDER
private static final com.jayway.jsonpath.spi.mapper.MappingProvider JSON_PATH_MAPPING_PROVIDER
-
-
Method Detail
-
substring
public static java.lang.String substring(java.lang.String c, int s, int l)
SQL SUBSTRING(string FROM ... FOR ...) function.
-
substring
public static java.lang.String substring(java.lang.String c, int s)
SQL SUBSTRING(string FROM ...) function.
-
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.
-
substring
public static org.apache.calcite.avatica.util.ByteString substring(org.apache.calcite.avatica.util.ByteString c, int s)
SQL SUBSTRING(binary FROM ...) function.
-
upper
public static java.lang.String upper(java.lang.String s)
SQL UPPER(string) function.
-
lower
public static java.lang.String lower(java.lang.String s)
SQL LOWER(string) function.
-
initcap
public static java.lang.String initcap(java.lang.String s)
SQL INITCAP(string) function.
-
charLength
public static int charLength(java.lang.String s)
SQL CHARACTER_LENGTH(string) function.
-
concat
public static java.lang.String concat(java.lang.String s0, java.lang.String s1)
SQLstring || 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)
SQLbinary || binary
operator.
-
rtrim
public static java.lang.String rtrim(java.lang.String s)
SQLRTRIM
function applied to string.
-
ltrim
public static java.lang.String ltrim(java.lang.String s)
SQLLTRIM
function.
-
trim
public static java.lang.String trim(boolean left, boolean right, java.lang.String seek, java.lang.String s)
SQLTRIM(... seek FROM s)
function.
-
trim
public static java.lang.String trim(boolean left, boolean right, java.lang.String seek, java.lang.String s, boolean strict)
-
trim
public static org.apache.calcite.avatica.util.ByteString trim(org.apache.calcite.avatica.util.ByteString s)
SQLTRIM
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.
-
trim_
private static org.apache.calcite.avatica.util.ByteString trim_(org.apache.calcite.avatica.util.ByteString s, boolean left, boolean right)
SQLTRIM
function applied to binary string.
-
overlay
public static java.lang.String overlay(java.lang.String s, java.lang.String r, int start)
SQLOVERLAY
function.
-
overlay
public static java.lang.String overlay(java.lang.String s, java.lang.String r, int start, int length)
SQLOVERLAY
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)
SQLOVERLAY
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)
SQLOVERLAY
function applied to binary strings.
-
like
public static boolean like(java.lang.String s, java.lang.String pattern)
SQLLIKE
function.
-
like
public static boolean like(java.lang.String s, java.lang.String pattern, java.lang.String escape)
SQLLIKE
function with escape.
-
similar
public static boolean similar(java.lang.String s, java.lang.String pattern)
SQLSIMILAR
function.
-
similar
public static boolean similar(java.lang.String s, java.lang.String pattern, java.lang.String escape)
SQLSIMILAR
function with escape.
-
eq
public static boolean eq(java.math.BigDecimal b0, java.math.BigDecimal b1)
SQL=
operator applied to BigDecimal values (neither may be null).
-
eq
public static boolean eq(java.lang.Object b0, java.lang.Object b1)
SQL=
operator applied to Object values (including String; neither side may be null).
-
eqAny
public static boolean eqAny(java.lang.Object b0, java.lang.Object b1)
SQL=
operator applied to Object values (at least one operand has ANY type; neither may be null).
-
allAssignable
private static boolean allAssignable(java.lang.Class clazz, java.lang.Object o0, java.lang.Object o1)
Returns whether two objects can both be assigned to a given class.
-
ne
public static boolean ne(java.math.BigDecimal b0, java.math.BigDecimal b1)
SQL<gt;
operator applied to BigDecimal values.
-
ne
public static boolean ne(java.lang.Object b0, java.lang.Object b1)
SQL<gt;
operator applied to Object values (including String; neither side may be null).
-
neAny
public static boolean neAny(java.lang.Object b0, java.lang.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(java.lang.String b0, java.lang.String b1)
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(java.math.BigDecimal b0, java.math.BigDecimal b1)
SQL<
operator applied to BigDecimal values.
-
ltAny
public static boolean ltAny(java.lang.Object b0, java.lang.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(java.lang.String b0, java.lang.String b1)
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(java.math.BigDecimal b0, java.math.BigDecimal b1)
SQL≤
operator applied to BigDecimal values.
-
leAny
public static boolean leAny(java.lang.Object b0, java.lang.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(java.lang.String b0, java.lang.String b1)
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(java.math.BigDecimal b0, java.math.BigDecimal b1)
SQL>
operator applied to BigDecimal values.
-
gtAny
public static boolean gtAny(java.lang.Object b0, java.lang.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(java.lang.String b0, java.lang.String b1)
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(java.math.BigDecimal b0, java.math.BigDecimal b1)
SQL≥
operator applied to BigDecimal values.
-
geAny
public static boolean geAny(java.lang.Object b0, java.lang.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 java.lang.Integer plus(java.lang.Integer b0, int b1)
SQL+
operator applied to int values; left side may be null.
-
plus
public static java.lang.Integer plus(int b0, java.lang.Integer b1)
SQL+
operator applied to int values; right side may be null.
-
plus
public static java.lang.Integer plus(java.lang.Integer b0, java.lang.Integer b1)
SQL+
operator applied to nullable int values.
-
plus
public static java.lang.Long plus(java.lang.Long b0, java.lang.Integer b1)
SQL+
operator applied to nullable long and int values.
-
plus
public static java.lang.Long plus(java.lang.Integer b0, java.lang.Long b1)
SQL+
operator applied to nullable int and long values.
-
plus
public static java.math.BigDecimal plus(java.math.BigDecimal b0, java.math.BigDecimal b1)
SQL+
operator applied to BigDecimal values.
-
plusAny
public static java.lang.Object plusAny(java.lang.Object b0, java.lang.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 java.lang.Integer minus(java.lang.Integer b0, int b1)
SQL-
operator applied to int values; left side may be null.
-
minus
public static java.lang.Integer minus(int b0, java.lang.Integer b1)
SQL-
operator applied to int values; right side may be null.
-
minus
public static java.lang.Integer minus(java.lang.Integer b0, java.lang.Integer b1)
SQL-
operator applied to nullable int values.
-
minus
public static java.lang.Long minus(java.lang.Long b0, java.lang.Integer b1)
SQL-
operator applied to nullable long and int values.
-
minus
public static java.lang.Long minus(java.lang.Integer b0, java.lang.Long b1)
SQL-
operator applied to nullable int and long values.
-
minus
public static java.math.BigDecimal minus(java.math.BigDecimal b0, java.math.BigDecimal b1)
SQL-
operator applied to BigDecimal values.
-
minusAny
public static java.lang.Object minusAny(java.lang.Object b0, java.lang.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 java.lang.Integer divide(java.lang.Integer b0, int b1)
SQL/
operator applied to int values; left side may be null.
-
divide
public static java.lang.Integer divide(int b0, java.lang.Integer b1)
SQL/
operator applied to int values; right side may be null.
-
divide
public static java.lang.Integer divide(java.lang.Integer b0, java.lang.Integer b1)
SQL/
operator applied to nullable int values.
-
divide
public static java.lang.Long divide(java.lang.Long b0, java.lang.Integer b1)
SQL/
operator applied to nullable long and int values.
-
divide
public static java.lang.Long divide(java.lang.Integer b0, java.lang.Long b1)
SQL/
operator applied to nullable int and long values.
-
divide
public static java.math.BigDecimal divide(java.math.BigDecimal b0, java.math.BigDecimal b1)
SQL/
operator applied to BigDecimal values.
-
divideAny
public static java.lang.Object divideAny(java.lang.Object b0, java.lang.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, java.math.BigDecimal b1)
-
divide
public static long divide(long b0, java.math.BigDecimal b1)
-
multiply
public static int multiply(int b0, int b1)
SQL*
operator applied to int values.
-
multiply
public static java.lang.Integer multiply(java.lang.Integer b0, int b1)
SQL*
operator applied to int values; left side may be null.
-
multiply
public static java.lang.Integer multiply(int b0, java.lang.Integer b1)
SQL*
operator applied to int values; right side may be null.
-
multiply
public static java.lang.Integer multiply(java.lang.Integer b0, java.lang.Integer b1)
SQL*
operator applied to nullable int values.
-
multiply
public static java.lang.Long multiply(java.lang.Long b0, java.lang.Integer b1)
SQL*
operator applied to nullable long and int values.
-
multiply
public static java.lang.Long multiply(java.lang.Integer b0, java.lang.Long b1)
SQL*
operator applied to nullable int and long values.
-
multiply
public static java.math.BigDecimal multiply(java.math.BigDecimal b0, java.math.BigDecimal b1)
SQL*
operator applied to BigDecimal values.
-
multiplyAny
public static java.lang.Object multiplyAny(java.lang.Object b0, java.lang.Object b1)
SQL*
operator applied to Object values (at least one operand has ANY type; either may be null).
-
notArithmetic
private static java.lang.RuntimeException notArithmetic(java.lang.String op, java.lang.Object b0, java.lang.Object b1)
-
notComparable
private static java.lang.RuntimeException notComparable(java.lang.String op, java.lang.Object b0, java.lang.Object b1)
-
exp
public static double exp(double b0)
SQLEXP
operator applied to double values.
-
exp
public static double exp(java.math.BigDecimal b0)
-
power
public static double power(double b0, double b1)
SQLPOWER
operator applied to double values.
-
power
public static double power(double b0, java.math.BigDecimal b1)
-
power
public static double power(java.math.BigDecimal b0, double b1)
-
power
public static double power(java.math.BigDecimal b0, java.math.BigDecimal b1)
-
ln
public static double ln(double d)
SQLLN(number)
function applied to double values.
-
ln
public static double ln(java.math.BigDecimal d)
SQLLN(number)
function applied to BigDecimal values.
-
log10
public static double log10(double b0)
SQLLOG10(numeric)
operator applied to double values.
-
log10
public static double log10(java.math.BigDecimal d)
SQLLOG10(number)
function applied to BigDecimal values.
-
mod
public static byte mod(byte b0, byte b1)
SQLMOD
operator applied to byte values.
-
mod
public static short mod(short b0, short b1)
SQLMOD
operator applied to short values.
-
mod
public static int mod(int b0, int b1)
SQLMOD
operator applied to int values.
-
mod
public static long mod(long b0, long b1)
SQLMOD
operator applied to long values.
-
mod
public static java.math.BigDecimal mod(java.math.BigDecimal b0, int b1)
-
mod
public static int mod(int b0, java.math.BigDecimal b1)
-
mod
public static java.math.BigDecimal mod(java.math.BigDecimal b0, java.math.BigDecimal b1)
-
floor
public static double floor(double b0)
-
floor
public static float floor(float b0)
-
floor
public static java.math.BigDecimal floor(java.math.BigDecimal b0)
-
floor
public static byte floor(byte b0, byte b1)
SQLFLOOR
operator applied to byte values.
-
floor
public static short floor(short b0, short b1)
SQLFLOOR
operator applied to short values.
-
floor
public static int floor(int b0, int b1)
SQLFLOOR
operator applied to int values.
-
floor
public static long floor(long b0, long b1)
SQLFLOOR
operator applied to long values.
-
floor
public static java.math.BigDecimal floor(java.math.BigDecimal b0, int b1)
-
floor
public static int floor(int b0, java.math.BigDecimal b1)
-
floor
public static java.math.BigDecimal floor(java.math.BigDecimal b0, java.math.BigDecimal b1)
-
ceil
public static double ceil(double b0)
-
ceil
public static float ceil(float b0)
-
ceil
public static java.math.BigDecimal ceil(java.math.BigDecimal b0)
-
ceil
public static byte ceil(byte b0, byte b1)
SQLCEIL
operator applied to byte values.
-
ceil
public static short ceil(short b0, short b1)
SQLCEIL
operator applied to short values.
-
ceil
public static int ceil(int b0, int b1)
SQLCEIL
operator applied to int values.
-
ceil
public static long ceil(long b0, long b1)
SQLCEIL
operator applied to long values.
-
ceil
public static java.math.BigDecimal ceil(java.math.BigDecimal b0, int b1)
-
ceil
public static int ceil(int b0, java.math.BigDecimal b1)
-
ceil
public static java.math.BigDecimal ceil(java.math.BigDecimal b0, java.math.BigDecimal b1)
-
abs
public static byte abs(byte b0)
SQLABS
operator applied to byte values.
-
abs
public static short abs(short b0)
SQLABS
operator applied to short values.
-
abs
public static int abs(int b0)
SQLABS
operator applied to int values.
-
abs
public static long abs(long b0)
SQLABS
operator applied to long values.
-
abs
public static float abs(float b0)
SQLABS
operator applied to float values.
-
abs
public static double abs(double b0)
SQLABS
operator applied to double values.
-
abs
public static java.math.BigDecimal abs(java.math.BigDecimal b0)
SQLABS
operator applied to BigDecimal values.
-
acos
public static double acos(java.math.BigDecimal b0)
SQLACOS
operator applied to BigDecimal values.
-
acos
public static double acos(double b0)
SQLACOS
operator applied to double values.
-
asin
public static double asin(java.math.BigDecimal b0)
SQLASIN
operator applied to BigDecimal values.
-
asin
public static double asin(double b0)
SQLASIN
operator applied to double values.
-
atan
public static double atan(java.math.BigDecimal b0)
SQLATAN
operator applied to BigDecimal values.
-
atan
public static double atan(double b0)
SQLATAN
operator applied to double values.
-
atan2
public static double atan2(double b0, java.math.BigDecimal b1)
SQLATAN2
operator applied to double/BigDecimal values.
-
atan2
public static double atan2(java.math.BigDecimal b0, double b1)
SQLATAN2
operator applied to BigDecimal/double values.
-
atan2
public static double atan2(java.math.BigDecimal b0, java.math.BigDecimal b1)
SQLATAN2
operator applied to BigDecimal values.
-
atan2
public static double atan2(double b0, double b1)
SQLATAN2
operator applied to double values.
-
cos
public static double cos(java.math.BigDecimal b0)
SQLCOS
operator applied to BigDecimal values.
-
cos
public static double cos(double b0)
SQLCOS
operator applied to double values.
-
cot
public static double cot(java.math.BigDecimal b0)
SQLCOT
operator applied to BigDecimal values.
-
cot
public static double cot(double b0)
SQLCOT
operator applied to double values.
-
degrees
public static double degrees(java.math.BigDecimal b0)
SQLDEGREES
operator applied to BigDecimal values.
-
degrees
public static double degrees(double b0)
SQLDEGREES
operator applied to double values.
-
radians
public static double radians(java.math.BigDecimal b0)
SQLRADIANS
operator applied to BigDecimal values.
-
radians
public static double radians(double b0)
SQLRADIANS
operator applied to double values.
-
sround
public static int sround(int b0)
SQLROUND
operator applied to int values.
-
sround
public static int sround(int b0, int b1)
SQLROUND
operator applied to int values.
-
sround
public static long sround(long b0)
SQLROUND
operator applied to long values.
-
sround
public static long sround(long b0, int b1)
SQLROUND
operator applied to long values.
-
sround
public static java.math.BigDecimal sround(java.math.BigDecimal b0)
SQLROUND
operator applied to BigDecimal values.
-
sround
public static java.math.BigDecimal sround(java.math.BigDecimal b0, int b1)
SQLROUND
operator applied to BigDecimal values.
-
sround
public static double sround(double b0)
SQLROUND
operator applied to double values.
-
sround
public static double sround(double b0, int b1)
SQLROUND
operator applied to double values.
-
struncate
public static int struncate(int b0)
SQLTRUNCATE
operator applied to int values.
-
struncate
public static int struncate(int b0, int b1)
-
struncate
public static long struncate(long b0)
SQLTRUNCATE
operator applied to long values.
-
struncate
public static long struncate(long b0, int b1)
-
struncate
public static java.math.BigDecimal struncate(java.math.BigDecimal b0)
SQLTRUNCATE
operator applied to BigDecimal values.
-
struncate
public static java.math.BigDecimal struncate(java.math.BigDecimal b0, int b1)
-
struncate
public static double struncate(double b0)
SQLTRUNCATE
operator applied to double values.
-
struncate
public static double struncate(double b0, int b1)
-
sign
public static int sign(int b0)
SQLSIGN
operator applied to int values.
-
sign
public static long sign(long b0)
SQLSIGN
operator applied to long values.
-
sign
public static java.math.BigDecimal sign(java.math.BigDecimal b0)
SQLSIGN
operator applied to BigDecimal values.
-
sign
public static double sign(double b0)
SQLSIGN
operator applied to double values.
-
sin
public static double sin(java.math.BigDecimal b0)
SQLSIN
operator applied to BigDecimal values.
-
sin
public static double sin(double b0)
SQLSIN
operator applied to double values.
-
tan
public static double tan(java.math.BigDecimal b0)
SQLTAN
operator applied to BigDecimal values.
-
tan
public static double tan(double b0)
SQLTAN
operator applied to double values.
-
lesser
public static <T extends java.lang.Comparable<T>> T lesser(T b0, T b1)
Helper for implementing MIN. Somewhat similar to LEAST operator.
-
least
public static <T extends java.lang.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 java.lang.Comparable<T>> T greater(T b0, T b1)
Helper for implementing MAX. Somewhat similar to GREATEST operator.
-
greatest
public static <T extends java.lang.Comparable<T>> T greatest(T b0, T b1)
GREATEST operator.
-
compare
public static int compare(boolean x, boolean y)
Boolean comparison.
-
toString
public static java.lang.String toString(float x)
CAST(FLOAT AS VARCHAR).
-
toString
public static java.lang.String toString(double x)
CAST(DOUBLE AS VARCHAR).
-
toString
public static java.lang.String toString(java.math.BigDecimal x)
CAST(DECIMAL AS VARCHAR).
-
toString
public static java.lang.String toString(boolean x)
CAST(BOOLEAN AS VARCHAR).
-
cannotConvert
private static java.lang.Object cannotConvert(java.lang.Object o, java.lang.Class toType)
-
toBoolean
public static boolean toBoolean(java.lang.String s)
CAST(VARCHAR AS BOOLEAN).
-
toBoolean
public static boolean toBoolean(java.lang.Number number)
-
toBoolean
public static boolean toBoolean(java.lang.Object o)
-
toByte
public static byte toByte(java.lang.Object o)
-
toByte
public static byte toByte(java.lang.Number number)
-
toChar
public static char toChar(java.lang.String s)
-
toCharBoxed
public static java.lang.Character toCharBoxed(java.lang.String s)
-
toShort
public static short toShort(java.lang.String s)
-
toShort
public static short toShort(java.lang.Number number)
-
toShort
public static short toShort(java.lang.Object o)
-
toInt
public static int toInt(java.util.Date v)
Converts the Java type used for UDF parameters of SQL DATE type (Date
) to internal representation (int).Converse of
internalToDate(int)
.
-
toInt
public static int toInt(java.util.Date v, java.util.TimeZone timeZone)
-
toIntOptional
public static java.lang.Integer toIntOptional(java.util.Date v)
-
toIntOptional
public static java.lang.Integer toIntOptional(java.util.Date v, java.util.TimeZone timeZone)
-
toLong
public static long toLong(java.util.Date v)
-
toInt
public static int toInt(java.sql.Time v)
Converts the Java type used for UDF parameters of SQL TIME type (Time
) to internal representation (int).Converse of
internalToTime(int)
.
-
toIntOptional
public static java.lang.Integer toIntOptional(java.sql.Time v)
-
toInt
public static int toInt(java.lang.String s)
-
toInt
public static int toInt(java.lang.Number number)
-
toInt
public static int toInt(java.lang.Object o)
-
toLong
public static long toLong(java.sql.Timestamp v)
Converts the Java type used for UDF parameters of SQL TIMESTAMP type (Timestamp
) to internal representation (long).Converse of
internalToTimestamp(long)
.
-
toLong
public static long toLong(java.util.Date v, java.util.TimeZone timeZone)
-
toLongOptional
public static java.lang.Long toLongOptional(java.util.Date v)
-
toLongOptional
public static java.lang.Long toLongOptional(java.sql.Timestamp v, java.util.TimeZone timeZone)
-
toLong
public static long toLong(java.lang.String s)
-
toLong
public static long toLong(java.lang.Number number)
-
toLong
public static long toLong(java.lang.Object o)
-
toFloat
public static float toFloat(java.lang.String s)
-
toFloat
public static float toFloat(java.lang.Number number)
-
toFloat
public static float toFloat(java.lang.Object o)
-
toDouble
public static double toDouble(java.lang.String s)
-
toDouble
public static double toDouble(java.lang.Number number)
-
toDouble
public static double toDouble(java.lang.Object o)
-
toBigDecimal
public static java.math.BigDecimal toBigDecimal(java.lang.String s)
-
toBigDecimal
public static java.math.BigDecimal toBigDecimal(java.lang.Number number)
-
toBigDecimal
public static java.math.BigDecimal toBigDecimal(java.lang.Object o)
-
internalToDate
public static java.sql.Date internalToDate(int v)
Converts the internal representation of a SQL DATE (int) to the Java type used for UDF parameters (Date
).
-
internalToDate
public static java.sql.Date internalToDate(java.lang.Integer v)
AsinternalToDate(int)
but allows nulls.
-
internalToTime
public static java.sql.Time internalToTime(int v)
Converts the internal representation of a SQL TIME (int) to the Java type used for UDF parameters (Time
).
-
internalToTime
public static java.sql.Time internalToTime(java.lang.Integer v)
-
toTimeWithLocalTimeZone
public static java.lang.Integer toTimeWithLocalTimeZone(java.lang.String v)
-
toTimeWithLocalTimeZone
public static java.lang.Integer toTimeWithLocalTimeZone(java.lang.String v, java.util.TimeZone timeZone)
-
timeWithLocalTimeZoneToTime
public static int timeWithLocalTimeZoneToTime(int v, java.util.TimeZone timeZone)
-
timeWithLocalTimeZoneToTimestamp
public static long timeWithLocalTimeZoneToTimestamp(java.lang.String date, int v, java.util.TimeZone timeZone)
-
timeWithLocalTimeZoneToTimestampWithLocalTimeZone
public static long timeWithLocalTimeZoneToTimestampWithLocalTimeZone(java.lang.String date, int v)
-
timeWithLocalTimeZoneToString
public static java.lang.String timeWithLocalTimeZoneToString(int v, java.util.TimeZone timeZone)
-
internalToTimestamp
public static java.sql.Timestamp internalToTimestamp(long v)
Converts the internal representation of a SQL TIMESTAMP (long) to the Java type used for UDF parameters (Timestamp
).
-
internalToTimestamp
public static java.sql.Timestamp internalToTimestamp(java.lang.Long v)
-
timestampWithLocalTimeZoneToDate
public static int timestampWithLocalTimeZoneToDate(long v, java.util.TimeZone timeZone)
-
timestampWithLocalTimeZoneToTime
public static int timestampWithLocalTimeZoneToTime(long v, java.util.TimeZone timeZone)
-
timestampWithLocalTimeZoneToTimestamp
public static long timestampWithLocalTimeZoneToTimestamp(long v, java.util.TimeZone timeZone)
-
timestampWithLocalTimeZoneToString
public static java.lang.String timestampWithLocalTimeZoneToString(long v, java.util.TimeZone timeZone)
-
timestampWithLocalTimeZoneToTimeWithLocalTimeZone
public static int timestampWithLocalTimeZoneToTimeWithLocalTimeZone(long v)
-
toTimestampWithLocalTimeZone
public static java.lang.Long toTimestampWithLocalTimeZone(java.lang.String v)
-
toTimestampWithLocalTimeZone
public static java.lang.Long toTimestampWithLocalTimeZone(java.lang.String v, java.util.TimeZone timeZone)
-
truncate
public static java.lang.String truncate(java.lang.String s, int maxLength)
Helper for CAST(... AS VARCHAR(maxLength)).
-
truncateOrPad
public static java.lang.String truncateOrPad(java.lang.String s, int maxLength)
Helper for CAST(... AS CHAR(maxLength)).
-
truncate
public static org.apache.calcite.avatica.util.ByteString truncate(org.apache.calcite.avatica.util.ByteString s, int maxLength)
Helper for CAST(... AS VARBINARY(maxLength)).
-
truncateOrPad
public static org.apache.calcite.avatica.util.ByteString truncateOrPad(org.apache.calcite.avatica.util.ByteString s, int maxLength)
Helper for CAST(... AS BINARY(maxLength)).
-
position
public static int position(java.lang.String seek, java.lang.String s)
SQLPOSITION(seek IN string)
function.
-
position
public static int position(org.apache.calcite.avatica.util.ByteString seek, org.apache.calcite.avatica.util.ByteString s)
SQLPOSITION(seek IN string)
function for byte strings.
-
position
public static int position(java.lang.String seek, java.lang.String s, int from)
SQLPOSITION(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)
SQLPOSITION(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.
-
currentTimestamp
public static long currentTimestamp(DataContext root)
SQLCURRENT_TIMESTAMP
function.
-
currentTime
public static int currentTime(DataContext root)
SQLCURRENT_TIME
function.
-
currentDate
public static int currentDate(DataContext root)
SQLCURRENT_DATE
function.
-
localTimestamp
public static long localTimestamp(DataContext root)
SQLLOCAL_TIMESTAMP
function.
-
localTime
public static int localTime(DataContext root)
SQLLOCAL_TIME
function.
-
timeZone
public static java.util.TimeZone timeZone(DataContext root)
-
translate3
public static java.lang.String translate3(java.lang.String s, java.lang.String search, java.lang.String replacement)
SQLTRANSLATE(string, search_chars, replacement_chars)
function.
-
replace
public static java.lang.String replace(java.lang.String s, java.lang.String search, java.lang.String replacement)
SQLREPLACE(string, search, replacement)
function.
-
arrayItem
public static java.lang.Object arrayItem(java.util.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 java.lang.Object mapItem(java.util.Map map, java.lang.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 java.lang.Object item(java.lang.Object object, java.lang.Object index)
Implements the[ ... ]
operator on an object whose type is not known until runtime.
-
arrayItemOptional
public static java.lang.Object arrayItemOptional(java.util.List list, int item)
AsarrayItem(java.util.List, int)
method, but allows array to be nullable.
-
mapItemOptional
public static java.lang.Object mapItemOptional(java.util.Map map, java.lang.Object item)
AsmapItem(java.util.Map, java.lang.Object)
method, but allows map to be nullable.
-
itemOptional
public static java.lang.Object itemOptional(java.lang.Object object, java.lang.Object index)
Asitem(java.lang.Object, java.lang.Object)
method, but allows object to be nullable.
-
isTrue
public static boolean isTrue(java.lang.Boolean b)
NULL → FALSE, FALSE → FALSE, TRUE → TRUE.
-
isFalse
public static boolean isFalse(java.lang.Boolean b)
NULL → FALSE, FALSE → TRUE, TRUE → FALSE.
-
isNotTrue
public static boolean isNotTrue(java.lang.Boolean b)
NULL → TRUE, FALSE → TRUE, TRUE → FALSE.
-
isNotFalse
public static boolean isNotFalse(java.lang.Boolean b)
NULL → TRUE, FALSE → FALSE, TRUE → TRUE.
-
not
public static java.lang.Boolean not(java.lang.Boolean b)
NULL → NULL, FALSE → TRUE, TRUE → FALSE.
-
arrayToList
public static java.util.List arrayToList(java.sql.Array a)
Converts a JDBC array to a list.
-
sequenceCurrentValue
public static long sequenceCurrentValue(java.lang.String key)
Support theCURRENT VALUE OF sequence
operator.
-
sequenceNextValue
public static long sequenceNextValue(java.lang.String key)
Support theNEXT VALUE OF sequence
operator.
-
getAtomicLong
private static java.util.concurrent.atomic.AtomicLong getAtomicLong(java.lang.String key)
-
slice
public static java.util.List slice(java.util.List list)
Support the SLICE function.
-
element
public static java.lang.Object element(java.util.List list)
Support the ELEMENT function.
-
memberOf
public static boolean memberOf(java.lang.Object object, java.util.Collection collection)
Support the MEMBER OF function.
-
multisetIntersectDistinct
public static <E> java.util.Collection<E> multisetIntersectDistinct(java.util.Collection<E> c1, java.util.Collection<E> c2)
Support the MULTISET INTERSECT DISTINCT function.
-
multisetIntersectAll
public static <E> java.util.Collection<E> multisetIntersectAll(java.util.Collection<E> c1, java.util.Collection<E> c2)
Support the MULTISET INTERSECT ALL function.
-
multisetExceptAll
public static <E> java.util.Collection<E> multisetExceptAll(java.util.Collection<E> c1, java.util.Collection<E> c2)
Support the MULTISET EXCEPT ALL function.
-
multisetExceptDistinct
public static <E> java.util.Collection<E> multisetExceptDistinct(java.util.Collection<E> c1, java.util.Collection<E> c2)
Support the MULTISET EXCEPT DISTINCT function.
-
isASet
public static boolean isASet(java.util.Collection collection)
Support the IS A SET function.
-
submultisetOf
public static boolean submultisetOf(java.util.Collection possibleSubMultiset, java.util.Collection multiset)
Support the SUBMULTISET OF function.
-
multisetUnionDistinct
public static java.util.Collection multisetUnionDistinct(java.util.Collection collection1, java.util.Collection collection2)
Support the MULTISET UNION function.
-
multisetUnionAll
public static java.util.Collection multisetUnionAll(java.util.Collection collection1, java.util.Collection collection2)
Support the MULTISET UNION ALL function.
-
flatProduct
public static Function1<java.lang.Object,Enumerable<FlatLists.ComparableList<java.lang.Comparable>>> flatProduct(int[] fieldCounts, boolean withOrdinality, SqlFunctions.FlatProductInputType[] inputTypes)
-
p2
private static Enumerable<FlatLists.ComparableList<java.lang.Comparable>> p2(java.lang.Object[] lists, int[] fieldCounts, boolean withOrdinality, SqlFunctions.FlatProductInputType[] inputTypes)
-
array
public static java.lang.Object[] array(java.lang.Object... args)
-
product
public static <E extends java.lang.Comparable> Enumerable<FlatLists.ComparableList<E>> product(java.util.List<Enumerator<java.util.List<E>>> enumerators, int fieldCount, boolean withOrdinality)
Similar toLinq4j.product(Iterable)
but each resulting list implementsFlatLists.ComparableList
.
-
addMonths
public static long addMonths(long timestamp, int m)
Adds a given number of months to a timestamp, represented as the number of milliseconds since the epoch.
-
addMonths
public static int addMonths(int date, int m)
Adds a given number of months to a date, represented as the number of days since the epoch.
-
lastDay
private static int lastDay(int y, int m)
-
subtractMonths
public static int subtractMonths(int date0, int date1)
Finds the number of months between two dates, each represented as the number of days since the epoch.
-
subtractMonths
public static int subtractMonths(long t0, long t1)
-
structAccess
public static java.lang.Object structAccess(java.lang.Object structObject, int index, java.lang.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
.
-
isScalarObject
private static boolean isScalarObject(java.lang.Object obj)
-
jsonValueExpression
public static java.lang.Object jsonValueExpression(java.lang.String input)
-
jsonStructuredValueExpression
public static java.lang.Object jsonStructuredValueExpression(java.lang.Object input)
-
jsonApiCommonSyntax
public static SqlFunctions.PathContext jsonApiCommonSyntax(java.lang.Object input, java.lang.String pathSpec)
-
jsonExists
public static java.lang.Boolean jsonExists(java.lang.Object input)
-
jsonExists
public static java.lang.Boolean jsonExists(java.lang.Object input, SqlJsonExistsErrorBehavior errorBehavior)
-
jsonValueAny
public static java.lang.Object jsonValueAny(java.lang.Object input, SqlJsonValueEmptyOrErrorBehavior emptyBehavior, java.lang.Object defaultValueOnEmpty, SqlJsonValueEmptyOrErrorBehavior errorBehavior, java.lang.Object defaultValueOnError)
-
jsonQuery
public static java.lang.String jsonQuery(java.lang.Object input, SqlJsonQueryWrapperBehavior wrapperBehavior, SqlJsonQueryEmptyOrErrorBehavior emptyBehavior, SqlJsonQueryEmptyOrErrorBehavior errorBehavior)
-
jsonize
public static java.lang.String jsonize(java.lang.Object input)
-
dejsonize
public static java.lang.Object dejsonize(java.lang.String input)
-
jsonObject
public static java.lang.String jsonObject(SqlJsonConstructorNullClause nullClause, java.lang.Object... kvs)
-
jsonObjectAggAdd
public static void jsonObjectAggAdd(java.util.Map map, java.lang.String k, java.lang.Object v, SqlJsonConstructorNullClause nullClause)
-
jsonArray
public static java.lang.String jsonArray(SqlJsonConstructorNullClause nullClause, java.lang.Object... elements)
-
jsonArrayAggAdd
public static void jsonArrayAggAdd(java.util.List list, java.lang.Object element, SqlJsonConstructorNullClause nullClause)
-
isJsonValue
public static boolean isJsonValue(java.lang.String input)
-
isJsonObject
public static boolean isJsonObject(java.lang.String input)
-
isJsonArray
public static boolean isJsonArray(java.lang.String input)
-
isJsonScalar
public static boolean isJsonScalar(java.lang.String input)
-
toUnchecked
private static java.lang.RuntimeException toUnchecked(java.lang.Exception e)
-
-