Using gsql_uuid_v4() inside ACCUM

Hello TG Team,

I wonder whether using gsql_uuid_v4() inside ACCUM creates duplicate ids.

For example:

MapAccum<STRING, INT> @map;
_t = SELECT s FROM ANY:s ACCUM s.@map += (gsql_uuid_v4() -> 1); 

Then will the uuids created contain duplications?

Thanks

Hi!

I’m not the most well-versed in uuid (yet!), but the chance of generating duplicate uuids is highly unlikely, and calling the function in an ACCUM statement should not alter that behaviour. I ran a few sample queries, and this appears to hold: there are no duplicates throughout all the local accumulators. Out of curiosity, did any blocker in particular prompt this question?

2 Likes

Hi Shreya,

Thanks for the reply! Sometimes I might create uuids instead of consecutive integers to act as keys in MapAccum or GroupbyAccum. Since operations inside ACCUM run in parallel, I wonder if that produces duplications.

1 Like

Ah, I see. That should work fine, though if you run into any blockers, don’t hesitate to reach out!

2 Likes