Error: An unexpected argument type map<vertex,float>

When I type in incorrect argument type it says “{BAG, BOOL, DATETIME, DOUBLE, EDGE, FILE, FLOAT, INT, JSONARRAY, JSONOBJECT, MAP, SET, STRING, UINT, VERTEX, ‘)’}”. So looks like MAP is one of the valid argument type. But when I added a “test” query mentioned below, I get “Error: An unexpected argument type map<vertex,float>” in console.

Can someone please explain this behavior, why it won’t let me have “MAP” as one of the argument types?

Code:

CREATE QUERY test(MAP<VERTEX, FLOAT> var1, VERTEX var2) FOR GRAPH g1 RETURNS (FLOAT) {
return 5.0;
}

The only types supported are per this link: https://docs.tigergraph.com/dev/gsql-ref/querying/query-operations#query-parameter-and-return-types

MAP isn’t supported as a parameter type.

Where does it say MAP is okay? I’ll put in a JIRA to get the error message corrected.

By the way, there is a workaround here, which is the JSONARRAY type. Check out the docs here: https://docs.tigergraph.com/dev/gsql-ref/querying/operators-functions-and-expressions#jsonobject-and-jsonarray-functions

If you really need to pass complicated objects around, then parsing this in and out is the only approach we have right now. This can be a little tedious, but it works well. Let me know if you’d like to know more on that and I’ll see if we can whip up a simple example.

2 Likes

When I type in incorrect type in the arguments, it gives " Error: mismatched input ‘MapAccum’ expecting {BAG, BOOL, DATETIME, DOUBLE, EDGE, FILE, FLOAT, INT, JSONARRAY, JSONOBJECT, MAP, SET, STRING, UINT, VERTEX, ‘)’} " message in the console.

Example code to get the error mentioned above,
CREATE QUERY test(MapAccum<VERTEX, FLOAT> var1) FOR GRAPH g1 {
PRINT “Test Query”;
}

An example will be really helpful, tyty :blush: