Expressions

NebulaStream supports use-provided expressions, which can be used in map and filter operators. These expressions allow the access and the modification of individual record attributes. Furthermore, expressions are evaluated in a tuple-at-a-time fashion.

Attribute Accesses

Records in a data stream always follow a specific schema, which defines a set of record attributes. The attribute access expression allows access to a specific attribute by name.

// Accesses a record attribute by its name.
Attribute("attributeName")
// Accesses a record attribute by its name.
Attribute("attributeName")

Attribute Assignment

The attribute assignment expression enables the modification of individual attributes, e.g., in a map operator. To this end, the expression assigns a result value of an expression to already existing attributes or creates new attributes. If the attribute already exists, the result data types of the expression has to be compatible with the attribute data type. If the attribute dose not exists, NebulaStream infers the data type by the expression and adds the new attribute with a sutable data type to the schema. 💡 Currently, NebulaStream only supports the modification of single attributes at a time.

// Inteduces a new attribute Y and assignes the value of attribute X
Attribute("Y") = Attribute("X")
// Motifies the value of attribute X
Attribute("X") = Attribute("X") * 2
// Inteduces a new attribute Y and assignes the value of attribute X
Attribute("Y") = Attribute("X")

Logical Expressions

NebulaStream supports a set of common logical expressions to compare individual attributes. This is mainly used by the filter operator. In general, logical expressions evaluate to boolean values, i.e., either true or false.

And

Binary expression that performs a logical and between two boolean values or expressions.

Bool AND Bool –> Bool.

Attribute("fieldX") && Attribute("fieldY")
Predicate.Attribute("fieldX").and(Predicate.Attribute("fieldY"))

Or

Binary expression that performs a logical or between two boolean expressions.

Bool OR Bool –> Bool.

Attribute("fieldX") || Attribute("fieldY")
Predicate.Attribute("fieldX").or(Predicate.Attribute("fieldY"))

Equals

Binary expression that compares two expressions and returns true if both values are equal. 💡 Both expressions have to be defined in a compatible data type.

X EQUALS Y –> Bool.

Attribute("fieldX") == Attribute("fieldY")
Predicate.Attribute("fieldX").equal(intValue)

Not Equals

Binary expression that compares two expressions and returns true if both values are not equal. 💡 Both expressions have to be defined in a compatible data type.

X NOT EQUALS Y –> Bool.

Attribute("fieldX") != Attribute("fieldY")
currently not supported

Less Equals

Binary expression that compares two expressions and returns true if the value of the left expression is less or equal to the value of the right expression. 💡 This expression is currently only defined of integer and floating point data types.

X LESS EQUALS Y –> Bool.

Attribute("fieldX") <= Attribute("fieldY")
Predicate.Attribute("fieldX").lessThanOrEqual(intValue)

Greater Equals

Binary expression that compares two expressions and returns true if the value of the left expression is greater or equal to the value of the right expression. 💡 This expression is currently only defined of integer and floating point data types.

X GREATER EQUALS Y –> Bool.

Attribute("fieldX") >= Attribute("fieldY")
Predicate.Attribute("fieldX").greaterThanOrEqual(intValue)

Less Than

Binary expression that compares two expressions and returns true if the value of the left expression is less to the value of the right expression. 💡 This expression is currently only defined of integer and floating point data types.

X LESS Y –> Bool.

Attribute("fieldX") < Attribute("fieldY")
Predicate.Attribute("fieldX").lessThan(intValue)

Greater Than

Binary expression that compares two expressions and returns true if the value of the left expression is greater to the value of the right expression. 💡 This expression is currently only defined of integer and floating point data types.

X GREATER Y –> Bool.

Attribute("fieldX") > Attribute("fieldY")
Predicate.Attribute("fieldX").greaterThan(intValue)

Negate

Unary expression that negates the value of a boolean value. 💡 This expression is only supported on attributes or expressions that return a boolean value.

NEGATE Bool –> Bool.

// Negates a boolean attribute
!Attribute("boolAttribute")

// Negates the result of a logical expression
!(Attribute("fieldX") == Attribute("fieldY"))
currently not supported

Arithmetical Expressions

NebulaStream supports a set of common binary arithmetical expression, i.e., ADDITON, SUBSTRACTION, MULTIPLICATION, DIVISON, MODULO. 💡 These expressions are only supported on numeric types, i.e., integer and floating point data types.

Numeric EXPRESSION Numeric –> Numeric.

Attribute("attributeX") + Attribute("attributeY")
Attribute("attributeX") - Attribute("attributeY")
Attribute("attributeX") * Attribute("attributeY")
Attribute("attributeX") / Attribute("attributeY")
Attribute("attributeX") % Attribute("attributeY")
Expression.add("attributeX", "attributeY")
Expression.substract("attributeX", "attributeY")
Expression.multiply("attributeX", "attributeY")
Expression.divide("attributeX", "attributeY")

Functions

NebulaStream supports different functions to express special purpose operations.

Mod

The MOD function is an alias for the MODULO operator.

MOD(Numeric,Numeric) –> Numeric.

MOD(Attribute("attributeX"), Attribute("attributeY"))
currently not supported

Power

POWER(Numeric,Numeric) –> Numeric.

POWER(Attribute("attributeX"), Attribute("attributeY"))
currently not supported

Absolut

Calculates the absolute value from a numeric expression or value.

ABS(Numeric) –> Numeric.

ABS(Attribute("attributeX"))
currently not supported

Square Root

Calculates the square root value from an numeric expression or value.

SQRT(Numeric) –> Numeric.

SQRT(Attribute("attributeX"))
currently not supported

Exponential Function

EXP(Numeric) –> Numeric.

EXP(Attribute("attributeX"))
currently not supported

Logarithmic Functions

NebulaStream supports the common logarithmic function to the base n and 10.

LOGN(Numeric) –> Numeric.

LOGN(Attribute("attributeX"))
currently not supported

LOG10(Numeric) –> Numeric.

LOG10(Attribute("attributeX"))
currently not supported

Rounding

NebulaStream supports three types of rounding for numeric values, i.e., ROUND, CEIL, and FLOOR.

Round

Computes the nearest integer value to the given attribute or expression (in floating-point format), rounding halfway cases away from zero, regardless of the current rounding mode.

ROUND(Numeric) –> Numeric.

ROUND(Attribute("attributeX"))
currently not supported

Ceil

Computes the smallest integer value not less than the given attribute or expression.

CEIL(Numeric) –> Numeric.

ROUND(Attribute("attributeX"))
currently not supported

Floor

) Computes the largest integer value not greater than the given attribute or expression.

FLOOR(Numeric) –> Numeric.

ROUND(Attribute("attributeX"))
currently not supported