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-22120: Sql. Possibility set zero length for character string type #3782

Merged
merged 10 commits into from
May 23, 2024

Conversation

lowka
Copy link
Contributor

@lowka lowka commented May 17, 2024

https://issues.apache.org/jira/browse/IGNITE-22120


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

@lowka lowka changed the title [IGNITE-22120] Sql. Possibility set zero length for character string type IGNITE-22120: Sql. Possibility set zero length for character string type May 17, 2024
assertThrowsSqlException(
STMT_VALIDATION_ERR,
"Length for type VARCHAR must be at least 1",
() -> sql("SELECT '1'::VARCHAR(0)")
Copy link
Member

Choose a reason for hiding this comment

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

Should we check an empty string?

if (params.length() == null) {
throw new CatalogValidationException(format(ERR_COL_PARAM_DEFINITION, "Length", params.name(), params.type()));
}

if (params.length() < 0) {
if (params.length() <= 0) {
Copy link
Contributor

Choose a reason for hiding this comment

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

do we need to append additional tests for add column and alter column with "0" precision ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed.

lowka added 3 commits May 21, 2024 19:35
# Conflicts:
#	modules/sql-engine/src/integrationTest/sql/types/char/test_char_length.test
#	modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/util/IgniteResource.java
@zstan zstan merged commit bbe3306 into apache:main May 23, 2024
1 check passed
@zstan zstan deleted the IGNITE-22120 branch May 23, 2024 07:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants