Skip to main content
Loading

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.

Arguments:
  • arg0 (boolean_expr)
  • arg1 (boolean_expr)
  • ... (boolean_expr)

Returns: (boolean_value)

Example: Find records have a key and the key is less than 1000.

as_exp_build(predexp,
as_exp_and(as_exp_key_exists(),
as_exp_cmp_lt(as_exp_int_key(), as_exp_int(1000))));

not

Introduced: 5.2.0.4

not(arg)

Returns true if the 'boolean_expr' is false; otherwise, it returns false.

Arguments:
  • arg (boolean_expr)

Returns: (boolean_value)

Example: Find where records that do not have a stored key.

as_exp_build(predexp, as_exp_not(as_exp_key_exists()));

or

Introduced: 5.2.0.4

or(arg0, arg1, ...)

Returns true if any 'boolean_expr' is true; otherwise, it returns false.

Arguments:
  • arg0 (boolean_expr)
  • arg1 (boolean_expr)
  • ... (boolean_expr)

Returns: (boolean_value)

Example: Find records where bin 'country' is either 'US' or 'CA'.

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"))));

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.

Arguments:
  • 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'.

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"))));