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

Implement DESCRIBE TABLE clause #534

Closed
waynexia opened this issue Nov 16, 2022 · 3 comments · Fixed by #558
Closed

Implement DESCRIBE TABLE clause #534

waynexia opened this issue Nov 16, 2022 · 3 comments · Fixed by #558
Assignees
Labels
C-feature Category Features

Comments

@waynexia
Copy link
Member

waynexia commented Nov 16, 2022

What problem does the new feature solve?

Describe the structure of a table, as well as the default values.

What does the feature do?

Support syntax like

DESC[RIBE] TABLE <name>;

It returns a table like this:

Name               Null             Type                Default        Semantic Type

ID                    Not Null        INT                    0           PRIMARY KEY
Timestamp                            TIMESTAMP                          TIME INDEX

Implementation challenges

  • Add these syntaxes to parser
  • Retrieve TableInfo from corresponding table
  • Extract infos from TableInfo and output them.
@morigs
Copy link
Contributor

morigs commented Nov 16, 2022

Hi, I was experimenting while exploring the source code and now I have almost complete implementation.
This missing piece of puzzle is how to get semantic type from ColumnSchema. If I'm not mistaken, it should be TIMESTAMP when is_time_index is true. But what about TAG? Should I treat fields from TableMeta.primary_key_indices as TAGs and the rest as FIELDs?

@waynexia
Copy link
Member Author

Should I treat fields from TableMeta.primary_key_indices as TAGs and the rest as FIELDs?

That's right! Sorry that the document isn't clear. Primary key and tag are the same thing here.

And since the CREATE TABLE clause uses PRIMARY KEY, I think I'd better to change the PR description to use this word as well. So the three possible value of "semantic type" here are TIME INDEX(not timestamp), PRIMARY KEY and VALUE (not field).

@morigs
Copy link
Contributor

morigs commented Nov 17, 2022

👍🏼 Thx, I'll try to implement this soon. Could you pls assign this to me?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-feature Category Features
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants