-
Notifications
You must be signed in to change notification settings - Fork 30
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
Dev make apoc version aware #728
Conversation
3b3dc49
to
4449e2d
Compare
edc4600
to
97aca4d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some of the uglier sides of cypher versions really start to show themselves (not your fault though of course!). Not much else we can do at this point I guess. Thanks for doing the work :).
return procedureCallContext.calledwithQueryLanguage().equals(QueryLanguage.CYPHER_5) | ||
? "CYPHER 5 " | ||
: "CYPHER 25 "; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When we release the next cypher version we will still run queries in Cypher 25, is that intentional?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
True true, I can make it more future safe
} | ||
|
||
public static String getCypherVersionString(ProcedureCallContext procedureCallContext) { | ||
return procedureCallContext.calledwithQueryLanguage().equals(QueryLanguage.CYPHER_5) ? "5" : "25"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here, will return "25" for newer versions.
private static final Pattern CYPHER_VERSION_PATTERN = | ||
Pattern.compile("^\\s*\\b(CYPHER)(?:\\s+(\\d+))?", Pattern.CASE_INSENSITIVE); | ||
public static final Pattern PLANNER_PATTERN = | ||
Pattern.compile("\\bplanner\\s*=\\s*[^\\s]*", Pattern.CASE_INSENSITIVE); | ||
public static final Pattern RUNTIME_PATTERN = Pattern.compile("\\bruntime\\s*=", Pattern.CASE_INSENSITIVE); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have access to the pre-parser, so potentially we could parse it out with that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we have an example of that in APOC somewhere already?
} | ||
|
||
private static final Pattern CYPHER_VERSION_PATTERN = | ||
Pattern.compile("^\\s*\\b(CYPHER)(?:\\s+(\\d+))?", Pattern.CASE_INSENSITIVE); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's \b
in regex (I actually looked it up but still do not understand...).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It makes sure that CYPHER is a single word by itself (so a string has to start with CYPHER and CYPHERS etc won't match)
@Context | ||
public ProcedureCallContext procedureCallContext; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I forgot, do ProcedureCallContext
require allow unrestricted access?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, it is marked as safe or whatever the terminology is :)
758bf72
to
23eb6b1
Compare
Make APOC procedures and functions react based on used Cypher Version