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

DESCRIBE can't be used to describe user defined types #14170

Closed
cvybhu opened this issue Jun 7, 2023 · 2 comments · Fixed by #14334
Closed

DESCRIBE can't be used to describe user defined types #14170

cvybhu opened this issue Jun 7, 2023 · 2 comments · Fixed by #14334
Assignees
Labels
area/cql feature/enhancement symptom/ux Concerns regarding the user experience in working with Scylla.
Milestone

Comments

@cvybhu
Copy link
Contributor

cvybhu commented Jun 7, 2023

Trying to DESC a UDT using cqlsh throws an error: 'my_udt' not found in keyspace 'ks':

CREATE KEYSPACE ks WITH replication = {'class': 'NetworkTopologyStrategy', 'replication_factor': 1};
CREATE TYPE ks.my_udt (a int, b int);
DESC ks.my_udt;

'my_udt' not found in keyspace 'ks'

It's possible to see information about the UDT by describing the whole keyspace:

DESC ks;

CREATE KEYSPACE ks WITH replication = {'class': 'NetworkTopologyStrategy', 'datacenter1': '1'}  AND durable_writes = true;

CREATE TYPE ks.my_udt (
    a int,
    b int
);

So the code for describing a UDT is already there, but it isn't triggered when someone tries to DESCRIBE the type directly.

Interestingly, it doesn't work on Cassandra as well.

\cc @Jadw1

@cvybhu cvybhu added symptom/ux Concerns regarding the user experience in working with Scylla. area/cql labels Jun 7, 2023
@Jadw1
Copy link
Contributor

Jadw1 commented Jun 7, 2023

This is because you are using generic describe (without specifying what you want to describe) and generic describe looks for(in order): keyspace, table, index. It doesn't check UDTs, UDFs nor UDAs.

If you use DESC TYPE ks.my_udt it works.
I've followed Cassandra's implementation, but we can easily extend our implementation to include missed items.

@cvybhu
Copy link
Contributor Author

cvybhu commented Jun 7, 2023

Ah you're right, DESC TYPE ks.my_udt works.

It's a bit unintuitive, I expected DESC to just describe any entity I specify.
I think it would be nice to extend it to also handle UDTs, UDFs, etc.

But we can also say that the user should just read the DESCRIBE documentation, if you think it's not worth it feel free to close this issue.

@Jadw1 Jadw1 self-assigned this Jun 21, 2023
@mykaul mykaul added this to the 5.4 milestone Jun 21, 2023
Jadw1 added a commit to Jadw1/scylla that referenced this issue Jun 22, 2023
…scribe

So far generic describe (`DESC <name>`) followed Cassandra
implementation and it only described keyspace/table/view/index.

This commit adds UDT/UDF/UDA to generic describe.

Fixes: scylladb#14170
Jadw1 added a commit to Jadw1/scylla that referenced this issue Jun 23, 2023
…scribe

So far generic describe (`DESC <name>`) followed Cassandra
implementation and it only described keyspace/table/view/index.

This commit adds UDT/UDF/UDA to generic describe.

Fixes: scylladb#14170
Jadw1 added a commit to Jadw1/scylla that referenced this issue Jun 23, 2023
…scribe

So far generic describe (`DESC <name>`) followed Cassandra
implementation and it only described keyspace/table/view/index.

This commit adds UDT/UDF/UDA to generic describe.

Fixes: scylladb#14170
Jadw1 added a commit to Jadw1/scylla that referenced this issue Jun 28, 2023
…scribe

So far generic describe (`DESC <name>`) followed Cassandra
implementation and it only described keyspace/table/view/index.

This commit adds UDT/UDF/UDA to generic describe.

Fixes: scylladb#14170
Jadw1 added a commit to Jadw1/scylla that referenced this issue Jun 30, 2023
…scribe

So far generic describe (`DESC <name>`) followed Cassandra
implementation and it only described keyspace/table/view/index.

This commit adds UDT/UDF/UDA to generic describe.

Fixes: scylladb#14170
@DoronArazii DoronArazii modified the milestones: 5.4, Backlog Aug 6, 2023
@mykaul mykaul modified the milestones: Backlog, 6.0 Sep 24, 2023
nyh added a commit that referenced this issue Sep 24, 2023
…eric describe' from Michał Jadwiszczak

So far generic describe (`DESC <name>`) followed Cassandra implementation and it only described keyspace/table/view/index.

This commit adds UDT/UDF/UDA to generic describe.

Fixes: #14170

Closes #14334

* github.com:scylladb/scylladb:
  docs:cql: add information  about generic describe
  cql-pytest:test_describe: add test for generic UDT/UDF/UDA desc
  cql3:statements:describe_statement: include UDT/UDF/UDA in generic describe
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/cql feature/enhancement symptom/ux Concerns regarding the user experience in working with Scylla.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants