-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
feat(griffin): timestamp comparison operators #796
Conversation
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.
Two small comments, to reduce object churn.
- you are correct about the bug with
isNegated
, well spotted! - timestamp
=
and!=
should have the same semantics in function as they do when optimizer bypasses function calls. Implementing this would oversaturate this PR I feel.
Overall the PR is excellent and adds tremendous value! Thanks!
FunctionFactory greaterThan = createSwappingFactory(">", factory); | ||
// `a < b` == `b > a` | ||
addFactoryToList(factories, greaterThan); | ||
// `b > a` == `b <= a` |
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.
b > a
== !(b <= a)
@@ -196,6 +196,27 @@ public static int validateSignatureAndGetNameSeparator(String sig) throws SqlExc | |||
return openBraceIndex; | |||
} | |||
|
|||
public static String createSignatureWithSwappedArgs(String name, String signature) throws SqlException { |
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 can perhaps have here a reusable StringBuilder, one for all functions processed by the FunctionFactoryCache
|
||
public static String createSignature(String name, String signature) throws SqlException { | ||
int openBraceIndex = validateSignatureAndGetNameSeparator(signature); | ||
return name + signature.substring(openBraceIndex); |
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.
here too
Resolves #582.
I’ve made two decisions that might not be obvious, so please let me know if they are correct:
Even though
abc
is not a valid timestamp the following query wouldn't fail, instead it will return only matched results:=
and!=
handle Exact timestamp and Time range. Time range with modifier and Explicit range are not supported - I am not sure if they are in the scope of the issue.Additional changes:
isNegated
fromAbstractBooleanFunctionFactory
may lead to race conditions. This PR fixes it.