Comparison
Compares values and returns a boolean.
eq
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.
- left (expr)
- right (expr)
Returns: (boolean_value)
Example: Find records where bin 'fname' is equal to 'Frank'.
- C
- Java
as_exp_build(predexp,
as_exp_cmp_eq(as_exp_bin_str("fname"), as_exp_str("frank")));
Expression exp = Exp.build(
Exp.eq(Exp.stringBin("fname"), Exp.val("Frank")));
ge
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.
- left (expr)
- right (expr)
Returns: (boolean_value)
Example: Find records where bin 'age' is greater than or equal to 21.
- C
- Java
as_exp_build(predexp,
as_exp_cmp_ge(as_exp_bin_int("age"), as_exp_int(21)));
Expression exp = Exp.build(
Exp.ge(Exp.intBin("age"), Exp.val(21)));
gt
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.
- left (expr)
- right (expr)
Returns: (boolean_value)
Example: Find records where the time-to-live (TTL) is greater than 1 year.
- C
- Java
as_exp_build(predexp,
as_exp_cmp_gt(as_exp_ttl(), as_exp_int(365 * 24 * 3600)));
Expression exp = Exp.build(
Exp.gt(Exp.ttl(), Exp.val(364 * 24 * 3600)));
le
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.
- left (expr)
- right (expr)
Returns: (boolean_value)
Example: Find records where bin 'balance' is less than or equal to 100.
- C
- Java
as_exp_build(predexp,
as_exp_cmp_le(as_exp_bin_int("balance"), as_exp_int(100)));
Expression exp = Exp.build(
Exp.le(Exp.intBin("balance"), Exp.val(100)));
lt
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.
- left (expr)
- right (expr)
Returns: (boolean_value)
Example: Find where bin 'lname' between 'o' and 'p'.
- C
- Java
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"))));
Expression exp = Exp.build(
Exp.and(
Exp.ge(Exp.stringBin("lname"), Exp.val("o"))
Exp.lt(Exp.stringBin("lname"), Exp.val("p"))));
ne
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.
- left (expr)
- right (expr)
Returns: (boolean_value)
Example: Find records where bin 'age' is not an integer.
- C
- Java
as_exp_build(predexp,
as_exp_cmp_ne(
as_exp_bin_type("age"), as_exp_int(AS_BYTES_INTEGER)));
Expression exp = Exp.build(
Exp.ne(Exp.binType("age"), Exp.val(ParticleType.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
.
- regex_string (string_value)
- options_value (integer_value)
- string (string_expr)
Returns: (boolean_value)
Example: Find where bin 'city' equals 'Dallas' - case insensitive.
- C
- Java
as_exp_build(predexp,
as_exp_cmp_regex(
"^dallas$", reg_icase, as_exp_bin_str("city")));
Expression exp = Exp.build(
Exp.regexCompare(
"^Dallas$", RegexFlag.ICASE, Exp.stringBin("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.
- left (geojson_expr)
- right (geojson_expr)
Returns: (boolean_value)
Example: Find where bin 'location' is contained within a region.
- C
- Java
const char* region = "<geojson region here>";
as_exp_build(predexp,
as_exp_cmp_geo(as_exp_geo(region),
as_exp_bin_geo("location")));
String region = "<geojson region here>";
Expression exp = Exp.build(
Exp.geoCompare(Exp.geo(region), Exp.geoBin("location")));