Dynamic arrays sql

Hello,

Do we have dynamic arrays in gsql? Please can you direct me to using dynamic arrays to load data into a graph.

Thank you

Regards

Meghana.Ponnuru

1 Like

Hi Meghana,

Could you please clarify what is your input and what is the expected outcome?

Thanks.

Hello,

I’m trying to construct a 2D array dynamically , perform some computation and store values in it. For example , in c++ we use malloc to dynamically allocate the array.

Thank you

Regards

Meghana.Ponnuru

1 Like

ArrayAccum has a reallocate function to change the size of the array.

reallocate( INT, … )

Discards the previous ArrayAccum instance and creates a new ArrayAccum, with the size(s) given. An N-dimensional ArrayAccum requires N integer parameters. The reallocate function cannot be used to change the number of dimensions.

However, it also clears out the array while assigning new sizes of dimensions.

https://docs.tigergraph.com/dev/gsql-ref/querying/accumulators#element-level-operations

Sure, Thank you. I wasn’t sure if it was dynamic earlier. Thanks for clearing my doubt.