-
Notifications
You must be signed in to change notification settings - Fork 235
Add from_json to compiler, add from_json and to_json to prql-js #782
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
Conversation
@@ -293,6 +293,11 @@ impl Display for Item { | |||
UnOp::Not => write!(f, "not {}", expr.item)?, | |||
}, | |||
Item::FuncCall(func_call) => { | |||
match func_call.name.as_str() { |
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 generating a group, we would have had something like:
group [foo, bar]
aggregate [baz = sum foobar]
There were missing parentheses around aggregate, which led to invalid PRQL. With this code, we write an opening parenthesis before aggregate.
Another block of code writes the closing parenthesis, so that we get:
group [foo, bar] (
aggregate [baz = sum foobar]
)
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.
Actually this is wrong, as groups do not only have aggregates, eg.:
group employee_id (
sort month
window rolling:12 (
derive [trail_12_m_comp = sum paycheck]
)
)
We should really put parentheses around the group's "content" and not around aggregate.
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.
Great!
And it's fine to leave a comment in the code for something that's not quite there yet!
@@ -7,13 +7,16 @@ mod semantic; | |||
mod sql; | |||
mod utils; | |||
|
|||
use crate::{ast::Item}; |
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 don't know if you have a conventions (eg. should you put imports in alphabetical order, separate blocks of imports by line breaks, etc.)
Plus, I didn't research the difference between use
and pub use
.
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.
cargo fmt
will organize these!
@florent-martineau this is really good. Congratulations on your first PR! As discussed on Discord, I'm happy to help finish this off — your call on how much you want to do yourself vs ask for help. To merge, we need a couple of additions:
|
@florent-martineau FYI I merged the latest main into your branch, so run |
@florent-martineau thanks for kicking this off! We merged #829 so I'll close this. But congrats on your first open-source PR, and we'd be happy to work together on another. |
The goal of this PR is:
Please note that it's my first PR on an open source repository, plus I had never seen a line of Rust until yesterday, so please be indulgent 😅