-
Notifications
You must be signed in to change notification settings - Fork 602
Store spans for Value expressions #1738
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
feel free to edit the code directly without asking me first :) |
FYI @eliaperantoni -- any chance you are willing to help our with this one? |
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.
Looks awesome! This is a much needed feature, thank you for the contribution :) The library changes look good to me, I will help with the tests as soon as I can
I will post a note in DataFUsion slack and see if I can find anyone to help In terms of logitistics, I suggest people:
I will do an example of this for one or two in a moment |
@lovasoa here is a proposed contribution: If you like that, I think we can apply the same thing to the other tests fairly easily |
Ok, ast-grep is a bit of a pita to use with rust, but I managed to get it to do most of the work with the following rule: id: x
language: rust
rule:
any:
- kind: token_tree
pattern: $ARG
follows:
kind: identifier
pattern: Value
follows:
kind: identifier
pattern: Expr
stopBy: end
fix: ($ARG.with_empty_span()) the tests pass now ! |
Looking quite nice! Any chance you can pull the doc strings from lovasoa@4d101b0 as well? |
I did. I think this is ready for merging |
😬 I had forgotten to run |
It would be nice if we could get this merged before other pending PRs, because it touches almost all the tests, and is guaranteed to generate big conflicts as we change them. |
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.
Looks good to me.
@iffyio what do you think?
value: Box::new(Expr::Value(Value::SingleQuotedString(String::from( | ||
"123:45.67", | ||
)))), | ||
value: Box::new(Expr::Value( |
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.
minor stuff we could use the Expr::value
here too
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.
Yes! But I don't have the strength to fight ast-grep again 🙂
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 saw it in my editor and couldn't exist:
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.
Thanks @lovasoa!
Noticed some added comments in the bigquery tests I didn't follow and looked like they might need cleanup instead? Otherwise LGTM to merge in the meantime!
"SELECT ", // line 1, column 1 | ||
"'single', ", // line 1, column 7 | ||
r#""double", "#, // line 1, column 14 | ||
"'''triple-single''', ", // line 1, column 22 | ||
r#""""triple-double""", "#, // line 1, column 33 | ||
r#"'single\'escaped', "#, // line 1, column 43 | ||
r#"'''triple-single\'escaped''', "#, // line 1, column 55 | ||
r#"'''triple-single'unescaped''', "#, // line 1, column 68 | ||
r#""double\"escaped", "#, // line 1, column 83 | ||
r#""""triple-double\"escaped""", "#, // line 1, column 92 | ||
r#""""triple-double"unescaped""", "#, // line 1, column 105 | ||
r#""""triple-double'unescaped""", "#, // line 1, column 118 | ||
r#"'''triple-single"unescaped'''"#, // line 1, column 131 |
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.
do the added comments here need cleanup or do they serve a purpose?
🎉 |
@iffyio @alamb : I allowed edit by maintainers on this PR; help would be very welcome.
I implemented all the required changes in the library itself, but there are still massive (mostly repetitive and probably automatable) changes to make in the tests.
I would love if I could get some help on this, this should greatly decrease missing spans in parsed trees.