Skip to main content
Loading

Comparison

Compares values and returns a boolean.

Introduced: 5.2.0.4

eq(left, right)

Returns true if the left is equal to the right, otherwise returns false. left and right must result in the same fundamental type.

Arguments:
  • left (expr)
  • right (expr)

Returns: (boolean_value)

Example: Find records where bin 'fname' is equal to 'Frank'.

as_exp_build(predexp,
as_exp_cmp_eq(as_exp_bin_str("fname"), as_exp_str("frank")));

Introduced: 5.2.0.4

ge(left, right)

Returns true if the left is greater than or equal to the right, otherwise returns false. left and right must result in the same fundamental type.

Arguments:
  • left (expr)
  • right (expr)

Returns: (boolean_value)

Example: Find records where bin 'age' is greater than or equal to 21.

as_exp_build(predexp,
as_exp_cmp_ge(as_exp_bin_int("age"), as_exp_int(21)));

Introduced: 5.2.0.4

gt(left, right)

Returns true if the left is greater than to the right, otherwise returns false. left and right must result in the same fundamental type.

Arguments:
  • left (expr)
  • right (expr)

Returns: (boolean_value)

Example: Find records where the time-to-live (TTL) is greater than 1 year.

as_exp_build(predexp,
as_exp_cmp_gt(as_exp_ttl(), as_exp_int(365 * 24 * 3600)));

Introduced: 5.2.0.4

le(left, right)

Returns true if the left is less than or equal to the right, otherwise returns false. left and right must result in the same fundamental type.

Arguments:
  • left (expr)
  • right (expr)

Returns: (boolean_value)

Example: Find records where bin 'balance' is less than or equal to 100.

as_exp_build(predexp,
as_exp_cmp_le(as_exp_bin_int("balance"), as_exp_int(100)));

Introduced: 5.2.0.4

lt(left, right)

Returns true if the left is less than the right, otherwise returns false. left and right must result in the same fundamental type.

Arguments:
  • left (expr)
  • right (expr)

Returns: (boolean_value)

Example: Find where bin 'lname' between 'o' and 'p'.

as_exp_build(predexp,
as_exp_and(
as_exp_cmp_ge(as_exp_bin_str("lname"), as_exp_str("o"))
as_exp_cmp_lt(as_exp_bin_str("lname"), as_exp_str("p"))));

Introduced: 5.2.0.4

ne(left, right)

Returns true if the left is not equal to the right, otherwise returns false. left and right must result in the same fundamental type.

Arguments:
  • left (expr)
  • right (expr)

Returns: (boolean_value)

Example: Find records where bin 'age' is not an integer.

as_exp_build(predexp,
as_exp_cmp_ne(
as_exp_bin_type("age"), as_exp_int(AS_BYTES_INTEGER)));

cmp_regex

Introduced: 5.2.0.4

cmp_regex(regex_string, options_value, string)

Returns true if the regex_string matches the string, otherwise returns false.

Arguments:
  • regex_string (string_value)
  • options_value (integer_value)
  • string (string_expr)

Returns: (boolean_value)

Example: Find where bin 'city' equals 'Dallas' - case insensitive.

as_exp_build(predexp,
as_exp_cmp_regex(
"^dallas$", reg_icase, as_exp_bin_str("city")));

cmp_geo

Introduced: 5.2.0.4

cmp_geo(left, right)

Returns true if the left is either contained within or contains the right.

Arguments:
  • left (geojson_expr)
  • right (geojson_expr)

Returns: (boolean_value)

Example: Find where bin 'location' is contained within a region.

const char* region = "<geojson region here>";
as_exp_build(predexp,
as_exp_cmp_geo(as_exp_geo(region),
as_exp_bin_geo("location")));