latestKeyedStreamTable#
- swordfish.function.latestKeyedStreamTable()#
Create a keyed stream table with one or more columns serving as the primary key. Compared to the keyedStreamTable, latestKeyedStreamTablemaintains the most up-to-date record for each unique primary key based on a time column. When a new record arrives, the system compares its primary key to existing records in memory:
If a match is found, check the timestamps:
If the new record’s timestamp is more recent, it is inserted and replace the existing record.
If not, the existing record remains unchanged.
If no matching primary key is found, add the new record to the table. In cases where multiple new records with the same key are written simultaneously, only the record with the most recent timestamp is inserted.