GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — feat: Capture expression name part delimiters by mountaincrab · Pull Request #2001 · JSQLParser/JSqlParser Conversation
Contributor
ContextA lot of databases (e.g. Snowflake, Databricks, Redshift) support querying nested data. For example, a query like this SELECT ("i"."json_data":"rocket_name")::VARCHAR AS "rocket_name" FROM "mydatabase"."myschema"."mytable" as "i" queries the We would like to know if a column expression is referring to nested data or not. Examining the delimiters (e.g. ProblemCurrently, statements like the above (which contain colons as delimiters) can be parsed (as of #1134). However, the delimiters are not captured, which means they're not available in any of the model objects like "i"."json_data":"rocket_name" and then deparse it, you get: "i"."json_data"."rocket_name" SolutionThis PR introduces a change to the grammar so that the delimiters are captured. Furthermore, the model classes have been
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
mountaincrab
commented
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This class is only used by the parser - it's the return value of the
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Put it into the parser grammar then.
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. OK I'll add it as a static class in the parser
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
mountaincrab
commented
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we should add the colon to the optional part here as well, but it wasn't there before I made the change (
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looks consistent to me, I would do the same.
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
mountaincrab
force-pushed
the
feat/capture-name-part-delimiters
branch
from
4db1a41 to
8d57096
Compare
Contributor
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
Contributor
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
Contributor
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
Contributor
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
Contributor
Author
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
Contributor
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
Contributor
Author
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
Contributor
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
Contributor
Author
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
Contributor
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
Contributor
Author
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
|
There was an error while loading. Please reload this page.
|
Months later I stumble on it while working on -- DataBricks SELECT c1:price j FROM VALUES('{ "price": 5 }') AS T(c1); -- regular SQL SELECT c1::JSON -> 'price' j FROM VALUES('{ "price": 5 }') AS T(c1); So I am going to rewrite this part, which may break whatever you have been using it for. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
- `:` is allowed as delimiter in table names (for INFORMIX) - otherwise `:` will return a JSON expression and can't be used as column delimiter - see #1134 and #2001 Signed-off-by: Andreas Reichel <[email protected]>
There was an error while loading. Please reload this page.
Hi @manticore-projects, been a while 😁 Which bit is wrong sorry? I don't think a part following a colon always means it's a JSON extract path operator. I mentioned in one of my comments above:
Also, if I remember correctly, in databricks, you don't actually have to use colons at all in an expression - you can use all periods, and it'll work out which name part is the column, and then everything after that is the json extract path! |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
Greetings!
This is how it works now (after my corrections). |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Ah ok I see! I never actually ended up using the captured name part delimiters, but I think this still might affect our code, I'll have a look! Thanks for letting me know 😄 |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.