Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Debug() doesn't enclose Guid values in quotes even when using .ToString() #1668

Closed
cbgrasshopper opened this issue Jul 27, 2024 · 3 comments
Closed
Labels

Comments

@cbgrasshopper
Copy link

Describe the bug
Given a query like g.V<Item>().Where(i => i.SomeProperty.Equals(someConstantGuid.ToString()), the .Debug() output renders g.V().hasLabel('Item').has('SomeProperty',someConstantGuid) without enclosing the Guid in single quotes.

This does not affect actual query execution, only the debug output. When debugging through, it appears that the Guid type falls through to the default case in the switch statement in GroovyWriter::Append, but I don't know whether the root of the issue is there or in the prior transformation to bytecode.

Expected behavior
Expected would be g.V().hasLabel('Item').has('SomeProperty','b7219a3b-783e-4293-b6d2-ba74f9335bff'); actual is g.V().hasLabel('Item').has('SomeProperty',b7219a3b-783e-4293-b6d2-ba74f9335bff). Adding .ToLowercase() after .ToString() produces the expected debug output.

Version information
Gremlinq version 12.7.2

Minimal working example
https://github.com/cbgrasshopper/GremlinqGuidDebugIssue

@danielcweber
Copy link
Contributor

I'm not sure if just quoting the Guid is the right thing to do here. It depends on the purpose of the Debug output. Most (sufficiently simple) queries can be taken verbatim and executed manually on a database in which case the Guid would be taken as a string. Which may or not be fine during subsequent deserialization with Gremlinq. But I feel if it's a Guid, it should show up in the Debug output somehow. The most sensible thing to do is output "UUID.fromString(...)" but that will of course not execute everywhere, which is fine given that it's just debug output.

The Vertex class is not part of your repro, if the respective property is of type Guid please note that AFAIK Guids are not native to CosmsoDb, so using just strings might be a my recommended solution in this case.

@danielcweber
Copy link
Contributor

I see things are a bit different than I initially understood. The property on the vertex is indeed meant to be a string...so the issue may not affect debug output only. I will have to take a look.

@danielcweber
Copy link
Contributor

Fixed by #1670.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants