-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
sql: support json_populate_record, json_populate_recordset, json_to_record, json_to_recordset #70037
Comments
I took a stab at doing this tonight. It was way more annoying than expected! Here is the WIP branch: https://github.com/cockroachdb/cockroach/compare/master...jordanlewis:json-to-record?expand=1 The main annoyance is that functions that return records have a requirement that they're aliased to column definition lists, with types. Our parser doesn't support this - column aliases don't have types. Also, it means that we need to plumb alias information down into the thing that's getting aliased, which is awkward, and somehow plumb that info even deeper into the generator func factory. I think this is doable with a bit more work. |
70115: sql: add json{,b}_populate_record{,set} r=jordanlewis a=jordanlewis Updates #69010 Updates #70037 These generator builtins permit type-safe transformation of JSON to table data. They're added for compatibility with PostgreSQL. Release note (sql change): add the json_populate_record, jsonb_populate_record functions, json_populate_recordset, and jsonb_populate_recordset functions, which transform JSON into row tuples based on the labels in a record type. 70289: ci: add `bazel Nightlies / SQLite logic tests` job for CI r=rail a=rickystewart Release note: None Co-authored-by: Jordan Lewis <[email protected]> Co-authored-by: Ricky Stewart <[email protected]>
@jordanlewis your WIP branch is empty (at least, for |
Oops, I must have screwed up the branch here - I ended up switching focus to the stuff we needed for
|
Re-pushed. I think the WIP was very WIP, please let me know if you have questions about it. The main summary is that the builtins need more information than what we have today - they need to know the |
urgh! yeah i had kinda the same problem trying to implement array concatenation (#71447), specifically with |
do you recall why your WIP was still a WIP? or what else is left? |
I just think I didn't finish implementing the builtin all the way. Sorry, I know this isn't much to go off. I can try to page back in the state of what was going on with the patch this week if it would help. |
i've gone a little further on #72137. what a plumbing exercise! basically, i'm stuck at passing i couldn't find anywhere obvious to put it and i'm pretty sure the way i fought the Start call in the optimiser is a complete hack. not sure what to do next. |
Needed for #69010.
This was originally tracked in #20120.
We currently don't support the following four builtin functions, which are different ways to convert an unstructured JSON datum (or set of JSON datums) into a structure record datum (or set of record datums):
json_populate_record
json_populate_recordset
json_to_record
json_to_recordset
As with most builtins, these have corresponding
jsonb
versions which should get identical implementations.These builtins will be more useful once we address #70036.
Epic CRDB-10300
Jira issue: CRDB-9913
The text was updated successfully, but these errors were encountered: