Event Time Assigner


Number of input and output link

Number of input link : One
Number of output link : One

Event Time Assigner Assembly () is used to assign an event time to each incoming record in a data stream.

In stream processing systems, event time represents the actual time when the event occurred, not the time when the system processed the event. This is important for accurate time-based analysis, such as window processing, event ordering, and late data handling.

The event time is assigned using a User Defined Function (UDF) Event Time Assigner.

Parameters of Event Time Assigner

There are two parameters in the Event Time Assigner Assembly.
  1. Event Time Assigner Class
    Specifies the class name of the Event Time Assigner used to determine the event time.
    This class can be:
    • A built-in Event Time Assigner
    • A User Defined Event Time Assigner (UDF) created by the user
    To create a custom class, follow the UDF plugin tutorial.
    Example:
         com.labs247.function.CurrentTimeAssigner
    
  2. Parameter
    Specifies the parameter required by the Event Time Assigner class.
    The meaning of the parameter depends on the selected class.
    Example uses:
    • Column index containing a timestamp
    • Date-time format
    • Custom parameter used by a user-defined class

Built-in Event Time Assigner Classes

HGrid247 provides three built-in Event Time Assigner classes.
  1. CurrentTimeAssigner
    Class:
        com.labs247.function.CurrentTimeAssigner
    
    Description:
    Assigns the current system time as the event time of the incoming record.

    This method is typically used when:
    • The data does not contain a timestamp field
    • The processing time should be used as event time
    Parameter:
    Not required.

  2. ColumnTimeMillisAssigner
    Class:
        com.labs247.function.ColumnTimeMillisAssigner
    
    Description:
    Assigns the value of a column as the event time, where the column value is stored as milliseconds since epoch.
    Parameter:
        column_index
    
    Example:
        Parameter = 2
    
    Meaning:
    • Column 2 contains the timestamp value
    • The value must be in milliseconds (long format)
    Example data:
        id,user,time
        1,A,1700000000000
    

    The value 1700000000000 will be used as the event time.

    Default behavior:

    If the parameter is empty, the default column index is 0.

  3. ColumnFormatAssigner
    Class:
        com.labs247.function.ColumnFormatAssigner
    
    Description:
    Assigns event time from a column containing a formatted date-time string.

    The system converts the date-time string into a timestamp using the specified format.

    Parameter format:
        column_index,date_format
    
    Example:
    Parameter = 2,yyyy-MM-dd HH:mm:ss
    
    Meaning:
    • Third Column contains a date string
    • The format is yyyy-MM-dd HH:mm:ss
    Example data:
        1,login,2025-02-07 14:35:00
    
    The value 2025-02-07 14:35:00 will be parsed and used as the event time.

    Default behavior:

    If the parameter is empty:
        column_index = 0
        format = yyyy-MM-dd HH:mm:ss
    

Example Workflow

Example stream record:
    UserID | Action | EventTime
Example data:
    101 | login | 2026-02-07 10:15:30
Configuration:
    Event Time Assigner Class
    com.labs247.function.ColumnFormatAssigner

    Parameter
    2,yyyy-MM-dd HH:mm:ss
Result:
    Event Time = 2026-02-07 10:15:30
The system will use this value for time-based stream processing.

Summary

The Event Time Assigner Assembly is used to: It supports three built-in methods:
Class                       Function
CurrentTimeAssigner         Uses the system processing time
ColumnTimeMillisAssigner    Uses a column with timestamp in milliseconds
ColumnFormatAssigner        Uses a column with formatted date-time

Supported Engines

Map
Reduce
Spark 1.x
RDD
Spark 2.x
RDD
Spark 2.x
Dataset
Apache Beam
2.29.0 Batch
Apache Beam
2.29.0 Streaming
Apache Flink
1.12.0 Batch
Apache Flink
1.12.0 Streaming
Apache Tez
0.9.1
PySpark