User Defined Transform (UDX)

A user-defined transform is a user-defined function that returns a set of rows or a stream of rows. Its input arguments can be scalars or cursors. A cursor is an object representing a query, which the user-defined transform can use to read the query results. The query can be finite / relational or streaming. SQLstream allows the creation of C++, Java or SQL transforms.

For more information see Writing a UDX.

The following describes the differences between user-defined functions, procedures, and transforms:

User-Defined Function (UDF)

A UDF is used in a scalar expression; it takes (0 .. n) scalar arguments and returns a scalar value. When used in a query, a scalar expression is evaluated for each row.

  • Inputs: Zero or more parameters
  • Returns: A single scalar value

User-Defined Procedure (UDP)

A UDP is just a UDF that returns no value; it is evaluated for a side effect.

  • Inputs: Zero or more parameters
  • Returns: No values are returned

User-Defined Transform (UDX)

A [UDX](/glossary/userdefinedtransform] is different: its output is a stream (or table) of rows, and its inputs can either be scalars, streams or tables. In SQL, a streaming argument to a UDX is represented as CURSOR(SELECT STREAM ... FROM ...) and a scalar is represented by any scalar expression.

The invocation of a UDX is quite often preceded by the keyword STREAM (for a streaming UDX) or TABLE (for a finite UDX). For example:

  filterSignal( CURSOR( SELECT STREAM * FROM "RawSignals")));