- Notifications
You must be signed in to change notification settings - Fork689
Add _all_ date function aliases to parser (extended)#1982
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:develop
Are you sure you want to change the base?
Add _all_ date function aliases to parser (extended)#1982
Uh oh!
There was an error while loading.Please reload this page.
Conversation
- Add all other AlaSQL date functions and aliases to the parser- Adjust unit tests, as month is now a reserved keyword- Explicitly didn't add the "DATE()" function, as it's use is very ambiguous in AlaSQL -> as column alias, as column type, as JS expression.- Added IntervalLiteral which contains all possible values to use when specifying an interval expression
- Use Expression instead of ExprList to restrict the number of arguments to the methods
- Extend unit test with non existing interval- DAYOFYEAR is alias for DAY
- Compact the expression with an OR statement to reduce duplicate code
mathiasrw commentedDec 15, 2024
I really like this, but im a bit sad to break lots of current implementation by making Over the Christmas break I will see if I can make this work so its only a protected keyword as the first parameter in the date functions, and other places we look for the name plus a |
mathiasrw commentedDec 19, 2024
Still working on this. Neck deep in the jungle of JISON. |
mathiasrw left a comment
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 got a few questions
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
mathiasrw left a comment
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 got a few questions
paulrutter commentedDec 20, 2024
@mathiasrw i processed your comments and made some changes. |
mathiasrw left a comment• edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
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 should have been more clear.
I cant find documentation thatdayofyear anddayofmonth is a valid unit forinterval. I have a feeling those two should not be part of interval literals. What are you seeing that I am not seeing?
mathiasrw commentedDec 29, 2024
Ill pick up the rest and work on it not being breaking. |
Charlesnorris509 commentedJan 14, 2025
Code Quality Improvements: |
paulrutter commentedJan 14, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
@mathiasrw what does the PR approval mean? Did you make progress on resolving#1982 (comment)? |
…to-parser-extended# Conflicts:#src/alasqlparser.jison#src/alasqlparser.js
mathiasrw commentedJan 15, 2025
Well, it means that im subtracting my comments to change because I am working on it locally. I think I got the last part nailed this morning. Ill confirm things over the next few days. |
paulrutter commentedJan 15, 2025
Sounds great 👍 |
mathiasrw commentedFeb 28, 2025
omg. Its already end of feb. Sorry things have been hectic. |
paulrutter commentedFeb 28, 2025
No problem, take your time 👍 |
Uh oh!
There was an error while loading.Please reload this page.
Based on#1980, this PR attempts to add all relevant date functions to the parser (and thus validate the query for being valid).
NOWGETDATECURRENT_DATE()ADDDATE(args)SUBDATE(args)DAY(date)DAYOFMONTH(date)DAYOFWEEK(date)DATE_ADD(args)DATE_SUB(args)SUBDATE(args)MINUTE(date)SECOND(date)MONTH(date)YEAR(date)WEEK(date)WEEKDAY(date)Additional: the interval values that can be specified are now also part of the parser:
This makes some keywords now reserved keywords, like using
monthas column alias for example.This has been adjusted in this PR.
Do note that
DATE()isnot added to the parser, as its use is very ambigious in AlaSQL.There are new unit tests that verify the changes made.