Arithmetic
Arithmetic expressions compute numeric results—integers or floats—from bins, constants, and nested expressions. Use them in read/write operation expressions (for example projection or computed writes), inside comparison expressions when you need a derived value on the left or right, and anywhere the client API accepts a numeric expression.
Operators include add, sub, mul, div, pow, log, mod, abs, floor, ceil, min, max, to_int, to_float, and integer bitwise helpers (int_and, int_or, int_xor, int_not, shifts, int_count, int_lscan, int_rscan). Operand types must match the operator (for example, pow and log use floats; bitwise ops use integers). Needs server 5.6.0+ for these ops unless noted otherwise in each operation.
For boolean filters on records (true/false/unknown), wrap numeric results in a comparison or combine with logic expressions. Nested document scenarios often compose arithmetic with path or map/list expressions.
Ops
abs(value)Creates an absolute-value operator that returns the absolute value of a number. The argument must be either an ‘integer_expr’ or a ‘float_expr’.
| Name | Type |
|---|---|
value | number_expr |
number_value Find records where the absolute value of the difference between integer bins x1 and x2 is greater than 1.
Expression exp = Exp.build( Exp.gt( Exp.abs(Exp.sub( Exp.intBin("x1"), Exp.intBin("x2"))), Exp.val(1)));from aerospike_helpers.expressions import Abs, GT, IntBin, Sub
exp = GT(Abs(Sub(IntBin("x1"), IntBin("x2"))), 1).compile()as_exp_build(predexp, as_exp_cmp_gt( as_exp_abs(as_exp_sub( as_exp_bin_int("x1"), as_exp_bin_int("x2"))), as_exp_int(1)));// Import path matches the Go client examples elsewhere on this doc site (/v6).// If you use the latest client line, switch to .../aerospike-client-go/v8 (API names unchanged).// Requires: import as "github.com/aerospike/aerospike-client-go/v6"exp := as.ExpGreater( as.ExpNumAbs(as.ExpNumSub(as.ExpIntBin("x1"), as.ExpIntBin("x2"))), as.ExpIntVal(1))Expression exp = Exp.Build( Exp.GT( Exp.Abs(Exp.Sub(Exp.IntBin("x1"), Exp.IntBin("x2"))), Exp.Val(1)));const exp = Aerospike.exp
const filterExp = exp.gt( exp.abs(exp.sub(exp.binInt('x1'), exp.binInt('x2'))), exp.int(1))add(arg0, arg1, ...)Creates an addition (+) operator that applies to a variable number of expression arguments. Arguments must all be either ‘float_expr’ or ‘integer_expr’.
| Name | Type |
|---|---|
arg0 | number_expr |
arg1 | number_expr |
... | number_expr |
number_value Find records where the sum of integer bins apples and bananas is greater than 10.
Expression exp = Exp.build( Exp.gt( Exp.add( Exp.intBin("apples"), Exp.intBin("bananas")), Exp.val(10)));from aerospike_helpers.expressions import Add, GT, IntBin
exp = GT(Add(IntBin("apples"), IntBin("bananas")), 10).compile()as_exp_build(predexp, as_exp_cmp_gt( as_exp_add( as_exp_bin_int("apples"), as_exp_bin_int("bananas")), as_exp_int(10)));// Import path matches the Go client examples elsewhere on this doc site (/v6).// If you use the latest client line, switch to .../aerospike-client-go/v8 (API names unchanged).// Requires: import as "github.com/aerospike/aerospike-client-go/v6"exp := as.ExpGreater( as.ExpNumAdd(as.ExpIntBin("apples"), as.ExpIntBin("bananas")), as.ExpIntVal(10))Expression exp = Exp.Build( Exp.GT( Exp.Add(Exp.IntBin("apples"), Exp.IntBin("bananas")), Exp.Val(10)));const exp = Aerospike.exp
const filterExp = exp.gt( exp.add(exp.binInt('apples'), exp.binInt('bananas')), exp.int(10))ceil(value)Creates an expression that rounds a floating-point number up to the closest integer value. The argument must be a ‘float_expr’.
| Name | Type |
|---|---|
value | float_expr |
float_value Find records where the ceiling of float bin value equals 2.0.
Expression exp = Exp.build( Exp.eq( Exp.ceil(Exp.floatBin("value")), Exp.val(2.0)));from aerospike_helpers.expressions import Ceil, Eq, FloatBin
exp = Eq(Ceil(FloatBin("value")), 2.0).compile()as_exp_build(predexp, as_exp_cmp_eq( as_exp_ceil(as_exp_bin_float("value")), as_exp_float(2.0)));// Import path matches the Go client examples elsewhere on this doc site (/v6).// If you use the latest client line, switch to .../aerospike-client-go/v8 (API names unchanged).// Requires: import as "github.com/aerospike/aerospike-client-go/v6"exp := as.ExpEq( as.ExpNumCeil(as.ExpFloatBin("value")), as.ExpFloatVal(2.0))Expression exp = Exp.Build( Exp.EQ( Exp.Ceil(Exp.FloatBin("value")), Exp.Val(2.0)));const exp = Aerospike.exp
const filterExp = exp.eq(exp.ceil(exp.binFloat('value')), exp.float(2.0))div(arg0, arg1, ...)Creates a division operator (/) that applies to a variable number of expression arguments. Divides arguments from left to right, such that div(10,5) equals (10/5) and div(10,5,2) equals (10 / (5 * 2)), or, in alternate notation, ((10 / 5) / 2). If only one argument is supplied, returns the reciprocal (1/x) for that argument or, if the single argument is an integer type, returns 0 to avoid type incompatibility (as the reciprocal of an integer is a fraction). Arguments must all be either ‘float_expr’ or ‘integer_expr’.
| Name | Type |
|---|---|
arg0 | number_expr |
arg1 | number_expr |
... | number_expr |
number_value Find records where candy divided by kids (as floats) is less than 1.0.
Expression exp = Exp.build( Exp.lt( Exp.div( Exp.toFloat(Exp.intBin("candy")), Exp.toFloat(Exp.intBin("kids"))), Exp.val(1.0)));from aerospike_helpers.expressions import Div, FloatBin, IntBin, LT, ToFloat
exp = LT( Div(ToFloat(IntBin("candy")), ToFloat(IntBin("kids"))), 1.0,).compile()as_exp_build(predexp, as_exp_cmp_lt( as_exp_div( as_exp_to_float(as_exp_bin_int("candy")), as_exp_to_float(as_exp_bin_int("kids"))), as_exp_float(1.0)));// Import path matches the Go client examples elsewhere on this doc site (/v6).// If you use the latest client line, switch to .../aerospike-client-go/v8 (API names unchanged).// Requires: import as "github.com/aerospike/aerospike-client-go/v6"exp := as.ExpLess( as.ExpNumDiv(as.ExpToFloat(as.ExpIntBin("candy")), as.ExpToFloat(as.ExpIntBin("kids"))), as.ExpFloatVal(1.0))Expression exp = Exp.Build( Exp.LT( Exp.Div(Exp.ToFloat(Exp.IntBin("candy")), Exp.ToFloat(Exp.IntBin("kids"))), Exp.Val(1.0)));const exp = Aerospike.exp
const filterExp = exp.lt( exp.div(exp.toFloat(exp.binInt('candy')), exp.toFloat(exp.binInt('kids'))), exp.float(1.0))floor(value)Creates an expression that rounds a floating-point number down to the closest integer value. The argument must be a ‘float_expr’.
| Name | Type |
|---|---|
value | float_expr |
float_value Find records where the floor of float bin value equals 2.0.
Expression exp = Exp.build( Exp.eq( Exp.floor(Exp.floatBin("value")), Exp.val(2.0)));from aerospike_helpers.expressions import Eq, FloatBin, Floor
exp = Eq(Floor(FloatBin("value")), 2.0).compile()as_exp_build(predexp, as_exp_cmp_eq( as_exp_floor(as_exp_bin_float("value")), as_exp_float(2.0)));// Import path matches the Go client examples elsewhere on this doc site (/v6).// If you use the latest client line, switch to .../aerospike-client-go/v8 (API names unchanged).// Requires: import as "github.com/aerospike/aerospike-client-go/v6"exp := as.ExpEq( as.ExpNumFloor(as.ExpFloatBin("value")), as.ExpFloatVal(2.0))Expression exp = Exp.Build( Exp.EQ( Exp.Floor(Exp.FloatBin("value")), Exp.Val(2.0)));const exp = Aerospike.exp
const filterExp = exp.eq(exp.floor(exp.binFloat('value')), exp.float(2.0))int_and(arg0, arg1, ...)Creates an “and” operator (&) that is applied to two or more integers. All arguments must resolve to integers.
| Name | Type |
|---|---|
arg0 | integer_expr |
arg1 | integer_expr |
... | integer_expr |
integer_value Find records where integer bin flags bitwise-AND mask 0xF is non-zero.
Expression exp = Exp.build( Exp.ne( Exp.intAnd(Exp.intBin("flags"), Exp.val(0xF)), Exp.val(0)));from aerospike_helpers.expressions import IntAnd, IntBin, NE
exp = NE(IntAnd(IntBin("flags"), 0xF), 0).compile()as_exp_build(predexp, as_exp_cmp_ne( as_exp_int_and(as_exp_bin_int("flags"), as_exp_int(0xF)), as_exp_int(0)));// Import path matches the Go client examples elsewhere on this doc site (/v6).// If you use the latest client line, switch to .../aerospike-client-go/v8 (API names unchanged).// Requires: import as "github.com/aerospike/aerospike-client-go/v6"exp := as.ExpNotEq( as.ExpIntAnd(as.ExpIntBin("flags"), as.ExpIntVal(0xF)), as.ExpIntVal(0))Expression exp = Exp.Build( Exp.NE( Exp.IntAnd(Exp.IntBin("flags"), Exp.Val(0xF)), Exp.Val(0)));const exp = Aerospike.exp
const filterExp = exp.ne( exp.intAnd(exp.binInt('flags'), exp.int(0xf)), exp.int(0))int_arshift(value, by_numbits)Creates an arithmetic right-shift operator (>>) for use with integers.
| Name | Type |
|---|---|
value | integer_expr |
by_numbits | integer_value |
integer_value Find records where arithmetic right-shift of integer bin value by 3 bits (divide by 8) is less than 1000.
Expression exp = Exp.build( Exp.lt( Exp.arshift(Exp.intBin("value"), Exp.val(3)), Exp.val(1000)));from aerospike_helpers.expressions import IntArithmeticRightShift, IntBin, LT
exp = LT(IntArithmeticRightShift(IntBin("value"), 3), 1000).compile()as_exp_build(predexp, as_exp_cmp_lt( as_exp_int_arshift(as_exp_bin_int("value"), as_exp_int(3)), as_exp_int(1000)));// Import path matches the Go client examples elsewhere on this doc site (/v6).// If you use the latest client line, switch to .../aerospike-client-go/v8 (API names unchanged).// Requires: import as "github.com/aerospike/aerospike-client-go/v6"exp := as.ExpLess( as.ExpIntARShift(as.ExpIntBin("value"), as.ExpIntVal(3)), as.ExpIntVal(1000))Expression exp = Exp.Build( Exp.LT( Exp.ARshift(Exp.IntBin("value"), Exp.Val(3)), Exp.Val(1000)));const exp = Aerospike.exp
const filterExp = exp.lt( exp.intArshift(exp.binInt('value'), exp.int(3)), exp.int(1000))int_count(value)Creates an expression that returns a count of integer bits that are set to 1.
| Name | Type |
|---|---|
value | integer_expr |
integer_value Find records where the population count of integer bin visits is greater than 15.
Expression exp = Exp.build( Exp.gt( Exp.count(Exp.intBin("visits")), Exp.val(15)));from aerospike_helpers.expressions import GT, IntBin, IntCount
exp = GT(IntCount(IntBin("visits")), 15).compile()as_exp_build(predexp, as_exp_cmp_gt( as_exp_int_count(as_exp_bin_int("visits")), as_exp_int(15)));// Import path matches the Go client examples elsewhere on this doc site (/v6).// If you use the latest client line, switch to .../aerospike-client-go/v8 (API names unchanged).// Requires: import as "github.com/aerospike/aerospike-client-go/v6"exp := as.ExpGreater( as.ExpIntCount(as.ExpIntBin("visits")), as.ExpIntVal(15))Expression exp = Exp.Build( Exp.GT( Exp.Count(Exp.IntBin("visits")), Exp.Val(15)));const exp = Aerospike.exp
const filterExp = exp.gt(exp.intCount(exp.binInt('visits')), exp.int(15))int_lscan(value, search)Creates an expression that scans integer bits from the left (the most significant bit) to the right (the least significant bit), looking for a bit value. When the value is found, the index of that bit (where the most significant bit is index 0) is returned. If “search” is true, the scan searches for the bit value 1. If “search” is false, it searches for the bit value 0.
| Name | Type |
|---|---|
value | integer_expr |
search | boolean_expr |
integer_value Find records where a left-scan for bit 0 in integer bin value reports an index greater than 30 (leading bits mostly clear).
Expression exp = Exp.build( Exp.gt( Exp.lscan(Exp.intBin("value"), Exp.val(false)), Exp.val(30)));from aerospike_helpers.expressions import GT, IntBin, IntLeftScan
exp = GT(IntLeftScan(IntBin("value"), False), 30).compile()as_exp_build(predexp, as_exp_cmp_gt( as_exp_int_lscan( as_exp_bin_int("value"), as_exp_bool(false)), as_exp_int(30)));// Import path matches the Go client examples elsewhere on this doc site (/v6).// If you use the latest client line, switch to .../aerospike-client-go/v8 (API names unchanged).// Requires: import as "github.com/aerospike/aerospike-client-go/v6"exp := as.ExpGreater( as.ExpIntLScan(as.ExpIntBin("value"), as.ExpBoolVal(false)), as.ExpIntVal(30))Expression exp = Exp.Build( Exp.GT( Exp.Lscan(Exp.IntBin("value"), Exp.Val(false)), Exp.Val(30)));const exp = Aerospike.exp
const filterExp = exp.gt( exp.intLscan(exp.binInt('value'), exp.bool(false)), exp.int(30))int_lshift(value, by_numbits)Creates a left-shift operator (<<) for use with integers.
| Name | Type |
|---|---|
value | integer_expr |
by_numbits | integer_value |
integer_value Find records where integer bin visits left-shifted by 1 bit is greater than 100.
Expression exp = Exp.build( Exp.gt( Exp.lshift(Exp.intBin("visits"), Exp.val(1)), Exp.val(100)));from aerospike_helpers.expressions import GT, IntBin, IntLeftShift
exp = GT(IntLeftShift(IntBin("visits"), 1), 100).compile()as_exp_build(predexp, as_exp_cmp_gt( as_exp_int_lshift(as_exp_bin_int("visits"), as_exp_int(1)), as_exp_int(100)));// Import path matches the Go client examples elsewhere on this doc site (/v6).// If you use the latest client line, switch to .../aerospike-client-go/v8 (API names unchanged).// Requires: import as "github.com/aerospike/aerospike-client-go/v6"exp := as.ExpGreater( as.ExpIntLShift(as.ExpIntBin("visits"), as.ExpIntVal(1)), as.ExpIntVal(100))Expression exp = Exp.Build( Exp.GT( Exp.Lshift(Exp.IntBin("visits"), Exp.Val(1)), Exp.Val(100)));const exp = Aerospike.exp
const filterExp = exp.gt( exp.intLshift(exp.binInt('visits'), exp.int(1)), exp.int(100))int_not(value)Creates a “not” operator (~) that is applied to an integer.
| Name | Type |
|---|---|
value | integer_expr |
integer_value Find records where bitwise NOT of integer bin flags is not zero.
Expression exp = Exp.build( Exp.ne( Exp.intNot(Exp.intBin("flags")), Exp.val(0)));from aerospike_helpers.expressions import IntBin, IntNot, NE
exp = NE(IntNot(IntBin("flags")), 0).compile()as_exp_build(predexp, as_exp_cmp_ne( as_exp_int_not(as_exp_bin_int("flags")), as_exp_int(0)));// Import path matches the Go client examples elsewhere on this doc site (/v6).// If you use the latest client line, switch to .../aerospike-client-go/v8 (API names unchanged).// Requires: import as "github.com/aerospike/aerospike-client-go/v6"exp := as.ExpNotEq( as.ExpIntNot(as.ExpIntBin("flags")), as.ExpIntVal(0))Expression exp = Exp.Build( Exp.NE( Exp.IntNot(Exp.IntBin("flags")), Exp.Val(0)));const exp = Aerospike.exp
const filterExp = exp.ne(exp.intNot(exp.binInt('flags')), exp.int(0))int_or(arg0, arg1, ...)Creates an “or” operator (|) that is applied to two or more integers. All arguments must resolve to integers.
| Name | Type |
|---|---|
arg0 | integer_expr |
arg1 | integer_expr |
... | integer_expr |
integer_value Find records where the bitwise OR of integer bins read_mask and write_mask is non-zero.
Expression exp = Exp.build( Exp.gt( Exp.intOr( Exp.intBin("read_mask"), Exp.intBin("write_mask")), Exp.val(0)));from aerospike_helpers.expressions import GT, IntBin, IntOr
exp = GT(IntOr(IntBin("read_mask"), IntBin("write_mask")), 0).compile()as_exp_build(predexp, as_exp_cmp_gt( as_exp_int_or( as_exp_bin_int("read_mask"), as_exp_bin_int("write_mask")), as_exp_int(0)));// Import path matches the Go client examples elsewhere on this doc site (/v6).// If you use the latest client line, switch to .../aerospike-client-go/v8 (API names unchanged).// Requires: import as "github.com/aerospike/aerospike-client-go/v6"exp := as.ExpGreater( as.ExpIntOr(as.ExpIntBin("read_mask"), as.ExpIntBin("write_mask")), as.ExpIntVal(0))Expression exp = Exp.Build( Exp.GT( Exp.IntOr(Exp.IntBin("read_mask"), Exp.IntBin("write_mask")), Exp.Val(0)));const exp = Aerospike.exp
const filterExp = exp.gt( exp.intOr(exp.binInt('read_mask'), exp.binInt('write_mask')), exp.int(0))int_rscan(value, search)Create expression that scans integer bits from right (the least significant bit) to left (the most significant bit), looking for a search bit value. When the search value is found, the index of that bit (where the most significant bit is index 0) is returned. If “search” is true, the scan will search for the bit value 1. If “search” is false it will search for bit value 0.
| Name | Type |
|---|---|
value | integer_expr |
search | boolean_expr |
integer_value Find records where a right-scan for bit 1 in integer bin visits reports an index greater than 56 (recent activity in high bits of a 64-bit field).
Expression exp = Exp.build( Exp.gt( Exp.rscan(Exp.intBin("visits"), Exp.val(true)), Exp.val(56)));from aerospike_helpers.expressions import GT, IntBin, IntRightScan
exp = GT(IntRightScan(IntBin("visits"), True), 56).compile()as_exp_build(predexp, as_exp_cmp_gt( as_exp_int_rscan( as_exp_bin_int("visits"), as_exp_bool(true)), as_exp_int(56)));// Import path matches the Go client examples elsewhere on this doc site (/v6).// If you use the latest client line, switch to .../aerospike-client-go/v8 (API names unchanged).// Requires: import as "github.com/aerospike/aerospike-client-go/v6"exp := as.ExpGreater( as.ExpIntRScan(as.ExpIntBin("visits"), as.ExpBoolVal(true)), as.ExpIntVal(56))Expression exp = Exp.Build( Exp.GT( Exp.Rscan(Exp.IntBin("visits"), Exp.Val(true)), Exp.Val(56)));const exp = Aerospike.exp
const filterExp = exp.gt( exp.intRscan(exp.binInt('visits'), exp.bool(true)), exp.int(56))int_rshift(value, by_numbits)Creates a logical right-shift operator (>>>) for use with integers.
| Name | Type |
|---|---|
value | integer_expr |
by_numbits | integer_value |
integer_value Determine whether the 6th bit from the left is set in integer bin flags (logical right shift then mask).
Expression exp = Exp.build( Exp.eq( Exp.intAnd( Exp.rshift(Exp.intBin("flags"), Exp.val(6)), Exp.val(1)), Exp.val(1)));from aerospike_helpers.expressions import Eq, IntAnd, IntBin, IntRightShift
exp = Eq( IntAnd(IntRightShift(IntBin("flags"), 6), 1), 1,).compile()as_exp_build(predexp, as_exp_cmp_eq( as_exp_int_and( as_exp_int_rshift(as_exp_bin_int("flags"), as_exp_int(6)), as_exp_int(1)), as_exp_int(1)));// Import path matches the Go client examples elsewhere on this doc site (/v6).// If you use the latest client line, switch to .../aerospike-client-go/v8 (API names unchanged).// Requires: import as "github.com/aerospike/aerospike-client-go/v6"exp := as.ExpEq( as.ExpIntAnd( as.ExpIntRShift(as.ExpIntBin("flags"), as.ExpIntVal(6)), as.ExpIntVal(1)), as.ExpIntVal(1))Expression exp = Exp.Build( Exp.EQ( Exp.IntAnd( Exp.Rshift(Exp.IntBin("flags"), Exp.Val(6)), Exp.Val(1)), Exp.Val(1)));const exp = Aerospike.exp
const filterExp = exp.eq( exp.intAnd(exp.intRshift(exp.binInt('flags'), exp.int(6)), exp.int(1)), exp.int(1))int_xor(arg0, arg1, ...)Creates an “xor” operator (^) that is applied to two or more integers. All arguments must resolve to integers.
| Name | Type |
|---|---|
arg0 | integer_expr |
arg1 | integer_expr |
... | integer_expr |
integer_value Find records where the bitwise XOR of integer bins a and b is non-zero.
Expression exp = Exp.build( Exp.gt( Exp.intXor( Exp.intBin("a"), Exp.intBin("b")), Exp.val(0)));from aerospike_helpers.expressions import GT, IntBin, IntXOr
exp = GT(IntXOr(IntBin("a"), IntBin("b")), 0).compile()as_exp_build(predexp, as_exp_cmp_gt( as_exp_int_xor( as_exp_bin_int("a"), as_exp_bin_int("b")), as_exp_int(0)));// Import path matches the Go client examples elsewhere on this doc site (/v6).// If you use the latest client line, switch to .../aerospike-client-go/v8 (API names unchanged).// Requires: import as "github.com/aerospike/aerospike-client-go/v6"exp := as.ExpGreater( as.ExpIntXor(as.ExpIntBin("a"), as.ExpIntBin("b")), as.ExpIntVal(0))Expression exp = Exp.Build( Exp.GT( Exp.IntXor(Exp.IntBin("a"), Exp.IntBin("b")), Exp.Val(0)));const exp = Aerospike.exp
const filterExp = exp.gt(exp.intXor(exp.binInt('a'), exp.binInt('b')), exp.int(0))log(num, base)Creates a “log” operator for the logarithm of the number “num” with base “base”. Arguments must all be ‘float_expr’.
| Name | Type |
|---|---|
num | float_expr |
base | float_expr |
float_value Find records where the base-8 logarithm of float bin branches is greater than 2.
Expression exp = Exp.build( Exp.gt( Exp.log(Exp.floatBin("branches"), Exp.val(8.0)), Exp.val(2.0)));from aerospike_helpers.expressions import FloatBin, GT, Log
exp = GT(Log(FloatBin("branches"), 8.0), 2.0).compile()as_exp_build(predexp, as_exp_cmp_gt( as_exp_log(as_exp_bin_float("branches"), as_exp_float(8.0)), as_exp_float(2.0)));// Import path matches the Go client examples elsewhere on this doc site (/v6).// If you use the latest client line, switch to .../aerospike-client-go/v8 (API names unchanged).// Requires: import as "github.com/aerospike/aerospike-client-go/v6"exp := as.ExpGreater( as.ExpNumLog(as.ExpFloatBin("branches"), as.ExpFloatVal(8.0)), as.ExpFloatVal(2.0))Expression exp = Exp.Build( Exp.GT( Exp.Log(Exp.FloatBin("branches"), Exp.Val(8.0)), Exp.Val(2.0)));const exp = Aerospike.exp
const filterExp = exp.gt( exp.log(exp.binFloat('branches'), exp.float(8.0)), exp.float(2.0))max(arg0, arg1, ...)Creates an expression that returns the maximum value in a variable number of expressions. Arguments must all be either ‘float_expr’ or ‘integer_expr’.
| Name | Type |
|---|---|
arg0 | number_expr |
arg1 | number_expr |
... | number_expr |
number_value Find records where the maximum of integer bins value0–value3 is greater than 100.
Expression exp = Exp.build( Exp.gt( Exp.max( Exp.intBin("value0"), Exp.intBin("value1"), Exp.intBin("value2"), Exp.intBin("value3")), Exp.val(100)));from aerospike_helpers.expressions import GT, IntBin, Max
exp = GT( Max( IntBin("value0"), IntBin("value1"), IntBin("value2"), IntBin("value3"), ), 100,).compile()as_exp_build(predexp, as_exp_cmp_gt( as_exp_max( as_exp_bin_int("value0"), as_exp_bin_int("value1"), as_exp_bin_int("value2"), as_exp_bin_int("value3")), as_exp_int(100)));// Import path matches the Go client examples elsewhere on this doc site (/v6).// If you use the latest client line, switch to .../aerospike-client-go/v8 (API names unchanged).// Requires: import as "github.com/aerospike/aerospike-client-go/v6"exp := as.ExpGreater( as.ExpMax( as.ExpIntBin("value0"), as.ExpIntBin("value1"), as.ExpIntBin("value2"), as.ExpIntBin("value3")), as.ExpIntVal(100))Expression exp = Exp.Build( Exp.GT( Exp.Max( Exp.IntBin("value0"), Exp.IntBin("value1"), Exp.IntBin("value2"), Exp.IntBin("value3")), Exp.Val(100)));const exp = Aerospike.exp
const filterExp = exp.gt( exp.max( exp.binInt('value0'), exp.binInt('value1'), exp.binInt('value2'), exp.binInt('value3')), exp.int(100))min(arg0, arg1, ...)Creates an expression that returns the minimum value in a variable number of expressions. Arguments must all be either ‘float_expr’ or ‘integer_expr’.
| Name | Type |
|---|---|
arg0 | number_expr |
arg1 | number_expr |
... | number_expr |
number_value Find records where the minimum of integer bins value0–value3 is less than 10.
Expression exp = Exp.build( Exp.lt( Exp.min( Exp.intBin("value0"), Exp.intBin("value1"), Exp.intBin("value2"), Exp.intBin("value3")), Exp.val(10)));from aerospike_helpers.expressions import IntBin, LT, Min
exp = LT( Min( IntBin("value0"), IntBin("value1"), IntBin("value2"), IntBin("value3"), ), 10,).compile()as_exp_build(predexp, as_exp_cmp_lt( as_exp_min( as_exp_bin_int("value0"), as_exp_bin_int("value1"), as_exp_bin_int("value2"), as_exp_bin_int("value3")), as_exp_int(10)));// Import path matches the Go client examples elsewhere on this doc site (/v6).// If you use the latest client line, switch to .../aerospike-client-go/v8 (API names unchanged).// Requires: import as "github.com/aerospike/aerospike-client-go/v6"exp := as.ExpLess( as.ExpMin( as.ExpIntBin("value0"), as.ExpIntBin("value1"), as.ExpIntBin("value2"), as.ExpIntBin("value3")), as.ExpIntVal(10))Expression exp = Exp.Build( Exp.LT( Exp.Min( Exp.IntBin("value0"), Exp.IntBin("value1"), Exp.IntBin("value2"), Exp.IntBin("value3")), Exp.Val(10)));const exp = Aerospike.exp
const filterExp = exp.lt( exp.min( exp.binInt('value0'), exp.binInt('value1'), exp.binInt('value2'), exp.binInt('value3')), exp.int(10))mod(numerator, denominator)Creates a modulo operator (%) that determines the remainder of “numerator” divided by “denominator”. Arguments must all be ‘integer_expr’.
| Name | Type |
|---|---|
numerator | integer_expr |
denominator | integer_expr |
integer_value Find records where integer bin value modulo 2 equals 0.
Expression exp = Exp.build( Exp.eq( Exp.mod(Exp.intBin("value"), Exp.val(2)), Exp.val(0)));from aerospike_helpers.expressions import Eq, IntBin, Mod
exp = Eq(Mod(IntBin("value"), 2), 0).compile()as_exp_build(predexp, as_exp_cmp_eq( as_exp_mod(as_exp_bin_int("value"), as_exp_int(2)), as_exp_int(0)));// Import path matches the Go client examples elsewhere on this doc site (/v6).// If you use the latest client line, switch to .../aerospike-client-go/v8 (API names unchanged).// Requires: import as "github.com/aerospike/aerospike-client-go/v6"exp := as.ExpEq( as.ExpNumMod(as.ExpIntBin("value"), as.ExpIntVal(2)), as.ExpIntVal(0))Expression exp = Exp.Build( Exp.EQ( Exp.Mod(Exp.IntBin("value"), Exp.Val(2)), Exp.Val(0)));const exp = Aerospike.exp
const filterExp = exp.eq( exp.mod(exp.binInt('value'), exp.int(2)), exp.int(0))mul(arg0, arg1, ...)Creates a multiplication operator (*) that applies to a variable number of expression arguments. If only one argument is supplied, returns that argument. Arguments must all be either ‘float_expr’ or ‘integer_expr’.
| Name | Type |
|---|---|
arg0 | number_expr |
arg1 | number_expr |
... | number_expr |
number_value Find records where the product of integer bins height and width is less than 100.
Expression exp = Exp.build( Exp.lt( Exp.mul( Exp.intBin("height"), Exp.intBin("width")), Exp.val(100)));from aerospike_helpers.expressions import IntBin, LT, Mul
exp = LT(Mul(IntBin("height"), IntBin("width")), 100).compile()as_exp_build(predexp, as_exp_cmp_lt( as_exp_mul( as_exp_bin_int("height"), as_exp_bin_int("width")), as_exp_int(100)));// Import path matches the Go client examples elsewhere on this doc site (/v6).// If you use the latest client line, switch to .../aerospike-client-go/v8 (API names unchanged).// Requires: import as "github.com/aerospike/aerospike-client-go/v6"exp := as.ExpLess( as.ExpNumMul(as.ExpIntBin("height"), as.ExpIntBin("width")), as.ExpIntVal(100))Expression exp = Exp.Build( Exp.LT( Exp.Mul(Exp.IntBin("height"), Exp.IntBin("width")), Exp.Val(100)));const exp = Aerospike.exp
const filterExp = exp.lt( exp.mul(exp.binInt('height'), exp.binInt('width')), exp.int(100))pow(base, exponent)Creates a “pow” operator that raises the base “base” to the power of “exponent”. Arguments must all be ‘float_expr’.
| Name | Type |
|---|---|
base | float_expr |
exponent | float_expr |
float_value Find records where float bin p raised to the power of integer bin events (converted to float) is less than 0.5.
Expression exp = Exp.build( Exp.lt( Exp.pow( Exp.floatBin("p"), Exp.toFloat(Exp.intBin("events"))), Exp.val(0.5)));from aerospike_helpers.expressions import FloatBin, IntBin, LT, Pow, ToFloat
exp = LT(Pow(FloatBin("p"), ToFloat(IntBin("events"))), 0.5).compile()as_exp_build(predexp, as_exp_cmp_lt( as_exp_pow(as_exp_bin_float("p"), as_exp_to_float(as_exp_bin_int("events"))), as_exp_float(0.5)));// Import path matches the Go client examples elsewhere on this doc site (/v6).// If you use the latest client line, switch to .../aerospike-client-go/v8 (API names unchanged).// Requires: import as "github.com/aerospike/aerospike-client-go/v6"exp := as.ExpLess( as.ExpNumPow(as.ExpFloatBin("p"), as.ExpToFloat(as.ExpIntBin("events"))), as.ExpFloatVal(0.5))Expression exp = Exp.Build( Exp.LT( Exp.Pow(Exp.FloatBin("p"), Exp.ToFloat(Exp.IntBin("events"))), Exp.Val(0.5)));const exp = Aerospike.exp
const filterExp = exp.lt( exp.pow(exp.binFloat('p'), exp.toFloat(exp.binInt('events'))), exp.float(0.5))sub(arg0, arg1, ...)Creates a subtract operator (-) that applies to a variable number of expression arguments. Arguments must all be either ‘float_expr’ or ‘integer_expr’. Subtracts arguments from left to right:
- sub(10,5) = (10-5) = 4
- sub(10,5,1) = (10 - (5 + 1)) = 1 or, in alternate notation, ((10 - 5) - 1).
- Negates single arguments: sub(-1) = 1 and sub(1) = -1.
| Name | Type |
|---|---|
arg0 | number_expr |
arg1 | number_expr |
... | number_expr |
number_value Find records where the difference between integer bin assets and debts is less than 1000000.
Expression exp = Exp.build( Exp.lt( Exp.sub( Exp.intBin("assets"), Exp.intBin("debts")), Exp.val(1000000)));from aerospike_helpers.expressions import IntBin, LT, Sub
exp = LT(Sub(IntBin("assets"), IntBin("debts")), 1000000).compile()as_exp_build(predexp, as_exp_cmp_lt( as_exp_sub( as_exp_bin_int("assets"), as_exp_bin_int("debts")), as_exp_int(1000000)));// Import path matches the Go client examples elsewhere on this doc site (/v6).// If you use the latest client line, switch to .../aerospike-client-go/v8 (API names unchanged).// Requires: import as "github.com/aerospike/aerospike-client-go/v6"exp := as.ExpLess( as.ExpNumSub(as.ExpIntBin("assets"), as.ExpIntBin("debts")), as.ExpIntVal(1000000))Expression exp = Exp.Build( Exp.LT( Exp.Sub(Exp.IntBin("assets"), Exp.IntBin("debts")), Exp.Val(1000000)));const exp = Aerospike.exp
const filterExp = exp.lt( exp.sub(exp.binInt('assets'), exp.binInt('debts')), exp.int(1000000))to_float(value)Creates an expression that converts an integer value to a floating-point value. The argument must be a ‘float_expr’.
| Name | Type |
|---|---|
value | integer_expr |
float_value Find records where to_float of integer bin quantity is at least 1.0 (for float comparisons without changing stored bin types).
Expression exp = Exp.build( Exp.ge( Exp.toFloat(Exp.intBin("quantity")), Exp.val(1.0)));from aerospike_helpers.expressions import GE, IntBin, ToFloat
exp = GE(ToFloat(IntBin("quantity")), 1.0).compile()as_exp_build(predexp, as_exp_cmp_ge( as_exp_to_float(as_exp_bin_int("quantity")), as_exp_float(1.0)));// Import path matches the Go client examples elsewhere on this doc site (/v6).// If you use the latest client line, switch to .../aerospike-client-go/v8 (API names unchanged).// Requires: import as "github.com/aerospike/aerospike-client-go/v6"exp := as.ExpGreaterEq( as.ExpToFloat(as.ExpIntBin("quantity")), as.ExpFloatVal(1.0))Expression exp = Exp.Build( Exp.GE( Exp.ToFloat(Exp.IntBin("quantity")), Exp.Val(1.0)));const exp = Aerospike.exp
const filterExp = exp.ge(exp.toFloat(exp.binInt('quantity')), exp.float(1.0))to_int(value)Creates an expression that converts a floating-point value to an integer value. The argument must be a float_expr.
| Name | Type |
|---|---|
value | float_expr |
integer_value Find records where to_int of float bin list_price equals 12 (aligned with whole-dollar list prices in path docs).
Expression exp = Exp.build( Exp.eq( Exp.toInt(Exp.floatBin("list_price")), Exp.val(12)));from aerospike_helpers.expressions import Eq, FloatBin, ToInt
exp = Eq(ToInt(FloatBin("list_price")), 12).compile()as_exp_build(predexp, as_exp_cmp_eq( as_exp_to_int(as_exp_bin_float("list_price")), as_exp_int(12)));// Import path matches the Go client examples elsewhere on this doc site (/v6).// If you use the latest client line, switch to .../aerospike-client-go/v8 (API names unchanged).// Requires: import as "github.com/aerospike/aerospike-client-go/v6"exp := as.ExpEq( as.ExpToInt(as.ExpFloatBin("list_price")), as.ExpIntVal(12))Expression exp = Exp.Build( Exp.EQ( Exp.ToInt(Exp.FloatBin("list_price")), Exp.Val(12)));const exp = Aerospike.exp
const filterExp = exp.eq(exp.toInt(exp.binFloat('list_price')), exp.int(12))