VMware Tanzu GemFire supports the following literal types:
A boolean
value, either TRUE or FALSE
An integer literal is of type long
if has a suffix of the ASCII letter L. Otherwise it is of type int
.
A floating-point literal is of type float
if it has a suffix of an ASCII letter F
. Otherwise its type is double
. Optionally, it can have a suffix of an ASCII letter D
. A double or floating point literal can optionally include an exponent suffix of E
or e
, followed by a signed or unsigned number.
String literals are delimited by single quotation marks. Embedded single-quotation marks are doubled. For example, the character string 'Hello'
evaluates to the value Hello
, while the character string 'He said, ''Hello'''
evaluates to He said, 'Hello'
. Embedded newlines are kept as part of the string literal.
A literal is of type char if it is a string literal prefixed by the keyword CHAR
, otherwise it is of type string
. The CHAR
literal for the single-quotation mark character is CHAR
''''
(four single quotation marks).
A java.sql.Date
object that uses the JDBC format prefixed with the DATE keyword: DATE 'yyyy-mm-dd'
. In the Date
, yyyy
represents the year, mm
represents the month, and dd
represents the day. The year must be represented by four digits; a two-digit shorthand for the year is not allowed.
A java.sql.Time
object that uses the JDBC format (based on a 24-hour clock) prefixed with the TIME keyword: TIME 'hh:mm:ss'
. In the Time
, hh
represents the hours, mm
represents the minutes, and ss
represents the seconds.
A java.sql.Timestamp
object that uses the JDBC format with a TIMESTAMP prefix: TIMESTAMP 'yyyy-mm-dd hh:mm:ss.fffffffff'
In the Timestamp
, yyyy-mm-dd
represents the date
, hh:mm:ss
represents the time
, and fffffffff
represents the fractional seconds (up to nine digits).
Equivalent alternative of NULL
.
The same as null
in Java.
A special literal, valid value for any data type, indicating that no value (not even NULL) has been designated for a given data item.
In OQL, as in Java, NULL is an assignable entity (an object) indicating “no value”.
In OQL, UNDEFINED is a type. There is no Java equivalent. In OQL search results, an UNDEFINED value can be returned in two cases:
Searches for inequality return UNDEFINED values in their results.
Note that if you access an attribute that has an explicit value of NULL, then it is not UNDEFINED.
For example, if a query accesses the attribute address.city
and address
is NULL, the result is UNDEFINED. If the query accesses address
, then the result is not UNDEFINED, it is NULL.
You can compare temporal literal values DATE
, TIME
, and TIMESTAMP
with java.util.Date
values. There is no literal for java.util.Date
in the query language.
The GemFire query processor performs implicit type conversions and promotions under certain cases in order to evaluate expressions that contain different types. The query processor performs binary numeric promotion, method invocation conversion, and temporal type conversion.
The query processor performs binary numeric promotion on the operands of the following operators:
Method invocation conversion in the query language follows the same rules as Java method invocation conversion, except that the query language uses runtime types instead of compile time types, and handles null arguments differently than in Java. One aspect of using runtime types is that an argument with a null value has no typing information, and so can be matched with any type parameter. When a null argument is used, if the query processor cannot determine the proper method to invoke based on the non-null arguments, it throws an AmbiguousNameException
The temporal types that the query language supports include the Java types java.util.Date
, java.sql.Date
, java.sql.Time
, and java.sql.Timestamp
, which are all treated the same and can be compared and used in indexes. When compared with each other, these types are all treated as nanosecond quantities.
Enums are not automatically converted. To use Enum values in query, you must use the toString method of the enum object or use a query bind parameter. See Enum Objects for more information.
Float.NaN and Double.NaN are not evaluated as primitives; instead, they are compared in the same manner used as the JDK methods Float.compareTo and Double.compareTo. See Double.NaN and Float.NaN Comparisons for more information.