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

[FLINK-34915][table] Complete DESCRIBE CATALOG syntax #24630

Merged
merged 5 commits into from
Apr 28, 2024

Conversation

liyubin117
Copy link
Contributor

What is the purpose of the change

Describe the metadata of an existing catalog. The metadata information includes the catalog’s name, type, and comment. If the optional EXTENDED option is specified, catalog properties are also returned.

Brief change log

  • { DESCRIBE | DESC } CATALOG [EXTENDED] catalog_name

Verifying this change

This change added tests and can be verified as follows:

flink-table/flink-sql-client/src/test/resources/sql/catalog_database.q
flink-table/flink-sql-gateway/src/test/resources/sql/catalog_database.q

Does this pull request potentially affect one of the following parts:

  • Dependencies (does it add or upgrade a dependency): no
  • The public API, i.e., is any changed class annotated with @Public(Evolving): no
  • The serializers: no
  • The runtime per-record code paths (performance sensitive): no
  • Anything that affects deployment or recovery: JobManager (and its components), Checkpointing, Kubernetes/Yarn/Mesos, ZooKeeper: no
  • The S3 file system connector: no

Documentation

  • Does this pull request introduce a new feature? yes
  • If yes, how is the feature documented? yes

@flinkbot
Copy link
Collaborator

flinkbot commented Apr 7, 2024

CI report:

Bot commands The @flinkbot bot supports the following commands:
  • @flinkbot run azure re-run the last Azure build

@liyubin117
Copy link
Contributor Author

@LadyForest Hi, Could you please take a review? thanks!

Copy link
Contributor

@LadyForest LadyForest left a comment

Choose a reason for hiding this comment

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

Hi @liyubin117 thanks for the contribution! I left two comments, PTAL

@liyubin117
Copy link
Contributor Author

@flinkbot run azure

@liyubin117
Copy link
Contributor Author

@LadyForest Hi, I have updated as you said, besides, rebased on the latest master branch and CI passed, PTAL, thanks :)

@liyubin117 liyubin117 force-pushed the describe_catalog branch 3 times, most recently from b0d376c to 0945797 Compare April 20, 2024 07:21
Copy link
Contributor

@LadyForest LadyForest left a comment

Choose a reason for hiding this comment

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

Thanks for the update! I left some comments, PTAL

Arrays.asList("comment", "") // TODO: retain for future needs
));
if (isExtended) {
properties.forEach((key, value) -> rows.add(Arrays.asList("option:" + key, value)));
Copy link
Contributor

Choose a reason for hiding this comment

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

This might be a little bit verbose

desc catalog extended cat2;
+-------------------------+-------------------+
|               info name |        info value |
+-------------------------+-------------------+
|                    name |              cat2 |
|                    type | generic_in_memory |
|                 comment |                   |
| option:default-database |                db |
|             option:type | generic_in_memory |
+-------------------------+-------------------+
5 rows in set
!ok

what about

desc catalog extended cat2;
+-------------------------+-------------------+
|               info name |        info value |
+-------------------------+-------------------+
|                    name |              cat2 |
|                    type | generic_in_memory |
|                 comment |                   |
| option:default-database |                db |
+-------------------------+-------------------+
4 rows in set
!ok

or

desc catalog extended cat2;
+-------------------------+-------------------+
|               info name |        info value |
+-------------------------+-------------------+
|                    name |              cat2 |
|                 comment |                   |
| option:default-database |                db |
|             option:type | generic_in_memory |
+-------------------------+-------------------+
4 rows in set
!ok
        if (isExtended) {
            properties.entrySet().stream()
                    .filter(entry -> !"type".equals(entry.getKey()))
                    .sorted(Map.Entry.comparingByKey())
                    .forEach(
                            entry ->
                                    rows.add(
                                            Arrays.asList(
                                                    String.format("option:%s", entry.getKey()),
                                                    entry.getValue())));
        }

Copy link
Contributor Author

@liyubin117 liyubin117 Apr 23, 2024

Choose a reason for hiding this comment

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

I have updated as the first output style, and will raise a discussion in dev mail. thanks for your suggesion~

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor

@LadyForest LadyForest left a comment

Choose a reason for hiding this comment

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

Hi, @liyubin117, thanks for your update. I only left one comment on the doc structure and added a commit to simplify it. PTAL

@liyubin117
Copy link
Contributor Author

@flinkbot run azure

Copy link
Contributor

@LadyForest LadyForest left a comment

Choose a reason for hiding this comment

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

Thanks for the update. LGTM

@LadyForest LadyForest merged commit e412402 into apache:master Apr 28, 2024
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.

3 participants