Skip to content

[Feature] Support show create MATERIALIZED VIEW sql  #9196

@dataalive

Description

@dataalive

Search before asking

  • I had searched in the issues and found no similar issues.

Description

after we create materialized view , we can only use desc table_name all to show all the materialized view which have been created.

MySQL [test]> create table sales_records(record_id int, seller_id int, store_id int, sale_date date, sale_amt bigint) distributed by hash(record_id) properties("replication_num" = "1");
Query OK, 0 rows affected (0.00 sec)

MySQL [test]> create materialized view store_amt as select store_id, sum(sale_amt) from sales_records group by store_id; 
Query OK, 0 rows affected (0.00 sec)

MySQL [test]> desc  sales_records all;
+---------------+---------------+-----------+--------+------+-------+---------+-------+---------+
| IndexName     | IndexKeysType | Field     | Type   | Null | Key   | Default | Extra | Visible |
+---------------+---------------+-----------+--------+------+-------+---------+-------+---------+
| sales_records | DUP_KEYS      | record_id | INT    | Yes  | true  | NULL    |       | true    |
|               |               | seller_id | INT    | Yes  | true  | NULL    |       | true    |
|               |               | store_id  | INT    | Yes  | true  | NULL    |       | true    |
|               |               | sale_date | DATE   | Yes  | false | NULL    | NONE  | true    |
|               |               | sale_amt  | BIGINT | Yes  | false | NULL    | NONE  | true    |
|               |               |           |        |      |       |         |       |         |
| store_amt     | AGG_KEYS      | store_id  | INT    | Yes  | true  | NULL    |       | true    |
|               |               | sale_amt  | BIGINT | Yes  | false | NULL    | SUM   | true    |
+---------------+---------------+-----------+--------+------+-------+---------+-------+---------+
8 rows in set (0.00 sec)

but sometimes we need to know the create materialized view sql like show create table table_name shows.

so the new feature should react like

show create materialized view store_amt;

and the result is the complete sql.

Use case

No response

Related issues

No response

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

Metadata

Metadata

Assignees

Labels

kind/featureCategorizes issue or PR as related to a new feature.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions