Package com.aerospike.client.query
Class PredExp
java.lang.Object
com.aerospike.client.query.PredExp
- All Implemented Interfaces:
Serializable
public abstract class PredExp extends Object implements Serializable
Predicate expression filter.
Predicate expression filters are applied on the query results on the server.
Predicate expression filters may occur on any bin in the record.
- See Also:
- Serialized Form
-
Constructor Summary
Constructors Constructor Description PredExp()
-
Method Summary
Modifier and Type Method Description static PredExp
and(int nexp)
Create "and" expression.abstract int
estimateSize()
Estimate size of predicate expression.static int
estimateSize(PredExp[] predExp)
Estimate size of predicate expressions.static PredExp
geoJSONBin(String name)
Create geospatial bin predicate.static PredExp
geoJSONContains()
Create geospatial json "contains" predicate.static PredExp
geoJSONValue(String val)
Create geospatial json string value.static PredExp
geoJSONVar(String name)
Create geospatial json string variable used in list/map iterations.static PredExp
geoJSONWithin()
Create geospatial json "within" predicate.static PredExp
integerBin(String name)
Create 64 bit integer bin predicate.static PredExp
integerEqual()
Create 64 bit integer "=" operation predicate.static PredExp
integerGreater()
Create 64 bit integer ">" operation predicate.static PredExp
integerGreaterEq()
Create 64 bit integer ">=" operation predicate.static PredExp
integerLess()
Create 64 bit integer "<" operation predicate.static PredExp
integerLessEq()
Create 64 bit integer "<=" operation predicate.static PredExp
integerUnequal()
Create 64 bit integer "!=" operation predicate.static PredExp
integerValue(long val)
Create 64 bit integer value.static PredExp
integerValue(Calendar val)
Create Calendar value expressed in nanoseconds since 1970-01-01 epoch as 64 bit integer.static PredExp
integerVar(String name)
Create 64 bit integer variable used in list/map iterations.static PredExp
listBin(String name)
Create list bin predicate.static PredExp
listIterateAnd(String varName)
Create list predicate where expression matches for all list items.static PredExp
listIterateOr(String varName)
Create list predicate where expression matches for any list item.static PredExp
mapBin(String name)
Create map bin predicate.static PredExp
mapKeyIterateAnd(String varName)
Create map key predicate where expression matches for all map keys.static PredExp
mapKeyIterateOr(String varName)
Create map predicate where expression matches for any map key.static PredExp
mapValIterateAnd(String varName)
Create map predicate where expression matches for all map values.static PredExp
mapValIterateOr(String varName)
Create map predicate where expression matches for any map value.static PredExp
not()
Create "not" expression.static PredExp
or(int nexp)
Create "or" expression.static PredExp
recDeviceSize()
Create record size on disk predicate.static PredExp
recDigestModulo(int mod)
Create a digest modulo record metadata value predicate expression.static PredExp
recLastUpdate()
Create record last update time predicate expressed in nanoseconds since 1970-01-01 epoch as 64 bit integer.static PredExp
recVoidTime()
Create record expiration time predicate expressed in nanoseconds since 1970-01-01 epoch as 64 bit integer.static PredExp
stringBin(String name)
Create string bin predicate.static PredExp
stringEqual()
Create string "=" operation predicate.static PredExp
stringRegex(int flags)
Create regular expression string operation predicate.static PredExp
stringUnequal()
Create string "!=" operation predicate.static PredExp
stringValue(String val)
Create string value.static PredExp
stringVar(String name)
Create string variable used in list/map iterations.abstract int
write(byte[] buf, int offset)
Write predicate expression to write protocol.static int
write(PredExp[] predExp, byte[] buf, int offset)
Write predicate expressions to write protocol.
-
Constructor Details
-
PredExp
public PredExp()
-
-
Method Details
-
and
Create "and" expression.- Parameters:
nexp
- number of expressions to perform "and" operation. Usually two.
-
or
Create "or" expression.- Parameters:
nexp
- number of expressions to perform "or" operation. Usually two.
-
not
Create "not" expression. -
integerValue
Create Calendar value expressed in nanoseconds since 1970-01-01 epoch as 64 bit integer. -
integerValue
Create 64 bit integer value. -
stringValue
Create string value. -
geoJSONValue
Create geospatial json string value. -
integerBin
Create 64 bit integer bin predicate. -
stringBin
Create string bin predicate. -
geoJSONBin
Create geospatial bin predicate. -
listBin
Create list bin predicate. -
mapBin
Create map bin predicate. -
integerVar
Create 64 bit integer variable used in list/map iterations. -
stringVar
Create string variable used in list/map iterations. -
geoJSONVar
Create geospatial json string variable used in list/map iterations. -
recDeviceSize
Create record size on disk predicate. -
recLastUpdate
Create record last update time predicate expressed in nanoseconds since 1970-01-01 epoch as 64 bit integer. Example:// Record last update time >= 2017-01-15 PredExp.recLastUpdate() PredExp.integerValue(new GregorianCalendar(2017, 0, 15)) PredExp.integerGreaterEq()
-
recVoidTime
Create record expiration time predicate expressed in nanoseconds since 1970-01-01 epoch as 64 bit integer. Example:// Record expires on 2020-01-01 PredExp.recVoidTime() PredExp.integerValue(new GregorianCalendar(2020, 0, 1)) PredExp.integerGreaterEq() PredExp.recVoidTime() PredExp.integerValue(new GregorianCalendar(2020, 0, 2)) PredExp.integerLess() PredExp.and(2)
-
recDigestModulo
Create a digest modulo record metadata value predicate expression. The digest modulo expression assumes the value of 4 bytes of the record's key digest modulo it's argument.For example, the following sequence of predicate expressions selects records that have digest(key) % 3 == 1):
PredExp.recDigestModulo(3) PredExp.integerValue(1) PredExp.integerEqual()
-
integerEqual
Create 64 bit integer "=" operation predicate. -
integerUnequal
Create 64 bit integer "!=" operation predicate. -
integerGreater
Create 64 bit integer ">" operation predicate. -
integerGreaterEq
Create 64 bit integer ">=" operation predicate. -
integerLess
Create 64 bit integer "<" operation predicate. -
integerLessEq
Create 64 bit integer "<=" operation predicate. -
stringEqual
Create string "=" operation predicate. -
stringUnequal
Create string "!=" operation predicate. -
stringRegex
Create regular expression string operation predicate. Example:PredExp.stringRegex(RegexFlag.EXTENDED | RegexFlag.ICASE)
- Parameters:
flags
- regular expression bit flags. SeeRegexFlag
-
geoJSONWithin
Create geospatial json "within" predicate. -
geoJSONContains
Create geospatial json "contains" predicate. -
listIterateOr
Create list predicate where expression matches for any list item. Example:// Find records where any list item v = "hello" in list bin x. PredExp.stringVar("v") PredExp.stringValue("hello") PredExp.stringEqual() PredExp.listBin("x") PredExp.listIterateOr("v")
-
listIterateAnd
Create list predicate where expression matches for all list items. Example:// Find records where all list elements v != "goodbye" in list bin x. PredExp.stringVar("v") PredExp.stringValue("goodbye") PredExp.stringUnequal() PredExp.listBin("x") PredExp.listIterateAnd("v")
-
mapKeyIterateOr
Create map predicate where expression matches for any map key. Example:// Find records where any map key k = 7 in map bin m. PredExp.integerVar("k") PredExp.integerValue(7) PredExp.integerEqual() PredExp.mapBin("m") PredExp.mapKeyIterateOr("k")
-
mapKeyIterateAnd
Create map key predicate where expression matches for all map keys. Example:// Find records where all map keys k < 5 in map bin m. PredExp.integerVar("k") PredExp.integerValue(5) PredExp.integerLess() PredExp.mapBin("m") PredExp.mapKeyIterateAnd("k")
-
mapValIterateOr
Create map predicate where expression matches for any map value.// Find records where any map value v > 100 in map bin m. PredExp.integerVar("v") PredExp.integerValue(100) PredExp.integerGreater() PredExp.mapBin("m") PredExp.mapValIterateOr("v")
-
mapValIterateAnd
Create map predicate where expression matches for all map values. Example:// Find records where all map values v > 500 in map bin m. PredExp.integerVar("v") PredExp.integerValue(500) PredExp.integerGreater() PredExp.mapBin("m") PredExp.mapValIterateAnd("v")
-
estimateSize
Estimate size of predicate expressions. For internal use only. -
write
Write predicate expressions to write protocol. For internal use only. -
estimateSize
public abstract int estimateSize()Estimate size of predicate expression. For internal use only. -
write
public abstract int write(byte[] buf, int offset)Write predicate expression to write protocol. For internal use only.
-