limit() function execution order in Azure Cosmos GraphDb?

Wei Wang 1 Reputation point Microsoft Employee
2022-02-16T02:43:32.06+00:00

I have encountered a problem when using Cosmos GraphDb. Vertex "EXO-OAuth-DailyAvailabilityPuller-JobDefinition" has edges named "JobDefinitionToJobHistory," and the target of these edges are the job history vertexes. In 2022-02-12, vertex "EXO-OAuth-DailyAvailabilityPuller-JobDefinition" has two job history vertexes, the first status of job history vertex is failed (ExecutionStartTime is 2022-02-12T11:58:47.3459708Z) and the second status of job history vertex is succeed (ExecutionStartTime is 2022-02-12T14:03:02.8664959Z).

So, when I execute the Gremlin query below, I get the expected result which is a vertex with a succeed status(2 means succeed).

   g.V("EXO-OAuth-DailyAvailabilityPuller-JobDefinition").out('JobDefinitionToJobHistory').has("ExecutionStartTime", between("2022-02-12T00:00:00Z", "2022-02-13T00:00:00Z")).order().by('ExecutionStartTime', decr).limit(1)  

175639-microsoftteams-image-9.png
But when I execute the Gremlin query below, I get the incomprehensible result which is a vertex with a failed status (1 means failed). The expected result of this query I think should be empty or null.

   g.V("EXO-OAuth-DailyAvailabilityPuller-JobDefinition").out('JobDefinitionToJobHistory').has("ExecutionStartTime", between("2022-02-12T00:00:00Z", "2022-02-13T00:00:00Z")).order().by('ExecutionStartTime', decr).limit(1).has("Status", 1)  

175671-microsoftteams-image-11.png
I am very confused about the second Gremlin query result. Because I can't recreate this problem in TinkerGraph. So I don't know if this result is related to Azure Cosmos GraphDb. Hope you can give me some help, thanks!

Azure Cosmos DB
Azure Cosmos DB
An Azure NoSQL database service for app development.
1,470 questions
{count} votes