Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Here you specify the names of all the fields you want to group together when performing the aggregation.

FieldDescription
Fields

Specify the fields to be used for grouping aggregated data. If a record has the same values as a another record in the selected fields, they will be grouped in the same session.

Info
titleExample

For example, there are three records being read in a stream with field key, user and you decide to group by user

Record1 has user field with value set as 1

Record2 has user field with value set as 2

Record3 has user field with value set as 1

So, Record1 and Record3 will be grouped in the same session and the value will now be updated to 2. And, Record2 will be in a separate session.


You can either type the name of the field(s) or select the field(s) from the drop-down menu that appears when you click on the field. In the Fields drop-down menu, you also have the option to Select all or Deselect all fields.

Group based on date/time

Select the checkbox to enable aggregation based on a time period. Specify applicable fields, containing timestamp data, to be used for grouping of aggregation data.

Select the Period to group the information by:

  • Hour
  • Day
  • Month
  • Year
Info
titleTime Period Format

The supported time period format is ISO 8601 (extended format) in accordance with the YYYY-MM-DDTHH:mm:ss.sssZ pattern.

In case you need to convert a date format to support the ISO standard, see Script.

An example would be: "2019-01-13T00:00:00.000Z". 

Click Image Modified to add additional grouping criteria based on the time period.


Note
titleConfiguration

Any change in the Group Fields configuration may result in a new aggregation session, however, the old sessions will still be in the storage. So if you change it back to the previous configuration, the already existing session in the storage (if any) will be used during the aggregation. 

...

Here you specify the name of the field(s) and the operation to be performed on that field.

FieldOperation
Name of the input field key

The Operation drop-down menu is divided into three types: 

  • Numeric: 
    • SUM
    • MAX
    • MIN
    • AVERAGE
  • General
    • COUNT
    • CARRY_FIRST
    • CARRY_LAST
  • Date
    • MAX
    • MIN


Click  to add more fields for aggregation.

...


In

Product name
, you can flush using any of the following options:

Flush byDescription
End of transaction

Aggregated data is flushed at the end of each transaction.

Info

For example, an Excel file in an S3 bucket.

This option is not applicable for real-time streams.

End of stream

Aggregated data is flushed at the end of the stream.

Info
titleExample

A use case where data sets from five different Excel files from an S3 bucket are being processed by a stream.

This option is not applicable for real-time streams.

Timeout

Aggregated data is timed out when a predefined interval has passed or a condition is met.

In case of batch streams, the flush happens only when a stream is executed. For real time streams, the aggregated data is checked every 60 seconds and flushed only in case a timeout has occurred. 

Info
titleExample

Example of a timeout - Record the consumption of mobile data of a subscriber by 10th of every month.

Example of a condition timeout -  Record the consumption of mobile data until 10th of every month or if 100 GB limit is reached. So in this case the timeout will happen if either of these two conditions are met.


Select the type of the timeout based on:

  • Duration
    • Hours: Specify the interval to flush aggregated data.

      Info
      titleExample
      • For example, if you aggregate price per account and set timeout to 1 hour, then you will have the following behavior: 
        • At 13.00 Account 'X' with price 10 is aggregated, timeout will then be set to 14.00
        • At 13.07 Account 'Y'  with price 20 is aggregated, timeout will be set to 14.07
        • At 13.33 Account 'X' with price 12 is aggregated, sum updated to 22, timeout will still be set to 14.00


  • Frequency
    • Day: Aggregated data is flushed on a daily basis. You must specify the Time and Timezone to be considered. The timeout will be an absolute value as you set time/day when the timeout must happen. 

      Info
      titleExample

      For example, you set the timeout to day and time to 12.00 PM, then all created aggregation sessions will be timed out independently on when they were created.


    • Month: Aggregated data is flushed on monthly basis. Specify which day of every month, time of that day and the timezone when the aggregated data will be timed out. 

  • Custom
    • Based on date/time field: Timeout will be defined based on the input data in the record per aggregated session. Select or enter a field from your input data that is of either date or time format. Supports UTC format only.

      Info
      titleDate Format

      The supported date format is ISO 8601 (extended format) in accordance with the YYYY-MM-DDTHH:mm:ss.sss pattern.

      An example would be: "2019-01-13T00:00:00.000". 

      For example, a record that matches aggregation criteria with a date/time field set to 20220803:13.00.00 will have its timeout set to that date. Timeout will be updated in case new matching records arrive (with a different date/time field).  

Click Image Modified if you wish to add custom conditions to timeout the aggregated data. This option is available only when the Timeout flush by option is selected.
Click the following to know more:

UI Expand
titleAdd Condition

Add Condition for Timeout
Anchor
condition timeout
condition timeout

You also have the option to add a condition based on which the aggregated data is flushed (For example, timeout to happen when the value of the SUM field is more than 70).

Note
This option is only available in case of Timeout flush setting.
  • Condition name: You can assign a name to the condition.
  • Based on: Select which input fields or aggregated fields you want to apply the condition on. The Input Fields show all the input fields configured in the stream and Aggregated Fields show the fields that you have selected to perform aggregation on (in the Aggregation tab).

    Note

    The CARRY_FIRST and CARRY_LAST operations are not supported. So if you perform aggregation using any of these General Operations, those will not appear under the Aggregated Fields.


  • Type of field: Type of the field that is specified in Based on. You can choose from Numerical, String or Boolean. Applicable only in case of Input Field.
  • Operation: Specify the comparing conditions for that field to be compared with a Value that you will be specifying in the next step. The value changes depending on whether you choose input fields or aggregated fields in the Based on input.

  • Value: The numerical value against which you want to apply the operation.

    The following table explains which options are available when you select a specific criteria to add a Flush condition:

    Based onType of fieldOperationValue
    Input Field

    Select from the following values:

    • Numerical
    • Text Values (string)
    • Boolean

    Options vary according to the Type of field.

    • Numerical: Mathematical operation. You can choose from the following:
      Less than, Greater than, Less or equal to, Greater or equal to, Equal, Is different from
    • Text: Matches/Not Matches. It is not possible to perform mathematical operation on strings.
    • Boolean: Yes (True) and No (False)

    If you select:

    • Numeric Values: You can type the value or use the up or down keys to increment or decrement the value. 
    • Text Values (string): Enter the string value.
    • Boolean: Select Yes/No 
    Aggregated FieldsN/AYou can select from the numerical operation.


Click +Add Condition to add more conditions.



Note

The default value for the TTL for the stored data in a session is 180 days. That means if a session is not updated for 180 days, all the stored data pertaining to that session will be deleted permanently. 

...

Info
titleSome example streams

Metadata

You can view and access the following metadata properties of Data Aggregator. To view the metadata, use the meta object as mentioned in the Script function. Here is an example:

Info
titleExample


Code Block
{"origin":"Data_Aggregator","count":7,"flushType":"TIMEOUT","firstEvent":"2022-04-08T17:35:53.239Z","lastEvent":"2022-04-08T17:38:17.315Z","lastCall":false}



Property name Description

count

Number of aggregated records

flushType

The reason for session being flushed out. Shows any of the values: ALL_FILES, EACH_FILE, TIMEOUT and CONDITION. During preview, the value will be empty.

firstEventDate and time of the first aggregated record in the session
lastEvent

Date and time of the last aggregated record in the session


HideElements
commentstrue
likestrue