-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
fix(hogql): dateAdd should be date_add #23131
Conversation
Size Change: 0 B Total Size: 1.06 MB ℹ️ View Unchanged
|
Questions.
|
@@ -462,7 +462,7 @@ def compare_types(arg_types: list[ConstantType], sig_arg_types: tuple[ConstantTy | |||
"age": HogQLFunctionMeta("age", 3, 3), | |||
"dateDiff": HogQLFunctionMeta("dateDiff", 3, 3), | |||
"dateTrunc": HogQLFunctionMeta("dateTrunc", 2, 2), | |||
"dateAdd": HogQLFunctionMeta("dateAdd", 3, 3), |
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.
dateAdd
is an alias if date_add
- so I don't see why this wouldn't work. docs. I'd be keen to not change this if we can help it, it'll become one of the only funcs in snake case, and may break existing queries
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 changed it to date_add because So, I guess with that understanding, the better solution is to keep the existing signature but make sure dateAdd supports 3 arguments or 2 (as suggested in docs) and for 3 arguments, the first argument can be a quoteless time interval token. @mariusandra
|
We definitely certainly absolutely do not want to remove functions from HogQL. This PR removes The new function also does not look like any of the other functions we have. If you really want to write Will swapping |
No, because the function entirely doesn't work so I was working with the assumption that it's 0 and/or no one reported it. Just checked and here's the data (please check my query logic in case I might be missing how hogql queries are stored) 1 on US (which noted that dateAdd doesn't work)
Agreed the snake case doesn't make sense. I had just changed it to match clickhouse more closely. We can keep dateAdd but can we change the function to accept only 2 args? That would work. Right now with 3, it expects an interval token as the first argument like If we want to keep the signature exactly the same, I think we would need to support |
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'm more than happy to change the wrong number of arguments to the correct one 😄
* update func * only change func args
Problem
Changes
👉 Stay up-to-date with PostHog coding conventions for a smoother review.
Does this work well for both Cloud and self-hosted?
How did you test this code?