Composite vertex/edge index support custom code logic on timestamp in GraphStudio

Hi,

Currently I can use GSQL_concat to create composite index based on multiple columns of .csv data. However, there is a problem using timestamp as part of index where I need to collect closer timestamp into same vertex/edge attribute:

For example I need to “join” columns from 2 different .csv into same vertex based on timestamp, and index is like this:

columns and data in .csv 1:
id, time, metric1
devA, 12:11:49, 100
devA, 12:32:07, 123
devA, 12:52:24, 140
columns in .csv 2:
id, time, metric2
devA, 12:09:14, 0.22
devA, 12:19:14, 0.42
devA, 12:29:14, 0.89
devA, 12:39:14, 1.02
devA, 12:49:14, 1.32
devA, 12:59:14, 1.51
although id is the same but time are different in both .csv, so in order to join both into same vertex, I need to have vertex schema like: id+time, metric1, metric2 (id and time form concatenated key of vertex).

How can I merge both .csv during load in GraphStudio or other approach so that 3 vertex will be created after join of both separate .csv and data like below (with id+time as key of vertex) ?:

               id+time,          metric1, metric2
          devA#12:01:49,  100,       mean of metric2 before 12:01:49
          devA#12:22:07,  123        mean of metric2 from 12:01:49 to 12:22:07
          devA#12:42:24,  140        mean of metric2 from 12:22:07 to 12:42:24

Thank you very much for help!
eric

Hi @ericwong ,

I see here few possible approaches - pick the one that is the best fit for your workflow:

  1. pre-processing: you combine the two CSV files into one and do a id conversion in the merging process
  2. post-processing: loading data into two (temp) vertices and start a post-processing after the LOADING JOB is done
    https://docs.tigergraph.com/dev/gsql-ref/querying/data-modification-statements#insert-into-statement
  3. Using a composite key or token function during loading:
    https://docs.tigergraph.com/dev/gsql-ref/ddl-and-loading/creating-a-loading-job#loading-composite-key-attributes

Best,
Bruno