feat(risingwave): support struct field access
Description of changes
Add a specific visit method for RisingWave visit_StructField.
"f{idx}" is not supported like in Postgres.
Use dot and parenthesis annotation as dots only is not working on the first level.
`dataframe.metadata["user.profile.link"].value.url``
Will be translated to:
`(((("t1"."metadata")."user.profile.link").value).url)``
Issues closed
- Resolves #11182
This is somewhat tricky because of the way risingwave encodes struct types.
Thanks for your reply @cpcloud. I don't really get what is the issue with the test that is failing. Can you briefly explain?
I think I managed to get a first version of this working (meaning passing all existing tests without changing the tests).
@cpcloud looks great! Thanks a lot for pushing this forward and getting the tests to pass! I know this PR wasn’t fully complete, so your help in finishing things up is much appreciated.
There are some complications here :)
- RisingWave's
DESCRIBEreturns a shredded schema, which would be fine if it actually segmented field names for fields in structs like this:STRUCT<"a.b.c" INT>. Currently it does not. - I tried querying
information_schema.columns, but that has the same problem: it returns the struct with unquoted fields, and sqlglot is not and will not handle the unquoted fields.
I think the changes need to come from RisingWave, in the form of quoting field names in whatever schema metadata is returned.
Moving to draft until there's a risingwave release with their changes.
Hi there! Can we reopen that one? :)
Going to do this in a separate, new PR.