In general, the following syntax is used with comparison and logical operators:
<Expression1> <operator> <expression2>
4 > 2 # true
Comparison operators compare two expressions and logical operators can be used to return values that match a specific condition.
Operator | Definition and format |
---|---|
== |
Is equal to.
|
!=, <> |
Is not equal to.
|
> |
Greater than.
|
>= |
Greater than or equal to.
|
< |
Less than.
|
<= |
Less than or equal to.
|
not |
Returns values that do not match the specified condition, that is, if the expression is false. Excludes data if the specified condition is true.
For further information, see not. |
or |
Returns the boolean value of
where
For further information, see or. |
and |
Returns the boolean value of
where
For further information, see and. |
Only output data when field1 equals value1:
output “out1”{emit *wherefield1 == “value1”}
Only output data when field1 equals value2:
output “out2”{emit *wherefield1 == “value2”}
Only output data when field1 does not equal value1 or value2:
output “out3”{emit *where not(field1 == “value1” orfield1 == “value2”)}