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
Snowflake: Support semi-structured data #693
Conversation
Pull Request Test Coverage Report for Build 3375944460
💛 - Coveralls |
@AugustoFKL Thank you for your feedback! I change the code to still use the JsonAccess expression (because it's still access to JSON) But with Snowflake syntax support. Appreciate your feedback! |
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.
LGTM
@alamb ready for review :)
I found a bug on JsonAccess, the right value should be Value and not Identifier (Like Postgres). @AugustoFKL WDYT? If it seems right, any change for some assistance with the test? |
@yuval-illumex you can get the current dialect by using Please try this. The parser is trying to parse a value but is matching it to another expression. TBH there's 2 possible problems:
I'd try to test an expression without possible keywords and with this dialect validation adjust :) LMK if it goes ok |
@AugustoFKL Thank you for your response! your #2nd point was correct! Appreciate your feedback on the current PR. |
src/parser.rs
Outdated
@@ -3441,6 +3448,9 @@ impl<'a> Parser<'a> { | |||
Some('\'') => Ok(Value::SingleQuotedString(w.value)), | |||
_ => self.expected("A value?", Token::Word(w))?, | |||
}, | |||
Keyword::NoKeyword if dialect_of!(self is SnowflakeDialect) => { |
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.
@yuval-illumex adding the generic here is feasible?
I'd suggest adding it but, as identifiers have the same exact syntax, I don't know how that would work.
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.
@AugustoFKL added :)
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.
LGTM
@alamb ready for your look :)
@alamb @AugustoFKL I added support when the key the user tries to extract from the json is "location". I have a user who tried it. |
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.
Not sure whether is reasonable or not to nitpick keywords when parsing.
But If no tests break, don't think it's a problem for now...
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.
LGTM -- thank you @yuval-illumex and @AugustoFKL
Per snowflake documentation, Colon can be used to query semi-structured data (JSON).
I decided to use the
JsonAccess
expression (which is used by postgres), but if you think a new expression is needed - I will change.