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

feat: expose hidden and distribution keys of columns in sql command and rw_columns #12839

Merged
merged 7 commits into from Oct 17, 2023

Conversation

yezizp2012
Copy link
Contributor

@yezizp2012 yezizp2012 commented Oct 13, 2023

I hereby agree to the terms of the RisingWave Labs, Inc. Contributor License Agreement.

What's changed and what's your intention?

Resolve #12808 :

  1. expose hidden columns in commands of DESCRIBE and SHOW COLUMNS FROM.
  2. expose distribution keys in SHOW COLUMNS FROM.
  3. add is_hidden, is_primary_key and is_distribution_key columns in rw_columns.
  4. primary keys of a table is already supported in SHOW COLUMNS FROM.
dev=> create table t1(v1 int);
CREATE_TABLE
dev=> create table t2 (v1 int, v2 int, primary key(v1, v2));
CREATE_TABLE
dev=> describe t1;
       Name       |  Type   | Is Hidden
------------------+---------+-----------
 v1               | integer | false
 _row_id          | serial  | true
 primary key      | _row_id |
 distribution key | _row_id |
(4 rows)

dev=> describe t2;
       Name       |  Type   | Is Hidden
------------------+---------+-----------
 v1               | integer | false
 v2               | integer | false
 primary key      | v1, v2  |
 distribution key | v1, v2  |
(4 rows)

dev=> show columns from t1;
  Name   |  Type   | Is Hidden
---------+---------+-----------
 v1      | integer | false
 _row_id | serial  | true
(2 rows)

dev=> show columns from t2;
 Name |  Type   | Is Hidden
------+---------+-----------
 v1   | integer | false
 v2   | integer | false
(2 rows)

dev=> select * from rw_columns where relation_id = 1014 or relation_id = 1015;
 relation_id |  name   | position | is_hidden | is_primary_key | is_distribution_key | data_type | type_oid | type_len | udt_type
-------------+---------+----------+-----------+----------------+---------------------+-----------+----------+----------+----------
        1014 | v1      |        1 | f         | f              | f                   | integer   |       23 |        4 | int4
        1014 | _row_id |        2 | t         | t              | t                   | serial    |       20 |        8 | serial
        1015 | v1      |        1 | f         | t              | t                   | integer   |       23 |        4 | int4
        1015 | v2      |        2 | f         | t              | t                   | integer   |       23 |        4 | int4
(4 rows)

Checklist

  • I have written necessary rustdoc comments
  • I have added necessary unit tests and integration tests
  • I have added fuzzing tests or opened an issue to track them. (Optional, recommended for new SQL features Sqlsmith: Sql feature generation #7934).
  • My PR contains breaking changes. (If it deprecates some features, please create a tracking issue to remove them in the future).
  • All checks passed in ./risedev check (or alias, ./risedev c)
  • My PR changes performance-critical code. (Please run macro/micro-benchmarks and show the results.)
  • My PR contains critical fixes that are necessary to be merged into the latest release. (Please check out the details)

Documentation

  • My PR needs documentation updates. (Please use the Release note section below to summarize the impact on users)

Release note

If this PR includes changes that directly affect users or other significant modifications relevant to the community, kindly draft a release note to provide a concise summary of these changes. Please prioritize highlighting the impact these changes will have on users.

  1. expose hidden columns in commands of DESCRIBE and SHOW COLUMNS FROM.
  2. expose distribution keys in SHOW COLUMNS FROM.
  3. add is_hidden, is_primary_key and is_distribution_key columns in rw_columns.
  4. primary keys of a table is already supported in SHOW COLUMNS FROM.

@codecov
Copy link

codecov bot commented Oct 16, 2023

Codecov Report

Merging #12839 (15ce212) into main (3fd760e) will increase coverage by 0.00%.
The diff coverage is 66.66%.

@@           Coverage Diff           @@
##             main   #12839   +/-   ##
=======================================
  Coverage   69.17%   69.17%           
=======================================
  Files        1489     1489           
  Lines      245901   245973   +72     
=======================================
+ Hits       170094   170145   +51     
- Misses      75807    75828   +21     
Flag Coverage Δ
rust 69.17% <66.66%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
...talog/system_catalog/information_schema/columns.rs 100.00% <100.00%> (ø)
.../catalog/system_catalog/pg_catalog/pg_attribute.rs 100.00% <100.00%> (ø)
src/frontend/src/handler/show.rs 26.61% <100.00%> (+0.44%) ⬆️
src/frontend/src/handler/util.rs 88.52% <100.00%> (+0.19%) ⬆️
...rc/catalog/system_catalog/rw_catalog/rw_columns.rs 76.34% <76.19%> (-23.66%) ⬇️
src/frontend/src/session.rs 29.97% <0.00%> (-0.37%) ⬇️
src/frontend/src/handler/describe.rs 77.77% <60.52%> (+3.56%) ⬆️

... and 5 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

Copy link
Contributor

@chenzl25 chenzl25 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@yezizp2012 yezizp2012 added this pull request to the merge queue Oct 17, 2023
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Oct 17, 2023
@yezizp2012 yezizp2012 added this pull request to the merge queue Oct 17, 2023
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Oct 17, 2023
@yezizp2012 yezizp2012 added this pull request to the merge queue Oct 17, 2023
Merged via the queue into main with commit b39aef3 Oct 17, 2023
26 of 27 checks passed
@yezizp2012 yezizp2012 deleted the feat/expose-hidden-dist-cols branch October 17, 2023 04:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Enhancement: show hidden column in rw_columns
2 participants