CCL supports a variety of numeric, nonnumeric, and logical operator types.
Arithmetic operators are used to negate, add, subtract, multiply, or divide numeric values. They can be applied to numeric types, but they also support mixed numeric types. Arithmetic operators can have one or two arguments. A unary arithmetic operator returns the same datatype as its argument. A binary arithmetic operator chooses the argument with the highest numeric precedence, implicitly converts the remaining arguments to that data-type, and returns that type.
Operator | Meaning | Example Usage |
---|---|---|
+ | Addition | 3+4 |
- | Subtraction | 7-3 |
* | Multiplication | 3*4 |
/ | Division | 8/2 |
% | Modulus (Remainder) | 8%3 |
^ | Exponent | 4^3 |
- | Change signs | -3 |
++ | Increment
|
++a (preincrement) a++ (postincrement) |
-- | Decrement
|
--a (predecrement) a-- (postdecrement) |
Comparison operators compare one expression to another. The result of such a comparison can be TRUE, FALSE, or NULL.
expression1 comparison_operator expression2
Operator | Meaning | Example Usage |
---|---|---|
= | Equality | a0=a1 |
!= | Inequality | a0!=a1 |
<> | Inequality | a0<>a1 |
> | Greater than | a0!>a1 |
>= | Greater than or equal to | a0!>=a1 |
< | Less than | a0!<a1 |
<= | Less than or equal to | a0!<=a1 |
IN | Member of a list of values. If the value is in the expression list's values, then the result is TRUE. | a0 IN (a1, a2, a3) |
Operator | Meaning | Example Usage |
---|---|---|
AND | Returns TRUE if all expressions are TRUE, and FALSE otherwise. | (a < 10) AND (b > 12) |
NOT | Returns TRUE if all expressions are FALSE, and TRUE otherwise. | NOT (a = 5) |
OR | Returns TRUE if any of the expressions are TRUE, and FALSE otherwise. | (b = 8) OR (b = 6) |
XOR | Returns TRUE if one expression is TRUE and the other is FALSE. Returns FALSE if both expressions are TRUE or both are FALSE. | (b = 8) XOR (a > 14) |
Operator | Meaning | Example Usage |
---|---|---|
+ | Concatenates strings and returns another string. Note: The + operator does not support mixed datatypes (such as an integer and a string).
|
'go' + 'cart' |
May be used in column expressions and WHERE clause expressions. Use the LIKE operator to match string expressions to strings that closely resemble each other but do not exactly match.
Operator | Syntax and Meaning | Example Usage |
---|---|---|
LIKE | Matches WHERE clause string expressions to strings that closely resemble each other but do not exactly match.
compare_expression LIKE pattern_match_expression The LIKE operator returns a value of TRUE if compare_expression matches pattern_match_expression, or FALSE if it does not. The expressions can contain wildcards, where the percent sign (%) matches any length string, and the underscore (_) matches any single character. |
Trades.StockName LIKE "%Corp%" |
The [] operator is only supported in the context of dictionaries and vectors.
Operator | Syntax and Meaning | Example Usage |
---|---|---|
[] | Allows you to perform functions on rows other than the current row in a stream or window.
stream-or-window-name[index].column stream-or-window-name is the name of a stream or window and column indicates a column in the stream or window. index is an expression that can include literals, parameters, or operators, and evaluates to an integer. This integer indicates the stream or window row, in relation to the current row or to the window's sort order. |
MyNamedWindow[1].MyColumn |
When evaluating an expression with multiple operators, the engine evaluates operators with higher precedence before those with lower precedence. Those with equal precedence are evaluated from left to right within an expression. You can use parentheses to override operator precedence, since the engine evaluates expressions inside parentheses before evaluating those outside.