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

create table show comment #4925

Closed
BohuTANG opened this issue Apr 19, 2022 · 10 comments
Closed

create table show comment #4925

BohuTANG opened this issue Apr 19, 2022 · 10 comments
Labels
A-query Area: databend query community-take good first issue Category: good first issue

Comments

@BohuTANG
Copy link
Member

BohuTANG commented Apr 19, 2022

Summary

mysql> create table t1(a INT comment 'acomment') comment='mytable';
Query OK, 0 rows affected (0.03 sec)
Read 0 rows, 0 B in 0.007 sec., 0 rows/sec., 0 B/sec.

mysql> show create table t1;
+-------+------------------------------------------------------------------+
| Table | Create Table                                                     |
+-------+------------------------------------------------------------------+
| t1    | CREATE TABLE `t1` (
  `a` Int32, -- no comments here
) ENGINE=FUSE COMMENT='mytable' |
+-------+------------------------------------------------------------------+

@BohuTANG BohuTANG added A-query Area: databend query good first issue Category: good first issue labels Apr 19, 2022
@sunisdown
Copy link
Contributor

/assignme

@sunisdown
Copy link
Contributor

@BohuTANG I have no knowledge about query engine, so I want to pick this issue up and try to understand how query works, but when I check this issue, it seems that we haven't store the comments for field.

databend_query::catalogs::impls::database_catalog: Create table from req:CreateTableReq { if_not_exists: false, tenant: "admin", db_name: "default", table_name: "t1", table_meta: TableMeta { schema: DataSchema { fields: [DataField { name: "a", data_type: Int32, nullable: false }], metadata: {} }, engine: "FUSE", engine_options: {}, options: {"comment": "mytable", "database_id": "1"}, created_on: 2022-04-19T08:24:11.965435Z } }

Is the metadata field suitable for storing the comment?
https://github.com/datafuselabs/databend/blob/d18c5a438204758c52021b2047c19a17b03421bb/common/datavalues/src/data_schema.rs#L27-L31

@sunisdown
Copy link
Contributor

got the root cause.
seems that plan_parser doesn't handle the column comments
https://github.com/datafuselabs/databend/blob/2ca3014d8a8dc41b5ef0ec16780ea4c69e164ece/query/src/sql/statements/statement_create_table.rs#L167-L178

will add it.
by the way, this is a perfect issue for me, as it made me look in both the parse and query plan code, two areas I hadn't touched before.

@BohuTANG
Copy link
Member Author

BohuTANG commented Apr 20, 2022

@sunisdown
Sorry, I missed this comment, glad to see that you found it.

@wubx
Copy link
Member

wubx commented Jun 7, 2022

MySQL [(none)]> create table t1(a INT comment 'acomment');
ERROR 1105 (HY000): Code: 1022, displayText = COMMENT 'acomment' column option is not supported, please do not specify them in the CREATE TABLE statement.
MySQL [(none)]> select version();
+-----------------------------------------------------------------------------------------+
| @@version()                                                                             |
+-----------------------------------------------------------------------------------------+
| 8.0.26-v0.7.74-nightly-a556243-simd(rust-1.63.0-nightly-2022-06-06T16:24:09.098868778Z) |
+-----------------------------------------------------------------------------------------+
1 row in set (0.002 sec)

@BohuTANG
Copy link
Member Author

BohuTANG commented Jun 7, 2022

@wubx
This issue has not started yet.

@wubx
Copy link
Member

wubx commented Jun 7, 2022

I see you can create a table with comments, but my databend version can't do that.
Do I need a new issue?

@sunisdown
Copy link
Contributor

e you can create a table with comments, but my databend version can't do that.
Do I need a new issue?

It's the same issue, we can create table with table comments, but column comments are not support @wubx

@johnhaxx7
Copy link
Contributor

Seems like this issue is resolved in the linked ticket, good to close?

@BohuTANG
Copy link
Member Author

#5952

@github-project-automation github-project-automation bot moved this from Todo to Done in Databend Query Engine Jan 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-query Area: databend query community-take good first issue Category: good first issue
Projects
Development

No branches or pull requests

5 participants