Repository navigation
feat: add a custom ExprPlanner to support colon operator - #57
Conversation
Closes datafusion-contrib#26 - Add a custom `ExprPlanner` that handles `:` as an operator and re-writes it to `variant_get`.
|
TODO:
|
friendlymatthew
left a comment
There was a problem hiding this comment.
Thanks @Samyak2
Can we add some tests as well please
| #[derive(Debug)] | ||
| pub struct VariantExprPlanner; |
There was a problem hiding this comment.
Can we add some comments here that explain what this does
There was a problem hiding this comment.
Done. Please take a look
|
There seems to a bug in the sql parser. These are failing: and fails with: |
|
Another problem. Cast does not get parsed as a
So we won't be able to support 3-arg version like |
Is this a bug though? It seems like a Databricks dialect specifics.
Another issue to work on in sqlparser-rs? |
I don't see any reason not to support
This would be something to add in datafusion's Both of these are not blocking issues. I think we can merge without them. What do you think? |
|
Sounds good to me. @friendlymatthew? |
|
@sdf-jkl also posted to the mailing list here: https://lists.apache.org/thread/bg71srlcd84y4gv42cqzdo3j6mj3t93f |
There was a problem hiding this comment.
Thanks @Samyak2!
There are still some cases that might not work as expected in parity with Spark:
{
"name": "Alice",
"field-name": "hyphen",
"field name": "space",
"a]b": "bracket"
}| Expression | Spark | This crate + #57 |
|---|---|---|
v:`name` |
"Alice" | SQL NULL |
v:`field-name` |
"hyphen" | SQL NULL |
v:`field name` |
"space" | SQL NULL |
v:['a]b'] |
Expected "bracket" from parser logic; runtime verification pending | Path-parser error |
But I'd defer this to later work for syntax hardening
|
I added the syntax support SLT suite here #68 |
|
Thank you for merging! Sorry, I had not been keeping up with the progress around variant, but looks like this crate is finally picking up steam again 🚀 |
Indeed, we have recruited @sdf-jkl (well, really he volunteered) and I have a good feeling about the future of this crate |

Closes #26
ExprPlannerthat handles:as an operator and re-writes it tovariant_get.