-
Notifications
You must be signed in to change notification settings - Fork 58
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
SQLParser: Introduce LIMIT clause #544
base: main
Are you sure you want to change the base?
Conversation
output rows in the SQL parser.
…aphne into sqlparser-limit-output
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.
Hi @tomschw, thanks for this contribution. It's great to see that the features of the SQL parser are being extended!
Question: Was is a conscious choice to allow only integer literals in the LIMIT
clause, i.e., is it intended that expressions are not allowed (like LIMIT 1+1
)? I think it would be more flexible by allowing expressions.
Please fix the following points before we can merge it:
- Providing a negative value for the limit currently results in unexpected behavior (on my system it prints rubbish data before it segfaults). Please address this problem. In case we support expressions for the limit, please keep in mind that the value may not be known at SQL parse-time. It may become known after constant propagation. But it may not even be known until runtime.
- Please don't reimplement how an integer literal is parsed. Currently, you use
stoi()
, but it would be better to call the SQL parser code that parses integer literals to guarantee exactly the same behavior. (For example, think of different formats we may support at some point, like decimal, hexadecimal, etc.)
JFYI: Given an instance of FrameType
, you can derive another instance with the same column types, but all other properties reset to unknown, by FrameType::withSameColumnTypes()
. I simplified the code accordingly.
in the Kernel (introduce lower bounds, upper bounds and sanity check).
the function from the SQL parser. Also allows the use of not just INTEGER_LITERALS. Add corresponding test.
Hi @pdamme, as discussed on Friday the following changes should mitigate your main issues:
Regarding the decision of not allowing expressions: We did have a quick talk yesterday and would rather only allow literals at the moment. If there is a use case in the future which would necessitate the handling of expressions, we would of course revisit our decision. |
New feature:
Changes: