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

[Enhancement] support trino's show schemas function #50586

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

rohitrs1983
Copy link
Contributor

@rohitrs1983 rohitrs1983 commented Sep 2, 2024

Why I'm doing:

What I'm doing:

mysql> set sql_dialect=trino;

mysql> show schemas;
+--------------------+
| Database |
+--------------------+
| statistics |
| information_schema |
| mydb |
| sys |
+--------------------+

mysql> show schemas from default_catalog;
+--------------------+
| Database |
+--------------------+
| statistics |
| information_schema |
| mydb |
| sys |
+--------------------+

mysql> show schemas from default_catalog like '__db';
+----------+
| Database |
+----------+
| mydb |
+----------+

Fixes #40894

What type of PR is this:

  • BugFix
  • Feature
  • Enhancement
  • Refactor
  • UT
  • Doc
  • Tool

Does this PR entail a change in behavior?

  • Yes, this PR will result in a change in behavior.
  • No, this PR will not result in a change in behavior.

If yes, please specify the type of change:

  • Interface/UI changes: syntax, type conversion, expression evaluation, display information
  • Parameter changes: default values, similar parameters but with different default values
  • Policy changes: use new policy to replace old one, functionality automatically enabled
  • Feature removed
  • Miscellaneous: upgrade & downgrade compatibility, etc.

Checklist:

  • I have added test cases for my bug fix or my new feature
  • This pr needs user documentation (for new or modified features or behaviors)
    • I have added documentation for my new feature or new function
  • This is a backport pr

Bugfix cherry-pick branch check:

  • I have checked the version labels which the pr will be auto-backported to the target branch
    • 3.3
    • 3.2
    • 3.1
    • 3.0
    • 2.5

@rohitrs1983 rohitrs1983 requested a review from a team as a code owner September 2, 2024 15:04
@rohitrs1983 rohitrs1983 changed the title [Enhancement] support Trino's show schemas function [Enhancement] support trino's show schemas function Sep 2, 2024
Copy link

github-actions bot commented Sep 2, 2024

[Java-Extensions Incremental Coverage Report]

pass : 0 / 0 (0%)

Copy link

github-actions bot commented Sep 2, 2024

[FE Incremental Coverage Report]

pass : 0 / 0 (0%)

Copy link

github-actions bot commented Sep 2, 2024

[BE Incremental Coverage Report]

pass : 0 / 0 (0%)

@wangsimo0
Copy link
Contributor

hi rohitrs1983 thanks for your contribution!
trino's show schema is a very useful sql that sr didn't support in trino's SQL dialect. However I think it is better supported under sr's trino dialect instead of introducing schema into starrocks. cause starrocks doesn't have the concept of schema all the time.
do you mind support this in trinotransformer? https://github.com/StarRocks/starrocks/tree/7982265b4e0ba59e5cfc882e44b1a7cbfe361923/fe/fe-core/src/main/java/com/starrocks/connector/parser/trino
And I think trino's show schemas from catalog is same as starrocks show databases from catalog.

@rohitrs1983
Copy link
Contributor Author

rohitrs1983 commented Sep 11, 2024

hi rohitrs1983 thanks for your contribution! trino's show schema is a very useful sql that sr didn't support in trino's SQL dialect. However I think it is better supported under sr's trino dialect instead of introducing schema into starrocks. cause starrocks doesn't have the concept of schema all the time. do you mind support this in trinotransformer? https://github.com/StarRocks/starrocks/tree/7982265b4e0ba59e5cfc882e44b1a7cbfe361923/fe/fe-core/src/main/java/com/starrocks/connector/parser/trino And I think trino's show schemas from catalog is same as starrocks show databases from catalog.

@wangsimo0 ok got it. let me give it a try. thanks for the review.

@rohitrs1983 rohitrs1983 requested a review from a team as a code owner September 14, 2024 18:10
@rohitrs1983
Copy link
Contributor Author

hi rohitrs1983 thanks for your contribution! trino's show schema is a very useful sql that sr didn't support in trino's SQL dialect. However I think it is better supported under sr's trino dialect instead of introducing schema into starrocks. cause starrocks doesn't have the concept of schema all the time. do you mind support this in trinotransformer? https://github.com/StarRocks/starrocks/tree/7982265b4e0ba59e5cfc882e44b1a7cbfe361923/fe/fe-core/src/main/java/com/starrocks/connector/parser/trino And I think trino's show schemas from catalog is same as starrocks show databases from catalog.

@wangsimo0 ok got it. let me give it a try. thanks for the review.

@wangsimo0 updated trino dialect. can you please review.

Copy link

sonarcloud bot commented Sep 15, 2024

Quality Gate Failed Quality Gate failed

Failed conditions
C Reliability Rating on New Code (required ≥ A)

See analysis details on SonarCloud

Catch issues before they fail your Quality Gate with our IDE extension SonarLint

@@ -321,7 +321,7 @@ setCatalogStatement

showDatabasesStatement
: SHOW DATABASES ((FROM | IN) catalog=qualifiedName)? ((LIKE pattern=string) | (WHERE expression))?
| SHOW SCHEMAS ((LIKE pattern=string) | (WHERE expression))?
| SHOW SCHEMAS (FROM catalog=qualifiedName)? ((LIKE pattern=string) | (WHERE expression))?
Copy link
Contributor

Choose a reason for hiding this comment

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

If you convert show shemas to show databases using trino parser, there is no need to modify starrocks parser

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Good First Issue]StarRocks Hands-on Tasks 2024
4 participants