Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Published by Scroll Versions from space DEV and version next

D toc

D s transforms

Excerpt

...

The window

...

transform enables you to perform summations and calculations based on a rolling window of data relative to the current row.

...

For example, you can compute the rolling average for a specified column for the current row value and the three preceding rows. This transform is particularly useful for processing time or otherwise sequential data.

You can apply one or more functions to your your window transform transform step. 

Info

NOTE: Be careful applying this transform across a large number of rows. In some cases, the application can run out of memory generating the results, and your results can fail.

...

D code
window value: ROLLINGAVERAGE(myValues,3) order: MyDate group: customerId

Output:  Generates a new column called,   window, which contains the result of the the ROLLINGAVERAGE function function applied from the current row in the the myValues column column across the the 3 rows rows forward, ordered by by MyDate and and grouped by by customerId. 

D s
snippetParameters

D code

window value: WINDOW_FUNCTION(arg1,arg2) order: order_col [group: group_col]

TokenRequired?Data TypeDescription
windowYtransformName of the transform
valueYstringExpression that evaluates to the window function call and its parameters
orderYstringColumn or column names by which to sort the dataset before the value expression is applied
groupNstringColumn name or names containing the values by which to group for calculation

D s lang notes

value

For the the window transform, the the value parameter contains the function call or calls, which define the set of rows to which the function is applied.

...

This transform uses a special set of functions.  For more information on the available functions,  see   Window Functions.

D s
snippetusage

Required?Data Type
YesString (expression)

...

For the window transform, this parameter specifies parameter specifies the column on which to sort the dataset before applying the specified function. For combination sort keys, you can add multiple comma-separated columns.

...

Required?Data Type
YesString (column name)

group

For the window transform transform,  this this parameter specifies the column whose values are used to group the dataset prior to applying the specified function. For combination grouping, you can specify multiple comma-separated column names.

Info

NOTE: Be careful applying this transform across groups containing a large number of rows. In some cases, the application can run out of memory generating the results, and your results can fail.

D s ordering


D s
snippetusage

Required?Data Type
NoString (column name)

...

See the individual functions for examples.   See See Window Functions.

D s also
labelwrangle_transform_window

...