How to send vertex set parameter to a UDF function

Hello,
i need some help with GSQL query that calls UDF.
I have a UDF that accept the following parameters

inline void callUDF(SetAccum& source_vertices, SetAccum& target_vertices) ;

I’m calling this function from a gsql query.

when Im calling the UDF from test1 query - the UDF prints results
CREATE QUERY test1(set< vertex> startVertices, set < vertex> endVertices) FOR GRAPH test {
callUDF(startVertices, endVertices);
}

and when i call it from test2 query - the UDF prints nothing
CREATE QUERY test2(Vertex startVertices, vertex endVertices) FOR GRAPH test {
SetAccum @@start ;
SetAccum @@endver ;
@@start +=startVertices;
@@endver +=endVertices;
callUDF( @@start, @@endver);
}

I have 2 questions about this issue:

  1. What is the difference between the two queries ?
  2. How can i write a query that get a single vertex and call the callUDF() without changing the UDF signature?
    in other words, how can i make test2 works?

Thanks in advance!
Lior

If that worked for your test1, test2 should work too.

Could you check your GSQL_LOG? You can find it by running command gadmin log gsql.

Thanks.

Hi Xinyu,
Thanks for your replay.
It seems that there is no error on the GSQL_LOG.
It only prints out the query itself.

Could it be that the signature
inline void callUDF(SetAccum& source_vertices, SetAccum& target_vertices) ;
accepts only set and not setAccum?
or maybe should i send the setAccum without @@?
I think that I’m missing something in the syntax of the GSQL because it works
when i send a set< vertex>

The correct definition should be

inline void callUDF(SetAccum& source_vertices, SetAccum& target_vertices) ;

Could you give a try. Also if you see installation failure. The compile error will be printed to the GSQL_LOG file, which you can find it by running command gadmin log gsql.

Thanks.