Fix std::fmt::Display for abort expressions#830
Fix std::fmt::Display for abort expressions#830DylanRJohnston wants to merge 10 commits intovectordotdev:mainfrom
std::fmt::Display for abort expressions#830Conversation
|
Just noticed a few more instances of failing to serialize out re-parsable expressions, namely infailable function calls and queries. |
src/parser/ast.rs
Outdated
| impl fmt::Display for Query { | ||
| fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { | ||
| write!(f, "{}{}", self.target, self.path) | ||
| write!(f, "{}.{}", self.target, self.path) |
There was a problem hiding this comment.
Without this variable queries end up mushed together e.g. foo.bar becomes foobar however that then causes .foo.bar to become ..foo.bar without the change to QueryTarget below.
src/parser/ast.rs
Outdated
| Internal(v) => v.fmt(f), | ||
| External(prefix) => match prefix { | ||
| PathPrefix::Event => write!(f, "."), | ||
| PathPrefix::Event => write!(f, ""), |
There was a problem hiding this comment.
Should probably just remove this write! all together? If I understand correctly, and based on my testing QueryTarget always appears with a . after it even if OwnedValuePath is empty. So this is safe.
|
Hi @DylanRJohnston, your project sounds quite interesting but this PR breaks a test. I don't have time to do a thorough review but for faster dev iterations you can locally use |
|
Hi @DylanRJohnston, since this is deep change, it is also worth pointing Vector's VRL dependency to this sha and see if those CI checks are passing. |
|
Hey @pront apologies I was waiting until the project was complete before coming back to fixing this pull request as I keep uncovering new problems as the project progresses and I didn't want to waste everyone's time with lots of pull requests. Since these changes are only needed at transpile time I've been able to get away with just using a fork for now although I am very interested in getting something like these changes merged into upstream. I also made a fairly controversial decision to overload the I also want to write some more comprehensive tests that ensure the |
Fixes #829. I couldn't see any tests for this code, but a very simply one exists as I wrote in the issue. Let me know if you want that included and where it should live.