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(catalog): add rw_catalog.actor_id_to_ddl, rw_catalog.fragment_id_to_ddl #17229

Merged
merged 4 commits into from
Jun 13, 2024

Conversation

kwannoel
Copy link
Contributor

@kwannoel kwannoel commented Jun 13, 2024

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

What's changed and what's your intention?

Closes #17056

dev=> create table t(v1 int);
CREATE_TABLE
dev=> select * from rw_fragment_id_to_ddl;
 fragment_id | job_id | schema_id | ddl_type | name 
-------------+--------+-----------+----------+------
           2 |      1 |         0 | table    | t
           1 |      1 |         0 | table    | t
(2 rows)

dev=> select * from rw_actor_id_to_ddl;
 actor_id | fragment_id | job_id | schema_id | ddl_type | name 
----------+-------------+--------+-----------+----------+------
        8 |           2 |      1 |         0 | table    | t
        7 |           2 |      1 |         0 | table    | t
        6 |           2 |      1 |         0 | table    | t
        5 |           2 |      1 |         0 | table    | t
        4 |           1 |      1 |         0 | table    | t
        3 |           1 |      1 |         0 | table    | t
        2 |           1 |      1 |         0 | table    | t
        1 |           1 |      1 |         0 | table    | t
(8 rows)

dev=> create sink s1 as select * from t with (connector='blackhole');
CREATE_SINK

dev=> select name, job_id, array_agg(actor_id) from rw_actor_id_to_ddl group by name, job_id;
 name | job_id |     array_agg     
------+--------+-------------------
 t    |      1 | {8,7,6,5,4,3,2,1}
 s1   |      2 | {12,11,10,9}

Checklist

  • I have written necessary rustdoc comments
  • I have added necessary unit tests and integration tests
  • I have added test labels as necessary. See details.
  • 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

Users can use rw_catalog.actor_id_to_ddl, rw_catalog.fragment_id_to_ddl to query ddl info corresponding to fragments and actors.

Copy link
Contributor

@yezizp2012 yezizp2012 left a comment

Choose a reason for hiding this comment

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

LGTM!
Nits: can we rename them to actor_id_to_job and fragment_id_to_job?

src/frontend/src/catalog/system_catalog/rw_catalog/mod.rs Outdated Show resolved Hide resolved
@kwannoel
Copy link
Contributor Author

kwannoel commented Jun 13, 2024

LGTM! Nits: can we rename them to actor_id_to_job and fragment_id_to_job?

Since it's user-facing, I prefer actor_id_to_ddl. job is not really a formalized concept for users. But DDL is.

@kwannoel kwannoel added the user-facing-changes Contains changes that are visible to users label Jun 13, 2024
@kwannoel kwannoel enabled auto-merge June 13, 2024 06:51
@kwannoel kwannoel added this pull request to the merge queue Jun 13, 2024
Merged via the queue into main with commit a59356f Jun 13, 2024
34 of 35 checks passed
@kwannoel kwannoel deleted the kwannoel/useful-sqls branch June 13, 2024 07:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/feature user-facing-changes Contains changes that are visible to users
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support a system view to fetch the DDL using actor_id
2 participants