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

IGNITE-24022 Sql. Fix CreateSchemaCommand catalog command validation #5084

Merged
merged 10 commits into from
Feb 3, 2025

Conversation

zstan
Copy link
Contributor

@zstan zstan commented Jan 21, 2025

Thank you for submitting the pull request.

To streamline the review process of the patch and ensure better code quality
we ask both an author and a reviewer to verify the following:

The Review Checklist

  • Formal criteria: TC status, codestyle, mandatory documentation. Also make sure to complete the following:
    - There is a single JIRA ticket related to the pull request.
    - The web-link to the pull request is attached to the JIRA ticket.
    - The JIRA ticket has the Patch Available state.
    - The description of the JIRA ticket explains WHAT was made, WHY and HOW.
    - The pull request title is treated as the final commit message. The following pattern must be used: IGNITE-XXXX Change summary where XXXX - number of JIRA issue.
  • Design: new code conforms with the design principles of the components it is added to.
  • Patch quality: patch cannot be split into smaller pieces, its size must be reasonable.
  • Code quality: code is clean and readable, necessary developer documentation is added if needed.
  • Tests code quality: test set covers positive/negative scenarios, happy/edge cases. Tests are effective in terms of execution time and resources.

Notes

@zstan zstan requested a review from AMashenkov January 21, 2025 12:34
@ParameterizedTest
@MethodSource("reservedSchemaNames")
public void testDropSystemSchemas(String schema) {
if (!DEFAULT_SCHEMA_NAME.equals(schema)) {
Copy link
Contributor

@lowka lowka Jan 23, 2025

Choose a reason for hiding this comment

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

I think default schema name is PUBLIC and the PUBLIC schema is not on a list of reservedSchemaNames.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

you right, fixed, thanks

@@ -348,6 +347,44 @@ public void testItIsNotPossibleToCreateTablesInSystemSchema(String schema) {
() -> sql(format("CREATE TABLE {}.SYS_TABLE (NAME VARCHAR PRIMARY KEY, SIZE BIGINT)", schema.toLowerCase())));
}

@ParameterizedTest
@MethodSource("reservedSchemaNames")
public void testCreateSystemSchemas(String schema) {
Copy link
Contributor

Choose a reason for hiding this comment

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

can we make these tests as SqlLogic tests?

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, as you correctly noted in such a case we will miss return code check

Copy link
Contributor

Choose a reason for hiding this comment

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

it is so, but it doesn't look like a big problem. Otherwise, we can introduce check error codes in SqlLogic tests and move all such simple cases. Up to you

@zstan
Copy link
Contributor Author

zstan commented Jan 30, 2025

@AMashenkov reworked, ready for review

Comment on lines 68 to 70
if (!systemSchemaCommand && CatalogUtils.isSystemSchema(schemaName)) {
throw new CatalogValidationException("Reserved system schema with name '{}' can't be created.", schemaName);
}
Copy link
Member

Choose a reason for hiding this comment

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

Let's move to the constructor.

@zstan zstan merged commit 1dc3ddb into apache:main Feb 3, 2025
1 check passed
@zstan zstan deleted the ignite-24022 branch February 3, 2025 08:40
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.

4 participants