Skip to content

Conversation

@ahmedabu98
Copy link
Contributor

@ahmedabu98 ahmedabu98 commented Oct 14, 2025

Addresses #35637

Adds the following commands:

SHOW CATALOGS [ LIKE regex_pattern ]

+------+------+
| NAME | TYPE |
+------+------+
| my_very_long_catalog_name | local |
| default | local |
| my_catalog | local |
+------+------+

SHOW DATABASES [ ( FROM | IN )? catalog_name ] [ LIKE regex_pattern ]

+------+
| NAME |
+------+
| my_other_db |
| my_db |
| my_database_that_has_a_very_long_name |
| default |
+------+

SHOW TABLES [ ( FROM | IN )? [ catalog_name '.' ] database_name ] [ LIKE regex_pattern ]

+------+------+
| NAME | TYPE |
+------+------+
| my_table | text |
| my_other_table | text |
| my_other_table_with_a_long_name | test |
+------+------+

SHOW CURRENT CATALOG

+------+------+
| NAME | TYPE |
+------+------+
| my_catalog | local |
+------+------+

SHOW CURRENT DATABASE

+------+
| NAME |
+------+
| my_db |
+------+

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @ahmedabu98, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly improves the introspection capabilities of the Beam SQL CLI by adding a suite of SHOW commands. These commands provide users with a clear and structured way to explore the available catalogs, databases, and tables within their SQL environment, making it easier to understand and navigate the data landscape. The changes involve updates to the SQL parser, core catalog management, and new classes to handle the execution and formatted output of these commands.

Highlights

  • New SQL SHOW Commands: Introduced SHOW CATALOGS, SHOW DATABASES, SHOW TABLES, SHOW CURRENT CATALOG, and SHOW CURRENT DATABASE commands to the Beam SQL CLI.
  • Catalog and Database Introspection: Added functionality to list available catalogs, databases within the current catalog, and tables within the current database, enhancing visibility into the SQL environment.
  • Parser and Schema Integration: Integrated the new SHOW commands into the SQL parser and extended the Catalog, CatalogSchema, and BeamCalciteSchema interfaces and implementations to support retrieving and displaying this metadata.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@github-actions
Copy link
Contributor

Checks are failing. Will not request review until checks are succeeding. If you'd like to override that behavior, comment assign set of reviewers

@ahmedabu98
Copy link
Contributor Author

Failing tests are unrelated

@ahmedabu98
Copy link
Contributor Author

assign set of reviewers

@github-actions
Copy link
Contributor

Assigning reviewers:

R: @m-trieu for label java.

Note: If you would like to opt out of this review, comment assign to next reviewer.

Available commands:

  • stop reviewer notifications - opt out of the automated review tooling
  • remind me after tests pass - tag the comment author after tests pass
  • waiting on author - shift the attention set back to the author (any comment or push by the author will return the attention set to the reviewers)

The PR bot will only process comments in the main thread (not review comments).

@github-actions
Copy link
Contributor

Reminder, please take a look at this pr: @m-trieu

@github-actions
Copy link
Contributor

Assigning new set of reviewers because Pr has gone too long without review. If you would like to opt out of this review, comment assign to next reviewer:

R: @kennknowles for label java.

Available commands:

  • stop reviewer notifications - opt out of the automated review tooling
  • remind me after tests pass - tag the comment author after tests pass
  • waiting on author - shift the attention set back to the author (any comment or push by the author will return the attention set to the reviewers)

@github-actions
Copy link
Contributor

github-actions bot commented Nov 8, 2025

Reminder, please take a look at this pr: @kennknowles

@derrickaw
Copy link
Collaborator

waiting on author

@ahmedabu98
Copy link
Contributor Author

@kennknowles thx for the comments. This is ready for another review

cc @talatuyarer

@ahmedabu98
Copy link
Contributor Author

/gemini review

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces several SHOW commands to Beam SQL, enhancing its interactive capabilities. Specifically, it adds SHOW CATALOGS, SHOW DATABASES, SHOW TABLES, and SHOW CURRENT ... commands. The implementation is comprehensive, touching the SQL parser, adding new Sql* node classes for the commands, and integrating them with the existing catalog management infrastructure. The code is well-organized and includes extensive tests.

My review focuses on correctness and maintainability. I've identified a few areas for improvement:

  • There are a couple of redundant null checks in the new SHOW command implementations.
  • The string generation for table borders in the output formatting can be made more efficient and readable.
  • One of the new tests for SHOW CATALOGS doesn't correctly test the LIKE pattern matching.

I've provided specific suggestions for each of these points. Overall, this is a solid contribution that significantly improves the usability of Beam SQL.

}

/**
* SHOW TABLES [ ( FROM | IN )? [ catalog_name '.' ] database_name ] [ LIKE regex_pattern ]
Copy link
Member

Choose a reason for hiding this comment

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

Would [catalog_name '.' ] database_name already exist somewhere as a general construction, or could share between grammar rules? It seems like it is a parsing rule for "database reference"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We don't have it as a general construction yet (catalogs and databases are relatively new concepts in Beam SQL).

I could put a comment at the top of the doc, something like databaseRef: [ catalog_name '.' ] database_name, and replace the occurrences with databaseRef

Lmk if that's what you had in mind?

Copy link
Member

Choose a reason for hiding this comment

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

Well.. we've have tables named like bigquery.my_dataset.my_tablename and pubsub.my_topic for a long time. Ideally we can merge these two things soonish since they have identical syntax and meaning.

@github-actions
Copy link
Contributor

Reminder, please take a look at this pr: @kennknowles

@github-actions
Copy link
Contributor

github-actions bot commented Dec 2, 2025

Assigning new set of reviewers because Pr has gone too long without review. If you would like to opt out of this review, comment assign to next reviewer:

R: @Abacn for label java.

Available commands:

  • stop reviewer notifications - opt out of the automated review tooling
  • remind me after tests pass - tag the comment author after tests pass
  • waiting on author - shift the attention set back to the author (any comment or push by the author will return the attention set to the reviewers)

@Abacn
Copy link
Contributor

Abacn commented Dec 2, 2025

R: @kennknowles

@github-actions
Copy link
Contributor

github-actions bot commented Dec 2, 2025

Stopping reviewer notifications for this pull request: review requested by someone other than the bot, ceding control. If you'd like to restart, comment assign set of reviewers

Copy link
Member

@kennknowles kennknowles left a comment

Choose a reason for hiding this comment

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

My comments are improvement suggestions but we don't have to block on it. Please consider them for followups.

}

/**
* SHOW TABLES [ ( FROM | IN )? [ catalog_name '.' ] database_name ] [ LIKE regex_pattern ]
Copy link
Member

Choose a reason for hiding this comment

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

Well.. we've have tables named like bigquery.my_dataset.my_tablename and pubsub.my_topic for a long time. Ideally we can merge these two things soonish since they have identical syntax and meaning.

<SHOW> <CURRENT> { s.add(this); }
{
List<String> path = new ArrayList<String>();
path.add("beamsystem");
Copy link
Member

Choose a reason for hiding this comment

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

since this is a weird magic string, maybe also __beamsystem__? But also yea we could leave as beamsystem and that could eventually be something we let users query for more flexible processing of the contents. I know most RDBMSes do that kind of thing, yea?

if (schema instanceof CatalogManagerSchema) {
CatalogSchema catalogSchema = ((CatalogManagerSchema) schema).getCatalogSchema(pathOverride);
CatalogSchema catalogSchema =
pathOverride.catalog() != null
Copy link
Member

Choose a reason for hiding this comment

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

ditto - and I do think doing it in the parse layer is the right way to go. But we should probably be able to make a common "catalog reference" and "table reference" construct.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

But we should probably be able to make a common "catalog reference" and "table reference" construct.

Not sure I understand this, but lmk if the new change takes care of it

@ahmedabu98 ahmedabu98 merged commit d119b29 into apache:master Dec 9, 2025
20 checks passed
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.

4 participants