uCosminexus Stream Data Platform - Application Framework Setup and Operation Guide
![[Contents]](FIGURE/CONTENT.GIF)
![[Index]](FIGURE/INDEX.GIF)
![[Back]](FIGURE/FRONT.GIF)
(1) Format of conditional expression
Specify a conditional expression in the following format:
'('column-name comparison-operator constant')'[{AND | OR}'('column-name comparison-operator constant')'
{AND | OR}'('column-name comparison-operator constant')'...]
|
To combine multiple comparison operations, use AND or OR to join the expressions. You can specify a maximum of ten expressions.
The following describes the elements of a conditional expression.
- column-name
- Specifies the name of the column that is to be subject to the comparison operation. This column name must be specified as a schema specification character string in the stream definition (register stream clause).
- comparison-operator
- Specifies the operator to be used in evaluating the condition. The table below lists and describes the comparison operators that can be specified.
| Comparison operator |
Usage example |
Meaning |
| <= |
A <= B |
A is equal to or less than B |
| >= |
A >= B |
A is equal to or greater than B |
| < |
A < B |
A is less than B |
| > |
A > B |
A is greater than B |
| = |
A = B |
A is equal to B |
| != |
A != B |
A is not equal to B |
- constant
- Specifies the value on which the comparison operation is to be performed, expressed as an integer constant or a character-string constant.
- Integer constant
If you use a numeric value for the comparison operation, specify an integer constant. The permitted value is an integer in the range from -9223372036854775808 to 9223372036854775807.
- Character-string constant
If you use a character string for the comparison operation, specify a character-string constant enclosed in single quotation marks ('). The permitted value is a string of single-byte and double-byte characters with a maximum length of 100 characters.
(2) Example of conditional expression
The following shows an example of a conditional expression:
stream.filterCondition=(xxx='abc')AND(zzz>18)AND(zzz<60)
|
This example retains only those tuples whose column xxx is abc and column zzz is greater than 18 and smaller than 60.
(3) Notes on conditional expressions
- AND and OR cannot be intermixed in the same expression.
- AND, OR, and column names are not case sensitive.
- If the column whose name is specified has a character data type (CHAR or VARCHAR), the only permitted comparison operators are = and !=.
- When an integer constant is specified, the data types permitted for the column name are those that are permitted in CQL, as shown below:
- INT
- SMALLINT
- TINYINT
- BIGINT
- DEC
- NUMERIC
- REAL
- FLOAT
- DOUBLE
For details about the data types permitted in CQL, see the manual uCosminexus Stream Data Platform - Application Framework Application Development Guide.
- When you use an integer constant, the data type of the column whose name is specified and whether or not the specified integer constant is within the permissible value range are not checked.
- A character-string constant must be enclosed in single quotation marks ('). If you need to use a single quotation mark as part of the constant, specify two single quotation marks in succession to represent the one single quotation marks. For example, to specify the constant abc'abc, specify 'abc''abc'.
- When the character string in the column is longer than the character string specified as the character-string constant, only the leading part of the column's character string equivalent to the specified length is used for the comparison operation. For example, if the character string specified as the character-string constant is 'abc' (three characters) and the character string contained in the corresponding column is 'abcde' (five characters) only the first three characters 'abc' are used for the comparison. In this example, the character string in the column would be considered to match the specified character-string constant.
- The null character (nothing specified between the two single quotation marks indicating the beginning and end of a character string) cannot be specified as a character-string constant. You can specify space and tabs before and after parentheses, comparison operators, AND, and OR, but such spaces and tab are ignored. Note that there must be no spaces or tabs following the closing parenthesis of the final expression.
- When a character-string constant is specified, the data types permitted for the column name are those that are permitted in CQL, as shown below:
For details about the data types permitted in CQL, see the manual uCosminexus Stream Data Platform - Application Framework Application Development Guide.
All Rights Reserved. Copyright (C) 2011, Hitachi, Ltd.