Apache Geode CHANGELOG

Operators

Geode supports comparison, logical, unary, arithmetic, map, index, dot, and right arrow operators.

Comparison Operators

Comparison operators compare two values and return the results, either TRUE or FALSE.

The following are supported comparison operators:

Operator Meaning
< less than  
<= less than or equal to
> greater than
>= greater than or equal to
= equal to
!= not equal to
<> not equal to

Regarding equality and inequality operators:

  • The equality and inequality operators have lower precedence than the other comparison operators.
  • The equality and inequality operators can be used with null.
  • Inequality queries return results for which the search field is UNDEFINED.
  • To perform equality or inequality comparisons with UNDEFINED, use the IS_DEFINED and IS_UNDEFINED preset query functions instead of these comparison operators.

Logical Operators

The logical operators AND and OR allow you to create more complex expressions by combining expressions to produce a boolean result. When you combine two conditional expressions using the AND operator, both conditions must evaluate to true for the entire expression to be true. When you combine two conditional expressions using the OR operator, the expression evaluates to true if either one or both of the conditions are true. You can create complex expressions by combining multiple simple conditional expressions with AND and OR operators. When expressions use AND and OR operators, AND has higher precedence than OR.

Unary Operators

Unary operators operate on a single value or expression, and have lower precedence than comparison operators in expressions. Geode supports the unary operator NOT. NOT is the negation operator, which changes the value of the operand to its opposite. For example, if an expression evaluates to TRUE, NOT changes it to FALSE. The operand must be a boolean.

Arithmetic Operators

Arithmetic operators operate on two values or expressions. Any of the expected arithmetic exceptions may result, such as overflow or a divide by zero. QueryInvocationTargetException will be thrown, and getCause() will state ArithmeticException.

The following are supported arithmetic operators:

Operator Meaning
+ addition
- subtraction
* multiplication
/ division
% modulus
MOD modulus

Map and Index Operators

Map and index operators access elements in key/value collections (such as maps and regions) and ordered collections (such as arrays, lists, and Strings). The operator is represented by a set of square brackets ([ ]) immediately following the name of the collection. The mapping or indexing specification is provided inside these brackets.

Array, list, and String elements are accessed using an index value. Indexing starts from zero for the first element, 1 for the second element, and so on. If myList is an array, list, or String and index is an expression that evaluates to a non-negative integer, then myList[index] represents the (index + 1)th element of myList. The elements of a String are the list of characters that make up the string.

Map and region values are accessed by key using the same syntax. The key can be any Object. For a Region, the map operator performs a non-distributed get in the local cache only - with no use of netSearch. So myRegion[keyExpression] is the equivalent of myRegion.getEntry(keyExpression).getValue.

Dot, Right Arrow, and Forward Slash Operators

The dot operator (.) separates attribute names in a path expression, and specifies the navigation through object attributes. An alternate equivalent to the dot is the right arrow, (->). The forward slash is used to separate region names when navigating into subregions.