Primeur Online Docs
Data Shaper
Data Shaper
  • 🚀GETTING STARTED
    • What is Primeur Data Shaper
      • What is the Data Shaper Designer
      • What is the Data Shaper Server
      • What is the Data Shaper Cluster
    • How does the Data Shaper Designer work
      • Designer Views and Graphs
      • Data Shaper Graphs
      • Designer Projects and Sandboxes
      • Data Shaper Designer Reference
    • How do the Data Shaper Server and Cluster work
      • Data Shaper Server and Cluster
      • Data Shaper Server Reference
    • VFS Graph Components
      • DataOneFileDescriptor (DOFD) metadata
      • Passing parameters from Data One Contract to Data Shaper graph
      • Inheriting Data One context attributes in Data Shaper graph
  • DATA SHAPER DESIGNER
    • Configuration
      • Runtime configuration
        • Logging
        • Master Password
        • User Classpath
      • Data Shaper Server Integration
      • Execution monitoring
      • Java configuration
      • Engine configuration
      • Refresh Operation
    • Designer User Interface
      • Graph Editor with Palette of Components
      • Project Explorer Pane
      • Outline Pane
      • Tabs Pane
      • Execution Tab
      • Keyboard Shortcuts
    • Projects
      • Creating Data Shaper projects
      • Converting Data Shaper projects
      • Structure of Data Shaper projects
      • Versioning of server project content
      • Working with Data Shaper Server Projects
      • Project configuration
    • Graphs
      • Creating an empty graph
      • Creating a simple graph
        • Placing Components
        • Placing Components from Palette
        • Connecting Components with Edges
    • Execution
      • Successful Graph Execution
      • Run configuration
      • Connecting to a running job
      • Graph states
    • Common dialogs
      • URL file dialog
      • Edit Value dialog
      • Open Type dialog
    • Import
      • Import Data Shaper projects
      • Import from Data Shaper server sandbox
      • Import graphs
      • Import metadata
    • Export
      • Export graphs to HTML
      • Export to Data Shaper Server sandbox
      • Export image
      • Export Project as Library
    • Graph tracking
      • Changing record count font size
    • Search functionality
    • Working with Data Shaper server
      • Data Shaper server project basic principles
      • Connecting via HTTP
      • Connecting via HTTPS
      • Connecting via Proxy Server
    • Graph components
      • Adding components
      • Finding components
      • Edit component dialog box
      • Enable/disable component
      • Passing data through disabled component
      • Common properties of components
      • Specific attribute types
      • Metadata templates
    • Edges
      • Connecting Components with Edges
      • Types of Edges
      • Assigning Metadata to Edges
      • Colors of Edges
      • Debugging Edges
      • Edge Memory Allocation
    • Metadata
      • Records and Fields
        • Record Types
        • Data Types in Metadata
        • Data Formats
        • Locale and Locale Sensitivity
        • Time Zone
        • Autofilling Functions
      • Metadata Types
        • Internal Metadata
        • External (Shared) Metadata
        • SQL Query Metadata
        • Reading Metadata from Special Sources
      • Auto-propagated Metadata
        • Sources of Auto-Propagated Metadata
        • Explicitly Propagated Metadata
        • Priorities of Metadata
        • Propagation of SQL Query Metadata
      • Creating Metadata
        • Extracting Metadata from a Flat File
        • Extracting Metadata from an XLS(X) File
        • Extracting Metadata from a Database
        • Extracting Metadata from a DBase File
        • Extracting Metadata from Salesforce
        • SQL Query Metadata
        • User Defined Metadata
      • Merging Existing Metadata
      • Creating Database Table from Metadata and Database Connection
      • Metadata Editor
        • Opening Metadata Editor
        • Basics of Metadata Editor
        • Record Pane
        • Field Name vs. Label vs. Description
        • Details Pane
      • Changing and Defining Delimiters
      • Editing Metadata in the Source Code
      • Multi-value Fields
        • Lists and Maps Support in Components
        • Joining on multivalue fields (Comparison Rules)
    • Connections
      • Database Connections
        • Internal Database Connections
        • External (Shared) Database Connections
        • Database Connections Properties
        • Encryption of Access Password
        • Browsing Database and Extracting Metadata from Database Tables
        • Windows Authentication on Microsoft SQL Server
        • Snowflake Connection
        • Hive Connection
        • Troubleshooting
      • JMS Connections
      • QuickBase Connections
      • Hadoop Connections
      • Kafka Connections
      • OAuth2 Connections
      • MongoDB Connections
      • Salesforce Connections
    • Lookup Tables
      • Lookup Tables in Cluster Environment
      • Internal Lookup Tables
      • External (Shared) Lookup Tables
      • Types of Lookup Tables
    • Sequences
      • Persistent Sequences
      • Non Persistent Sequences
      • Internal Sequences
      • External (Shared) Sequences
      • Editing a Sequence
      • Sequences in Cluster Environment
    • Parameters
      • Internal Parameters
      • External (Shared) Parameters
      • Secure Graph Parameters
      • Graph Parameter Editor
      • Secure Graph Parameters
      • Parameters with CTL2 Expressions (Dynamic Parameters)
      • Environment Variables
      • Canonicalizing File Paths
      • Using Parameters
    • Internal/External Graph Elements
    • Dictionary
      • Creating a Dictionary
      • Using a Dictionary in Graphs
    • Execution Properties
    • Notes in Graphs
      • Placing Notes into Graph
      • Resizing Notes
      • Editing Notes
      • Formatted Text
      • Links from Notes
      • Folding Notes
      • Notes Properties
    • Transformations
      • Defining Transformations
      • Transform Editor
      • Common Java Interfaces
    • Data Partitioning (Parallel Running)
    • Data Partitioning in Cluster
      • High Availability
      • Scalability
      • Graph Allocation Examples
      • Example of Distributed Execution
      • Remote Edges
    • Readers
      • Common Properties of Readers
      • ComplexDataReader
      • DatabaseReader
      • DataGenerator
      • DataOneVFSReader
      • EDIFACTReader
      • FlatFileReader
      • JSONExtract
      • JSONReader
      • LDAPReader
      • MultiLevelReader
      • SpreadsheetDataReader
      • UniversalDataReader
      • X12Reader
      • XMLExtract
      • XMLReader
      • XMLXPathReader
    • Writers
      • Common Properties of Writers
      • DatabaseWriter
      • DataOneVFSWriter
      • EDIFACTWriter
      • FlatFileWriter
      • JSONWriter
      • LDAPWriter
      • SpreadsheetDataWriter
      • HIDDEN StructuredDataWriter
      • HIDDEN TableauWriter
      • Trash
      • UniversalDataWriter
      • X12Writer
      • XMLWriter
    • Transformers
      • Common Properties of Transformers
      • Aggregate
      • Concatenate
      • DataIntersection
      • DataSampler
      • Dedup
      • Denormalizer
      • ExtSort
      • FastSort
      • Filter
      • Map
      • Merge
      • MetaPivot
      • Normalizer
      • Partition
      • Pivot
      • Rollup
      • SimpleCopy
      • SimpleGather
      • SortWithinGroups
      • XSLTransformer
    • Joiners
      • Common Properties of Joiners
      • Combine
      • CrossJoin
      • DBJoin
      • ExtHashJoin
      • ExtMergeJoin
      • LookupJoin
      • RelationalJoin
    • Others
      • Common Properties of Others
      • CheckForeignKey
      • DBExecute
      • HTTPConnector
      • LookupTableReaderWriter
      • WebServiceClient
    • CTL2 - Data Shaper Transformation Language
    • Language Reference
      • Program Structure
      • Comments
      • Import
      • Data Types in CTL2
      • Literals
      • Variables
      • Dictionary in CTL2
      • Operators
      • Simple Statement and Block of Statements
      • Control Statements
      • Error Handling
      • Functions
      • Conditional Fail Expression
      • Accessing Data Records and Fields
      • Mapping
      • Parameters
      • Regular Expressions
    • CTL Debugging
      • Debug Perspective
      • Importing and Exporting Breakpoints
      • Inspecting Variables and Expressions
      • Examples
    • Functions Reference
      • Conversion Functions
      • Date Functions
      • Mathematical Functions
      • String Functions
      • Mapping Functions
      • Container Functions
      • Record Functions (Dynamic Field Access)
      • Miscellaneous Functions
      • Lookup Table Functions
      • Sequence Functions
      • Data Service HTTP Library Functions
      • Custom CTL Functions
      • CTL2 Appendix - List of National-specific Characters
      • HIDDEN Subgraph Functions
    • Tutorial
      • Creating a Transformation Graph
      • Filtering the records
      • Sorting the Records
      • Processing Speed-up with Parallelization
      • Debugging the Java Transformation
  • DATA SHAPER SERVER
    • Introduction
    • Administration
      • Monitoring
    • Using Graphs
      • Job Queue
      • Execution History
      • Job Inspector
    • Cluster
      • Sandboxes in Cluster
      • Troubleshooting
  • Install Data Shaper
    • Install Data Shaper
      • Introduction to Data Shaper installation process
      • Planning Data Shaper installation
      • Data Shaper System Requirements
      • Data Shaper Domain Master Configuration reference
      • Performing Data Shaper initial installation and master configuration
        • Creating database objects for PostgreSQL
        • Creating database objects for Oracle
        • Executing Data Shaper installer
        • Configuring additional firewall rules for Data Shaper
Powered by GitBook
On this page
  • Short Description
  • Ports
  • Metadata
  • Aggregate Attributes
  • Details
  • Aggregation Mapping
  • Aggregate Functions
  • Examples
  • Basic Usage
  • See also
  1. DATA SHAPER DESIGNER
  2. Transformers

Aggregate

Short Description

Aggregate computes statistical information about input data records.

COMPONENT
SAME INPUT METADATA
SORTED INPUTS
INPUTS
OUTPUTS
JAVA
CTL
AUTO-PROPAGATED METADATA

Aggregate

-

x

1

1-n

x

x

x

Ports

PORT TYPE
NUMBER
REQUIRED
DESCRIPTION
METADATA

Input

0

✓

For input data records

Any1

Output

0-n

✓

For statistical information

Any2

This component has one input port and one or more output ports.

Metadata

Aggregate does not propagate metadata. Aggregate has no metadata template. Metadata on the output ports must be same.

Aggregate Attributes

ATTRIBUTE
REQ
DESCRIPTION
POSSIBLE VALUES

BASIC

Aggregate key

A key according to which records are grouped. For more information, see Group Key.

E.g. first_name;

Aggregation mapping

A sequence of individual mappings for output field names separated from each other by a semicolon. Each mapping can have the following form: $outputField:=constant or $outputField:=$inputField (this must be a field name from the Aggregate key) or $outputField:=somefunction($inputField). The semicolon after the last mapping is optional and may be omitted.

Charset

Encoding of incoming data records.

UTF-8 | other encoding

Sorted input

By default, input data records are supposed to be sorted according to Aggregate key. If they are not sorted as specified, switch this value to false.

true (default) | false

Equal NULL

By default, records with null values are considered to be different. If set to true, records with null values are considered to be equal.

false (default) | true

DEPRECATED

Old aggregation mapping

A mapping that was used in older versions, its use is deprecated now.

Details

Aggregate receives data records through a single input port, computes statistical information about input data records and sends them to all output ports.

Aggregation Mapping

Aggregate mapping requires metadata on input and output edges of the component. You must assign metadata to the component input and output before you can create the transformation. Define Aggregate key. The key field is necessary for grouping. Click the Aggregation mapping attribute row to open the Aggregation mapping dialog. In it, you can define both the mapping and the aggregation.

The dialog consists of two panes. You can see the Input field pane on the left and the Aggregation mapping pane on the right.

  1. Each Aggregate key field can be mapped to the output. Drag the input field and drop it to the Mapping column in the right pane at the row of the desired output field name. After that, the selected input field appears in the Mapping column. The following mapping can only be done for key fields: $outField=$keyField.

  2. Fields that are not part of Aggregate key can be used in aggregation functions and the result of the aggregation function is mapped to the output. To define a function for a field (either contained in the key or not), click the row in the Function column, select a function from the combo list and click Enter. Aggregation function count() has no parameter, therefore it requires no input field.

  3. For each output field, a constant may also be assigned to it. $outputField:="Clover"

Aggregate Functions

FUNCTION NAME
DESCRIPTION
INPUT DATA TYPE
OUTPUT DATA TYPE
INPUT CAN BE LIST

avg

Returns an average value of numbers. Null values are ignored. If all aggregated values are null, returns null.

numeric data type

numeric data type

no

count

Count records, null values are counted as well as other values.

-

numeric data type

yes

countnotnull

Counts records, if the field contains null, it is not counted in.

any

numeric data type

yes

countunique

Counts unique values. null is unique value. The function assumes 1, 2, 2, 2, null, 1, null as 3 unique values.

any

numeric data type

yes

crc32

Calculates crc32 checksum. Crc of null is null.

any

long

no

first

Returns the first value of group. If the first value is null, returns null.

any

any

yes

firstnotnull

Returns the first value, which is not null. If all received values were null, returns null.

any

any

yes

last

Returns the last value of the group. If last value is null, returns null.

any

any

yes

lastnotnull

Returns the last not-null value. If all values are null, returns null.

any

any

yes

max

Returns the maximum value. If all values are null, returns null.

numeric data type

numeric data type

yes

md5

If a group contains one record, returns base64-encoded md5 checksum. If a group contains more records, the particular input records are concatenated together before the calculation of md5 checksum. If an input is string, it is converted to sequence of bytes using encoding set up in the component first. If an input is integer or long, it is printed to the string first. If an input is null, returns null. Use md5sum instead of md5.

any

string

no

md5sum

If a group contains one record, returns md5sum of the field. If a group contains more records, the field values are concatenated first. If an input is null, returns null.

byte

string

no

median

Returns median value. Null values are not counted in. If all input values are null, returns null.

numeric data type

numeric data type

no

min

Returns minimum value. If all input values are null, returns null.

numeric data type

numeric data type

yes

modus

Returns the most frequently used value (null values are not counted in). If there are more candidates, the first one is returned. If all input values are null, returns null.

any

any

yes

sha1sum

If a group contains one record, returns sha1sum of the field. If a group contains more records, the field values are concatenated first. If an input field is null, returns null.

byte

string

no

sha256sum

If an input group contains one record, returns sha256sum of the field. If a group contains more records, the field values are concatenated first. If all input values are null, returns null.

byte

string

no

stddev

Returns a standard deviation. Null values are not counted in. If all input values are null, returns null.

numeric data type

numeric data type

no

sum

Returns sum of input values. If all input values are null, returns null.

numeric data type

numeric data type

no

You can calculate md5sum, sha1sum and sha256sum checksums incrementally: the group of records corresponds to the whole file whereas particular records contain blocks of the file.

For example, there are 3 records grouped together by a value in the field f1. The field f2 contains particular blocks: a, b and c (as bytes). Each value is in the different record. The sha1sum applied on field f2 returns sha1sum("abc").

Examples

Basic Usage

Input metadata contains fields Weight and ProductType. Output fields are: ProductType, Count, TotalWeight, AverageWeight, and Date. Output metadata can also have other fields. Aggregate records of the same ProductType field. Set Date to 2015-08-20.

Solution Set Aggregate key to ProductType. Set Aggregate mapping:

  • Map ProductType to ProductType.

  • Use the count() aggregation function to count records with a same key.

  • Use the sum() and avg() functions to calculate total and average weight of grouped items. Both functions require an input field as an argument. Drag the input field weight to the Mapping column.

  • Set the Mapping field of Date to 2015-08-20.

The Aggregate mapping is $ProductType:=$ProductType;$Count:=count();$TotalWeight:=sum($weight);$AverageWeight:=avg($weight);Date:=2015-08-20;.

See also

PreviousCommon Properties of TransformersNextConcatenate

Last updated 1 month ago

Common Properties of Components
Specific attribute types
Common Properties of Transformers