Rollup transform allows you to apply aggregate functions on the attributes in the transform connected to it. You can specify what group by attributes should be used to perform the aggregation. The group by attributes along with the aggregate attributes will be the output of the transform. 

To work with Rollup transform in data flow, follow below steps:

Note:

Selecting the Rollup transform to be added to data flow

In the data flow canvas move to Data Flow pane and navigate to Transforms menu. Here, you can either select or drag and drop the Rollup transform to canvas. Then, link the required transform to the Rollup transform.

Configuring Rollup transform

General Tab: Provide the basic details for the Rollup transform.

1.The Name field auto populates the transform name and its editable.

2. In the Description text-box, provide a description and is optional.

3. By default, Diyotta does not create temporary tables during execution for the transformation in the data flow. If the temporary table needs to be created for a transform during execution, then, enable the checkbox Persist Data. The temporary table created will be dropped once the data flow executes successfully.

Properties tab: The properties tab allows you to define Having Condition in the SQL generated for the rollup transform.

Having Condition: 

Provide the condition based on which the output of the rollup transform should be restricted. The condition specified is added to the having Condition of the SQL generated for the transform.

  • To add a filter condition, click Expression Editor icon beside the Having Condition field.
  • The Expression Editor window opens and you can define the having Condition here.
  • After applying the condition, to verify that there are no syntax errors, click Validate. Upon successful validation success message appears. Once done, click OK.

The Rollup condition defined can include attributes from the linked transform, hive database functions, Parameters, Functions, UDFs, and Reusable expressions.

  • The attributes from the transform will be listed when selecting Transforms from the drop-down. Click on the attribute from the list and it will be added in the editor. These transforms are the once that are linked to the Rollup transform starting from the source instance transform.
  • The list of functions can be seen by selecting Functions from the drop down. The functions that can be used in the SQL is not limited by the list shown. All the hive database functions can be used in the SQL.
  • The list of parameters can be seen by selecting Parameters from the drop-down. It will show those that can be used in data flow - Data Flow Parameter, Data Flow SQL Parameter, Project Parameter and System Parameter can be used in the SQL. For more information, refer Working with Data Flow Parameters, Working with Data Flow SQL Parameters, Working with Project Parameters, Diyotta System Parameters.
  • List of expressions, UDFs, and sequences can be seen under corresponding header in drop-down.

Select Attributes tab: Provide the attributes that should be used to perform the group by operation. The attributes added here will be used in group by condition of the SQL generated for the transform.

Adding new attributes:

  • When there are no attributes present, then click on Click Here to add new attribute.

  • Then Select Link Attributes wizard appears and displays the list of attributes available in the transforms connected to Rollup. Choose required attributes and click OK.

  • The selected attribute(s) gets listed in the Select attributes tab. 

You can modify the Alias name against the attributes added. For this, click on the Alias name field against the required attribute and provide the required text.

The Type option allows you to select whether it's Aggregate type or Group Type and upon selecting the Type as Aggregate in addition you can also select the Function (Average, count, Sum, Min, or Max) which can be applied on selected attribute.

  • When there attributes already present, then click on Select(+) to select new attribute.

  • Then Select Attributes wizard appears and displays the list of attributes available in the transforms connected to Rollup. Choose required attributes and click OK.

Note: The attributes already selected from transform are Italicized.
  • The added attributes get listed in the Select Attributes tab

Note:

  • The fields in the Select Attributes tab are specific to the data object type associated with the transform. For more information about these fields, refer Working with Data Object and select the specific database data object same as native processing platform.
  • Following operations are allowed on the attributes: Select, Unlink, Auto Map, Delete, Up, Down, and search.
  • To search for a specific attribute, enter the keyword in the search bar, and the grid displays the search results.
  • From the list of attributes, multiple attributes can be selected and we can perform/apply these operations.

Modifying the Attributes:

  • To modify the attribute, you can unlink the attribute selected from the connected transform and select a different attribute. For this, select the attribute, and click Unlink Attribute(s) icon.

  • After unlinking the attribute you need to add the new attribute from the connected transform. For this you can either auto map or manually add the required attributes.

Auto mapping: You can automatically map all the attributes by selecting the Auto Map icon. All the Alias Names are mapped by matching the name of the attribute in the linked transforms. If there are no attributes that match the Alias name then, the select column corresponding to it will remain blank. This will have to be mapped manually.

Manual mapping: You can manually map the attributes to the Alias Name by selecting it from the Select Column drop down against the specific attribute. The list will display all the attributes that can be mapped.

Derived Attributes tab: You can add the aggregation to be performed as part of the Rollup transform over here. These attributes along with the Select attributes will be the output from the transform.

Note: The fields displayed in the attribute are specific to database type of the data object. For information on fields of specific type of data object, refer Working with Data Object.

Below are different options to add new attributes under Derived Attributes tab.

Option I: Adding new attribute

  • When there are no attributes present, then click on Click Here to add new attribute.

  • New entry gets added in Derived Attributes tab.

  • When there are attributes already present, then click on +(Add) to add new attribute.

Option II: Pasting attributes copied from another transform

You can paste attributes copied from another Rollup transform here.

  • When there are no attributes present, then click on the drop down on Click Here to see the paste option. Click on the Paste to paste the copied attributes. 

  • The copied attributes are pasted as shown below:

  • When there are attributes already present, then click on Paste.

Note:

  • The fields in the Derived Attributes tab are specific to the data object type associated with the transform. For more information about these fields, refer Working with Data Object and select the specific database data object same as native processing platform.
  • Following operations are allowed on the attributes: Add, Select, Cut, Copy, Paste, Up, Down, Delete, Search, and Apply template.
  • From the list of attributes, multiple attributes can be selected and we can perform/apply these operations.

After adding attributes, you can add/edit associated expression in Expression Editor field.

  • To add/edit the expression, click the icon beside the Expression Editor field.

  • The Expression Editor wizard appears and it allows you to add the required expression. To verify that there are no syntax errors, click Validate.

  • Upon successful validation, the success message appears and click OK.

The expression can include attributes from the transform, database functions, Parameters, Functions, Reusable expressions, UDFs and Sequences.

  • The attributes from the transform will be listed when selecting Transforms from the drop-down. Click on the attribute from the list and it will be added in the editor.
  • The list of functions can be seen by selecting Functions from the drop down. The functions that can be used in the SQL is not limited by the list shown. All the hive database functions can be used in the SQL.
  • The list of parameters can be seen by selecting Parameters from the drop-down. It will show those that can be used in data flow - Data Flow Parameter, Data Flow SQL Parameter, Project Parameter and System Parameter can be used in the SQL. For more information, refer Working with Data Flow Parameters, Working with Data Flow SQL Parameters, Working with Project Parameters, Diyotta System Parameters.
  • List of expressions, UDFs, and sequences can be seen under corresponding header in drop-down.
  • The Expression field displays the added/edited condition as shown below:

You can use Apply Template option to apply the expression from one attribute to other attributes in the list. You can either apply expression from existing attribute or apply new condition to existing Attributes. As an example, here we are applying function Count( ) to multiple attributes.

  • From the list of attributes, select an attribute which has the expression to be applied, and click Apply template icon.
  • You can also select any attribute and change the expression to be applied in subsequent steps.

  • Apply Template wizard displays the derived attribute name along with expression. From the list of attributes, select the attributes to apply the expression.
  • In the expression field, you can edit the expression before applying other attributes. If edited, then you can valid this expression by clicking Validate. The success or failure message appears on the bottom of the window.

  • Click Apply, to apply the condition to the selected attributes. 
  • After applying the condition, validate it by clicking the Validate button at the bottom. The success or failure message appears on the bottom of the window. 
  • Click OK, to complete the changes.

Runtime Properties tab:

The runtime properties are displayed only when the native data point type for data flow is Hadoop or Spark.

To change the Rollup Transform runtime properties, click Runtime Properties tab.

By default these properties are set to recommended/default values from data point and the values can be overridden here. To work with runtime properties, refer Editing Runtime Properties in Hadoop Data Point.

Note:

  • To revert the changes to the default values, click Reset All to Default.
  • To search for a specific property, enter the keyword in the search bar, and the grid displays the related properties.

Viewing the Script generated for the transform

The Script tab allows you to view the SQL generated for the transform. The script is generated based on the configuration of the transformation.

  • To view the generated script, navigate to Script tab.