Apache Geode CHANGELOG

Supported Literals

Geode supports the following literal types:

boolean
A boolean value, either TRUE or FALSE
int and long
An integer literal is of type long if has a suffix of the ASCII letter L. Otherwise it is of type int.
floating point
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
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.
char
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).
date
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.
time
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.
timestamp
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).
NIL
Equivalent alternative of NULL.
NULL
The same as null in Java.
UNDEFINED
A special literal, valid value for any data type, indicating that no value (not even NULL) has been designated for a given data item.

The Difference Between NULL and UNDEFINED

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:

  • As the result of a search for a key or value that does not exist
  • As the result of accessing an attribute of a null-valued attribute.

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.

Comparing Values With java.util.Date

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.

Type Conversion

The Geode 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.

Binary Numeric Promotion

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:
    1. If either operand is of type double, the other is converted to double
    2. If either operand is of type float, the other is converted to float
    3. If either operand is of type long, the other is converted to long
    4. Both operands are converted to type int char

Method Invocation Conversion

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

Temporal Type Conversion

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.

Enum Conversion

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.

Query Evaulation of Float.NaN and Double.NaN

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.