Ksqldb Data Enrichment for nested array

Can ksqldb enrich nested array?

ktable users:

 {
      "userId": "1",
      "displayname": "Fred",
      "Tags": [2,5,6,7]
    },
    {
      "userId": "2",
      "displayname": "Ben",
      "Tags": [5,1,5,2]
    },

Tags ktable:

{
   tagid: 2,
   Name: "firstag"
},
{
   tagid: 5,
   Name: "nexttag"
}

expected result how it do mongodb with ‘lookup’ Result enrich:

{
   "userId": "1",
   "displayname": "Fred",
   "Tags": [
        {
          tagid: 2,
          Name: "firstag"
        },
        {
          tagid: 5,
          Name: "nexttag"
        }
    ]
}

Sound like a FK-join plus an aggregation to me. So yes, seems possible.

Guess you would need to pre-process Users via EXPLODE to get one record per tag before doing the FK-join into the Tags dimension table, and aggregate the result afterward to “undo” the explode-step.

This topic was automatically closed after 30 days. New replies are no longer allowed.