Available Functions

Odysseus provides a wide range of functions to be used in a Map, Select, or Join operator.

Mathematical Functions

Cos(X)

Returns the trigonometric cosine of an angle

ACos(X)

Returns the arc cosine of a value

Cosh(X)

Returns the hyperbolic cosine of a double value

Sin(X)

Returns the trigonometric sine of an angle

ASin(X)

Returns the arc sine of a value

Sinh(X)

Returns the hyperbolic sine of a double value

Tan(X)

Returns the trigonometric tangent of an angle

ATan(X)

Returns the arc tangent of a value

ATan2(Y,X)

Returns the angle theta from the conversion of rectangular coordinates (x, y) to polar coordinates (r, theta)

Tanh(X)

Returns the hyperbolic tangent of a double value

Abs(X)

Returns the absolute value of a value

Sign(X)

Returns the signum function of the argument

Sqrt(X)

Returns the square root of a value

Ceil(X)

Returns the smallest value that is greater than or equal to the argument and is equal to a mathematical integer.

Floor(X)

Returns the largest value that is less than or equal to the argument and is equal to a mathematical integer.

Round(X)

Returns the closest number to the argument, with ties rounding up

Log(X)

Returns the natural logarithm (base e) of a double value

Exp(X)

Returns Euler's number e raised to the power of a double value

PI()

Returns the double value that is closer than any other to pi.

E()

Returns the double value that is closer than any other to e

ToRadians(X)

Converts an angle measured in degrees to an equivalent angle measured in radians.

ToDegrees(X)

Converts an angle measured in radians to an equivalent angle measured in degrees.

String Functions

There also exist algebraic operators (+,  -, *, /) to perform string concatenation and deletion.

Concat(String, String)

Returns a new string that is a concatenating the arguments.

SubString(String, Begin, End)

Returns a new string that is a substring of the value with given begin and end index

Length(String)

Returns the length of a string.

Upper(String)

Returns the string converted to uppercase.

Lower(String)

Returns the string converted to lowercase.

Date Functions

Year(<Date>|<String,Pattern>)

Extracts the year part of the date

SELECT YEAR("12/24/13 5:30:10","M/d/y h:m:s") FROM Stream
=> 2013

 

Month(<Date>|<String,Pattern>)

Extracts the month part of the date

SELECT MONTH("12/24/13 5:30:10","M/d/y h:m:s") FROM Stream
=> 12

 

Week(<Date>|<String,Pattern>)

Returns the week number of the date

SELECT WEEK("12/24/13 5:30:10","M/d/y h:m:s") FROM Stream
=> 52

 

Day(<Date>|<String,Pattern>)

Extracts the day part of the date

SELECT DAY("12/24/13 5:30:10","M/d/y h:m:s") FROM Stream
=> 24

 

Hour(<Date>|<String,Pattern>)

Returns the hour of the date

SELECT HOUR("12/24/13 5:30:10","M/d/y h:m:s") FROM Stream
=> 5

 

Minute(<Date>|<String,Pattern>)

Returns the minute of the date

SELECT MINUTE("12/24/13 5:30:10","M/d/y h:m:s") FROM Stream
=> 30

 

Second(<Date>|<String,Pattern>)

Returns the second of the date

SELECT SECOND("12/24/13 5:30:10","M/d/y h:m:s") FROM Stream
=> 10

 

WeekDay(<Date>|<String,Pattern>)

Returns the week day index of the date (1 = Sunday, 2 = Monday, ..., 7 = Saturday)

SELECT WEEKDAY("12/24/13 5:30:10","M/d/y h:m:s") FROM Stream
=> 3

 

DayOfMonth(<Date>|<String,Pattern>)

Synonym for day().

SELECT DAYOFMONTH("12/24/13 5:30:10","M/d/y h:m:s") FROM Stream
=> 24

 

CurDate()

Return the current system time specific date

Now()

Returns the difference, measured in milliseconds, between the current time and midnight, January 1, 1970 UTC

NanoTime()

Returns the current value of the time source, in nanoseconds.

SysDate()

Returns the current system time specific date

StreamDate()

Returns the current stream time specific date

Datatype Functions

DoubleToByte(Double)

Converts the given double value to a byte value

DoubleToShort(Double)

Converts the given double value to a short value

DoubleToInteger(Double)

Converts the given double value to a integer value

DoubleToFloat(Double)

Converts the given double value to a float value

DoubleToLong(Double)

Converts the given double value to a long value

ToBoolean(X)

Converts the given value to a boolean value.

ToByte(X)

Converts the given value to a byte value. This function converts any value to a byte value, thus it is more time consuming than the DoubleToByte function for double values.

ToShort(X)

Converts the given value to a short value. This function converts any value to a short value, thus it is more time consuming than the DoubleToShort function for double values.

ToInteger(X)

Converts the given value to a integer value. This function converts any value to a integer value, thus it is more time consuming than the DoubleToInteger function for double values.

ToFloat(X)

Converts the given value to a float value. This function converts any value to a float value, thus it is more time consuming than the DoubleToFloat function for double values.

ToDouble(X)

Converts the given value to a double value.

ToLong(X)

Converts the given value to a long value. This function converts any value to a long value, thus it is more time consuming than the DoubleToLong function for double values.

ToDate(X, [format])

Converts the given value to a date value. The format parameter is necessary if the first parameter is a string value.

ToString(X)

Converts the given value to a string value.

Encryption Functions

MD5(String)

Calculates an MD5 checksum for the string.

SHA1(String)

Calculates an SHA-1 checksum for the string.

SHA256(String)

Calculates an SHA-265 checksum for the string.

SHA384(String)

Calculates an SHA-384 checksum for the string.

SHA512(String)

Calculates an SHA-512 checksum for the string.

DSA(Size)

Generates a DSA key pair

RSA(Size)

Generates a RSA key pair

RSASign(Object, Private Key)

Computes a signature for the given object

RSAVerify(Object, Signature, Public Key)

Verifies the signature for the given object

Miscellaneous Functions

UUID()

Returns a Universal Unique Identifier (UUID).

Eval(String)

Evaluates arbitrary expressions.

Sleep(Integer)

Causes the currently executing operator to sleep for the specified number of milliseconds.

Optional Functions

The following MEP functions are not part of the Odysseus Core and may be restricted.

Matrix Functions (Matrix Feature)

The matrix feature provides arbitrary functions to work with matrices in a data stream. Further this feature provides algebraic operator (+, *, -, ^) to perform matrix addition, subtraction, multiplication, and exponentiation.

SELECT [1.0,2.0,3.0;4.0,5.0,6.0]+[1.0,2.0,3.0;4.0,5.0,6.0] FROM stream
SELECT [1.0,2.0,3.0;4.0,5.0,6.0]-[1.0,2.0,3.0;4.0,5.0,6.0] FROM stream
SELECT [1.0,2.0,3.0;4.0,5.0,6.0]*[1.0,2.0,3.0;4.0,5.0,6.0] FROM stream
SELECT [1.0,2.0,3.0;4.0,5.0,6.0]^3 FROM stream

Tr(Matrix)

Computes the trace of the matrix

Det(Matrix)

Computes the determinant of the given matrix

Inv(Matrix)

Computes the inverse of the given matrix

Trans(Matrix)

Computes the transpose of the given matrix

Identity(dimension)

Creates a dimension x dimension identity matrix

sMin(Matrix|Vector)

Return the minimum element in the given matrix.

sMax(Matrix|Vector)

Returns the maximum element in the given matrix.

sCount(Matrix|Vector)

Counts all elements in the given matrix.

sSum(Matrix|Vector)

Computes the sum of all elements of the given matrix.

sAVG(Matrix|Vector)

Compute the average of all elements of the given matrix.

Interval Functions (Interval Feature)

The interval feature provides arbitrary functions to work with intervals in a data stream. Further this feature provides algebraic operator (+, *, -, /, ^) to perform interval addition, subtraction, multiplication, division, and exponentiation.

Union(Interval, Interval)

Computes the union of the two intervals

Difference(Interval, Interval)

Computes the difference of the two intervals

Intersection(Interval, Interval)

Computes the intersection of the two intervals

Text Functions (Text Feature)

Soundex(String)

Computes the Soundex value of the string.

ColognePhonetic(String)

Computes the Cologne Phonetic value of the string.

Metaphone(String)

Computes the Metaphone value of the string.

Levenstein(String, String)

Computes the Levenstein Distance of two strings.

Probabilistic Functions (Probabilistic Feature)

The probabilistic feature provides arbitrary functions to work with discrete and continuous probabilistic values in a data stream. Further this feature provides algebraic operator (+, *, -, /, ^) to perform probabilistic addition, subtraction, multiplication, division, and exponentiation.

SQRT(Probabilistic Value)

Computes the probabilistic square root of the given probabilistic value.

sMIn(Probabilistic Value, Probabilistic Value)

Computes the minimum of two probabilistic values.

sMax(Probabilistic Value, Probabilistic Value)

Computes the maximum of two probabilistic values.

ToProbabilisticDouble(Matrix)

Constructs a discrete probabilistic value using the first column of the given matrix for the values and the second column of the matrix for the probabilities for each value.

DoubleToShort(Probabilistic Value)

Converts the given probabilistic double value to a probabilistic short value

DoubleToByte(Probabilistic Value)

Converts the given probabilistic double value to a probabilistic byte value

DoubleToInteger(Probabilistic Value)

Converts the given probabilistic double value to a probabilistic integer value

DoubleToFloat(Probabilistic Value)

Converts the given probabilistic double value to a probabilistic float value

DoubleToLong(Probabilistic Value)

Converts the given probabilistic double value to a probabilistic long value

Int(Distribution, Lower Limit, Upper Limit)

Estimates the multivariate normal distribution probability with lower and upper integration limit.

as2DVector(Object, Object)

Converts the two object into a 2D vector.

as3DVector(Object, Object, Object)

Similar to the as2DVector function, this function creates a 3D vector with the given objects.

Similarity(Distribution, Distribution)

Calculates the Bhattacharyya distance between two distributions.

SELECT similarity(as2DVector(x1,y1), as2DVector(x2,y2)) FROM stream

Distance(Distribution, Value)

Calculates the Mahalanobis distance between the distribution and the value. The value can be a scalar value or a vector.

SELECT distance(as3DVector(x, y, z), [1.0;2.0;3.0]) FROM stream

Spatial Functions (Spatial Feature)

The spatial functions are based upon the JTS Topology Suite (http://www.vividsolutions.com/jts/JTSHome.htm).

Notice, that JTS only considers x and y coordinate and ignores the z coordinate (although z can be definied)!

AsCartesianCoordinates(SpatialPolarCoordinate[])

Transform the list of spatial polar coordinates into a list of Cartesian coordinates

AsGeometry(Geometry)

AsGeometryCollection(Geometry)

AsLineString(Geometry)

AsMultiLineString(Geometry)

AsMultiPoint(Geometry)

AsMultiPolygon(Geometry)

AsPoint(Geometry)

AsPolarCoordinates()

FromWKT()

GetCentroid(Geometry)

Returns the centroid of the given geometry

SpatialBuffer(Geometry, Double)

Creates a buffer of the given size around the given geometry

SpatialContains(Geometry, Geometry)

Checks whether the first geometry contains the second geometry.

SpatialConvexHull(Geometry)

Computes the smallest convex spatial polygon that contains all the points in the geometry

SpatialCoveredBy(Geometry, Geometry)

SpatialCovers(Geometry, Geometry)

SpatialCrosses(Geometry, Geometry)

SpatialDisjoint(Geometry, Geometry)

SpatialEquals(Geometry, Geometry)

SpatialIntersection(Geometry, Geometry)

SpatialIsLine(Geometry)

SpatialIsPolygon(Geometry)

SpatialIsWithinDistance(Geometry, Double)

SpatialTouches(Geometry, Geometry)

SpatialUnion(Geometry, Geometry)

SpatialUnionBuffer(Geometry, Geometry, Geometry)

SpatialWithin(Geometry, Geometry)

ST_SetSRID(Geometry, Integer)

ST_Transform(Geometry, Integer)

ToCartesianCoordinate(SpatialPolarCoordinate)

Transforms the given spatial polar coordinate into a spatial Cartesian coordinate.

ToPolarCoordinate(SpatialCoordinate)

Transforms the given spatial Cartesian coordinate into a polar coordinate

Most function descriptions on this page are copied from the openjdk documentation.

Probabilistic Value, Probabilistic Value)