Is there a bug with UINT?


According to the docs the max value of UINT is 18446744073709551615.

However when I try to store the max value in an UINT type it maxes out at 9223372036854775807.

Here is my simple query.

CREATE QUERY addPerson(UINT number) FOR GRAPH Test {
INSERT INTO Person (PRIMARY_ID, bigNumber) VALUES (number, number);

The Person vertex has a primary key of type UNIT which checked off as an attribute. The bigNumber attribute is also of type UINT. When I call this query the id becomes 9223372036854775807 and the bigNumber attribute is rounded to 9223372036854776000.

Is this a bug? Can someone explain what’s going on? Thx!


@alvinchan checking with the team regarding question above.

After experimenting a bit I think I know why this is happening. I am using Graph Studio and running the query in interpreted mode. Since the browser is running javascript it is only has integer precision to 2^53-1. So I think javascript is screwing up either the input or output or both.

Can you please let me know the GSQL query for this type of use case
To know the list of movies where Tom Cruise not worked

suppose we have an edge between Actor and Movie (worked_in)

Movies = {Movie.*};
Tom = SELECT a FROM Actor:a WHERE a.firstName == ‘Tom’ and a.lastName == ‘Cruise’;
TomsMovies = SELECT m FROM Tom -(worked_in>) - Movie:m;
NotTom = Movies MINUS TomsMovies;

1 Like

Thanks, @markmegerian! @pkr2 if you use this query just make sure that you signify SYNTAX v2 in the create statement.

1 Like

I have tried to reproduce this issue, but it doesn’t seem to reproduce.
Steps to reproduce:
1.Create a vertex and a graph:

Successfully created vertex types: [Person].
Successfully stopped GPE GSE RESTPP in 21.100 seconds
Successfully started GPE GSE RESTPP in 0.081 seconds
The graph social is created.

2.Create query and install this query.

GSQL > begin
GSQL > CREATE QUERY addPerson(UINT number) FOR GRAPH social {
GSQL > INSERT INTO Person (PRIMARY_ID, bigNumber) VALUES (number, number);
GSQL > }
GSQL > end
Successfully created queries: [addPerson].
GSQL > install query addPerson
Start installing queries, about 1 minute ...
addPerson query: curl -X GET ''. Add -H "Authorization: Bearer TOKEN" if authentication is enabled.
Select 'm1' as compile server, now connecting ...
Node 'm1' is prepared as compile server.

[========================================================================================================] 100% (1/1)
Query installation finished.

3.The parameter value of the query request is less than 18446744073709551615.

run query addPerson(9223372036854775807)
run query addPerson(9223372036854775809)
run query addPerson(11223372036854775807)
run query addPerson(18446744073709551615)

The parameter value of the query request is greater than 18446744073709551615.

GSQL > run query addPerson(18446744073709551616)
Arguments for the parameter 'number' must be UINT64, but invalid value(s) given: [1.8446744073709552e+19]

4.Check that inserted data are all expected.

GSQL > select * from Person limit 4
    "v_id": "11223372036854775807",
    "attributes": {"bigNumber": "11223372036854775807"},
    "v_type": "Person"
    "v_id": "9223372036854775807",
    "attributes": {"bigNumber": 9223372036854775807},
    "v_type": "Person"
    "v_id": "18446744073709551615",
    "attributes": {"bigNumber": "18446744073709551615"},
    "v_type": "Person"
    "v_id": "9223372036854775809",
    "attributes": {"bigNumber": "9223372036854775809"},
    "v_type": "Person"