GemFire supports the following literal types:
booleanvalue, either TRUE or FALSE
longif has a suffix of the ASCII letter L. Otherwise it is of type
floatif 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, followed by a signed or unsigned number.
'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.
CHAR, otherwise it is of type
CHARliteral for the single-quotation mark character is
''''(four single quotation marks).
java.sql.Dateobject that uses the JDBC format prefixed with the DATE keyword:
DATE yyyy-mm-dd. In the
yyyyrepresents the year,
mmrepresents the month, and
ddrepresents the day. The year must be represented by four digits; a two-digit shorthand for the year is not allowed.
java.sql.Timeobject that uses the JDBC format (based on a 24-hour clock) prefixed with the TIME keyword:
TIME hh:mm:ss. In the
hhrepresents the hours,
mmrepresents the minutes, and
ssrepresents the seconds.
java.sql.Timestampobject that uses the JDBC format with a TIMESTAMP prefix:
TIMESTAMP yyyy-mm-dd hh:mm:ss.fffffffffIn the
fffffffffrepresents the fractional seconds (up to nine digits).
UNDEFINEDvalue is the result of accessing an attribute of a null-valued attribute. 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
You can compare temporal literal values
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:
- Comparison operators <, <=, >, and >=
- Equality operators = and <>
- Binary numeric promotion widens the operands in a numeric expression to the widest representation used by any of the operands. In each expression, the query processor applies the following rules in the prescribed order until a conversion is made:
- If either operand is of type double, the other is converted to double
- If either operand is of type float, the other is converted to float
- If either operand is of type long, the other is converted to long
- Both operands are converted to type int char
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.