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

[BugFix] Support catalog name in Show materialized views #56174

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

Conversation

amoghmargoor
Copy link

@amoghmargoor amoghmargoor commented Feb 21, 2025

Why I'm doing:

Show Materialized View should honor fully qualified name of database ie.., catalog_name.database_name which fails currently
mysql> mysql> show materialized views from default_catalog.test; ERROR 5501 (3F000): Getting analyzing error. Detail message: Unknown database 'default_catalog.test'. mysql> mysql>

What I'm doing:

In this patch the catalog name will be accepted as a part of fully qualified database name in SHOW MATERIALIZED VIEW.

Fixes #54134

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.4
    • 3.3
    • 3.2
    • 3.1
    • 3.0

@amoghmargoor amoghmargoor requested review from a team as code owners February 21, 2025 18:49
@amoghmargoor amoghmargoor changed the title Support catalog name in Show materialized views [BugFix] Support catalog name in Show materialized views Feb 21, 2025
@@ -310,7 +310,14 @@ public ShowResultSet visitShowStatement(ShowStmt statement, ConnectContext conte
@Override
public ShowResultSet visitShowMaterializedViewStatement(ShowMaterializedViewsStmt statement, ConnectContext context) {
String dbName = statement.getDb();
Database db = GlobalStateMgr.getCurrentState().getLocalMetastore().getDb(dbName);
String catalogName = statement.getCatalogName();

Choose a reason for hiding this comment

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

why do we need to update/fix ShowExecutor for show materialized views?

Copy link
Author

@amoghmargoor amoghmargoor Feb 24, 2025

Choose a reason for hiding this comment

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

because ShowExecutor handles the SHOW command including show materialised views.

Choose a reason for hiding this comment

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

oh. Somehow I thought ShowExecutor is for show backends for the backend/executor nodes. This is for executing show statements.

murphyatwork
murphyatwork previously approved these changes Feb 26, 2025
Copy link

[Java-Extensions Incremental Coverage Report]

pass : 0 / 0 (0%)

Copy link

[FE Incremental Coverage Report]

fail : 12 / 16 (75.00%)

file detail

path covered_line new_line coverage not_covered_line_detail
🔵 com/starrocks/sql/ast/ShowMaterializedViewsStmt.java 4 7 57.14% [98, 126, 127]
🔵 com/starrocks/sql/analyzer/ShowStmtAnalyzer.java 4 5 80.00% [196]
🔵 com/starrocks/qe/ShowExecutor.java 4 4 100.00% []

Copy link

[BE Incremental Coverage Report]

pass : 0 / 0 (0%)

@amoghmargoor
Copy link
Author

@murphyatwork Just added UT for more code coverage. Can you reapprove it ?

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.

Show Materialized View should honor fully qualified name of database ie.., catalog_name.database_name
3 participants