Skip to main content

merge (Aggregate Function)

Collect multiple maps to merge as a single map. Only distinct keys are collected. If a duplicate key arrives, then it overrides the old value.

Syntax

<OBJECT> map:merge(<OBJECT> map)

Query Parameters

NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
mapMaps to be collectedOBJECTNoYes

Example 1

insert into OutputStream
select map:merge(map) as stockDetails
from StockStream WINDOW TUMBLING_LENGTH(2);

For the window expiration of two events, the merge() function will collect attributes of map and merge them to a single map, returned as stockDetails.