Column Expressions

A column expression produces a result based on the value of input columns, the relationship of column values to each other, or the computed formulas. It may include built-in or user-defined functions, constants, parameters, or variables.

Simple Expressions

A simple CCL expression specifies a constant, NULL, or a column. A constant can be a number or a text string. The literal NULL denotes a null value. NULL is never part of another expression, but NULL by itself is an expression.

You can specify a column name by itself or with the name of its stream or window. To specify both the column and the stream or window, use the format "stream_name.column_name."

Some valid simple expressions include:
  • stocks.volume
  • 'this is a string'
  • 26

Compound Expressions

A compound CCL expression is a combination of simple or compound expressions. Compound expressions can include operators and functions, as well as the simple CCL expressions (constants, columns, or NULL).

You can use parentheses to change the order of precedence of the expression's components.

Some valid compound expressions include:
  • sqrt (9) + 1
  • ('example' + 'test' + 'string')
  • ( length ('example') *10 ) + pi()

Column Alias in Expressions

Each expression defines a unique name or alias for the column.

In the PortfolioValuation example, a derived window called VWAP takes input from an input stream (PriceFeed) with columns Symbol, Price and TradeTime, and it includes an aggregate expression. Columns aliases for this derived window (created in Visual editor as an aggregate simple query) are:
Alias Column Expression
Symbol PriceFeed.Symbol
LastPrice PriceFeed.Price
VWAP ( sum ( ( PriceFeed.Price * CAST ( FLOAT , PriceFeed.Shares ) ) ) / CAST ( float , sum ( PriceFeed.Shares ) ) )
LastTime PriceFeed.TradeTime

Datatypes in Expressions

Datatypes for column expressions are inherited from the schema, either an explicitly created inline schema, or one discovered from the input adapter. You choose from supported datatypes in the schema editor, not in the column expression editor.

Enclose string data in expressions in single quotes, for example, 'my_string_data'.

Case Sensitivity

Related concepts
CCL Functions
Related tasks
Editing Column Expressions for Windows, Streams, and Delta Streams
Related reference
Operators