Skip to content
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

[YCQL] Support selecting sub-field of a user-defined type #2786

Open
m-iancu opened this issue Oct 30, 2019 · 0 comments
Open

[YCQL] Support selecting sub-field of a user-defined type #2786

m-iancu opened this issue Oct 30, 2019 · 0 comments
Assignees
Labels
area/ycql Yugabyte CQL (YCQL) kind/enhancement This is an enhancement of an existing feature priority/medium Medium priority issue

Comments

@m-iancu
Copy link
Contributor

m-iancu commented Oct 30, 2019

Jira Link: DB-4680
For example, given the following schema:

create type udt1(i int, t text);
create type udt2(i int, u1 udt1);
create table test(k int primary key, u1 udt1, u2 udt2);

Allow queries like:

SELECT u1.i from test;
SELECT u2.u1.t, u1.t from test;

These can be handled similarly to the subscript_args (used for e.g. m['x'] or l[2]['x']) and may even be able to reuse most of that code (except for the parsing stage).

As suggested by @nocaway, this should also add more tests for expressions involving (nested) udt's in general. E.g.:

  • SELECT tojson(nesting_udt) FROM ....
  • SELECT indexing_expression(nesting_udt) FROM ....

For example:

cqlsh:test> create type udt1(i int, t text);
cqlsh:test> create type udt2(i int, u1 frozen<udt1>);
cqlsh:test> create table tab2(k int primary key, su set<frozen<udt2>>);
cqlsh:test> insert into tab2 (k, su) values (111, { { i : 1, u1 : { i : 1, t : '1001' } }, { i : 2, u1 : { i : 2, t : '1002' } } });
cqlsh:test> insert into tab2 (k, su) values (777, { { i : 3, u1 : { i : 3, t : '1003' } }, { i : 4, u1 : { i : 4, t : '1004' } } });
cqlsh:test> select tojson(su) from tab2;

 server_tojson(su)
---------------------------------------------------
 [{"i":3,"u1":[3,"1003"]},{"i":4,"u1":[4,"1004"]}]
 [{"i":1,"u1":[1,"1001"]},{"i":2,"u1":[2,"1002"]}]

(2 rows)
@rthallamko3 rthallamko3 added the area/ycql Yugabyte CQL (YCQL) label Dec 29, 2022
@yugabyte-ci yugabyte-ci added kind/bug This issue is a bug priority/medium Medium priority issue labels Dec 29, 2022
@yugabyte-ci yugabyte-ci added kind/enhancement This is an enhancement of an existing feature status/awaiting-triage Issue awaiting triage and removed kind/bug This issue is a bug status/awaiting-triage Issue awaiting triage labels Jan 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/ycql Yugabyte CQL (YCQL) kind/enhancement This is an enhancement of an existing feature priority/medium Medium priority issue
Projects
Status: No status
Development

No branches or pull requests

5 participants