Skip to main content

List of Expressions

For an introduction to calculated fields, check out Working with Calculated Fields.

Aggregations

This list of expressions summarizes data by combining multiple values into a single value. This is great for providing insights and simplifying analysis.

  • Average

    Returns the average of the values in the column.

    Expression Syntax: avg(column) 

    Result data type: double

  • Count

    Returns the count of non-null rows (also known as records) in the selected data.

    Expression Syntax: count(column) 

    Result data type: bigint

  • Max

    Returns the largest value found in the column.

    Expression Syntax: max(column) 

    Result data type: [same as input]

  • Min

    Returns the smallest value found in the column.

    Expression Syntax: min(column) 

    Result data type: [same as input]

  • Sum Adds up all the values of the column.

    Expression Syntax: sum(column) 

    Result data type: [same as input]

Math functions

The following expressions are used to transform, manipulate, or summarize numerical data to extract insights and identify patterns for decision-making.

  • Absolute

    Returns the absolute (positive) value of the specified column.

    Expression Syntax: abs(column) 

    Result data type: [same as input]

  • Cube root

    Returns the cube root of the number.

    Expression Syntax: cbrt(column) 

    Result data type: double

  • Ceil

    Rounds a decimal up (ceil as in ceiling).

    Expression Syntax: ceil(column) 

    Result data type: [same as input]

  • Exponential

    Returns Euler's number, e, raised to the power of the supplied number.

    Expression Syntax: exp(column) 

    Result data type: double

  • Floor

    Rounds a decimal number down.

    Expression Syntax: floor(column) 

    Result data type: [same as input]

  • Ln

    Returns the natural logarithm of the number.

    Expression Syntax: ln(column) 

    Result data type: double

  • Log10

    Returns the base 10 log of the number.

    Expression Syntax: log10(column)

     Result data type: double

  • Round

    Rounds a decimal number either up or down to the nearest integer value.

    Expression Syntax: round(column) 

    Result data type: [same as input]

  • Signum

    Returns the signum function of the number.

    Expression Syntax: sign(column) 

    Result data type: [same as input]

String functions

The following expressions are used for interfacing with String data, enabling efficient manipulation and analysis of text values.

  • Length

    Returns the number of characters in a String.

    Expression Syntax: length(column) 

    Result data type: bigint

  • Reverse

    Returns a String with the characters in reverse order.

    Expression Syntax: reverse(column) 

    Result data type: varbinary

Data Type Introduction

Below is a table showcasing examples of popular data types commonly used in Wren AI, along with their descriptions and typical use cases.

Data TypeDefinitionExample
BOOLEANStores logical True or False dataTrue, False
BIGINTStores larger integer values, typically up to 64-bit9223372036854775807, -10000000000
DOUBLEStores floating-point numbers with double precision.3.14159, -0.00001,
INTStores Whole Numbers without fractions-5, 0, 123
FLOATStores fractional numbers-87.5, 0.0, 3.14159
DATEStores calendar dates without time information2024-08-26 ,
TIMESTAMPStores date and time information with high precision to seconds2024-08-26 14:23:05
STRINGStores a sequence of characters or textHello World, 12345, Blue
VARCHARStores variable-length character stringsUser123, ProductABC, Company098