Logical
Applies a logical operator to one or more 'boolean_expr' and returns a boolean.
and
Introduced: 5.2.0.4
and(arg0, arg1, ...)
Returns false
if any 'boolean_expr' is false
; otherwise, it returns true
.
- arg0 (boolean_expr)
- arg1 (boolean_expr)
- ... (boolean_expr)
Returns: (boolean_value)
Example: Find records have a key and the key is less than 1000.
- C
- Java
as_exp_build(predexp,
as_exp_and(as_exp_key_exists(),
as_exp_cmp_lt(as_exp_int_key(), as_exp_int(1000))));
Expression exp = Exp.build(
Exp.and(Exp.keyExists(),
Exp.lt(Exp.key(Exp.Type.INT), Exp.val(1000))));
not
Introduced: 5.2.0.4
not(arg)
Returns true
if the 'boolean_expr' is false
; otherwise, it returns false
.
- arg (boolean_expr)
Returns: (boolean_value)
Example: Find where records that do not have a stored key.
- C
- Java
as_exp_build(predexp, as_exp_not(as_exp_key_exists()));
Expression exp = Exp.build(Exp.not(Exp.keyExists()));
or
Introduced: 5.2.0.4
or(arg0, arg1, ...)
Returns true
if any 'boolean_expr' is true
; otherwise, it returns false
.
- arg0 (boolean_expr)
- arg1 (boolean_expr)
- ... (boolean_expr)
Returns: (boolean_value)
Example: Find records where bin 'country' is either 'US' or 'CA'.
- C
- Java
as_exp_build(predexp,
as_exp_or(
as_exp_cmp_eq(as_exp_bin_str("country"), as_exp_str("US")),
as_exp_cmp_eq(
as_exp_bin_str("country"), as_exp_str("CA"))));
Expression exp = Exp.build(
Exp.or(Exp.eq(Exp.stringBin("country"), Exp.val("US")),
Exp.eq(Exp.stringBin("country"), Exp.val("CA"))));
exclusive
Introduced: 5.6.0
exclusive(arg0, arg1, ...)
Returns true
if exactly one 'boolean_expr' is true
; otherwise, it returns false
. This expression is helpful for testing whether multiple expressions are mutually exclusive.
- arg0 (boolean_expr)
- arg1 (boolean_expr)
- ... (boolean_expr)
Returns: (boolean_value)
Example: Find records where only one of the following criteria is true: the value in bin 'hand' is 'hook', the value in bin 'leg' is 'peg', or the value bin 'pet' is 'parrot'.
- C
- Java
as_exp_build(predexp,
as_exp_exclusive(
as_exp_cmp_eq(as_exp_bin_str("hand"), as_exp_str("hook")),
as_exp_cmp_eq(as_exp_bin_str("leg"), as_exp_str("peg")),
as_exp_cmp_eq(
as_exp_bin_str("pet"), as_exp_str("parrot"))));
Expression exp = Exp.build(
Exp.exclusive(Exp.eq(Exp.stringBin("hand"), Exp.val("hook")),
Exp.eq(Exp.stringBin("leg"), Exp.val("peg"))
Exp.eq(Exp.stringBin("pet"), Exp.val("parrot"))));