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

validate schemaName must not have double underscore #14511

Merged
merged 1 commit into from
Nov 21, 2024

Conversation

rohityadav1993
Copy link
Contributor

@rohityadav1993 rohityadav1993 commented Nov 21, 2024

cleanup

This PR adds the validation for schemaName to not allow double underscores similar to table name validation.

We don't allow table names with double underscores __ and additionally don't allow tables with schema name different from table name. Schema name validations can help early catching of wrongly named schemas.

"'tableName' cannot contain double underscore ('__')");

throw new IllegalStateException("Schema name: " + schemaName + " does not match table name: " + rawTableName);

@codecov-commenter
Copy link

codecov-commenter commented Nov 21, 2024

Codecov Report

Attention: Patch coverage is 0% with 2 lines in your changes missing coverage. Please review.

Project coverage is 63.83%. Comparing base (59551e4) to head (44efb13).
Report is 1371 commits behind head on master.

Files with missing lines Patch % Lines
...ller/api/resources/PinotSchemaRestletResource.java 0.00% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master   #14511      +/-   ##
============================================
+ Coverage     61.75%   63.83%   +2.08%     
- Complexity      207     1568    +1361     
============================================
  Files          2436     2672     +236     
  Lines        133233   146682   +13449     
  Branches      20636    22493    +1857     
============================================
+ Hits          82274    93639   +11365     
- Misses        44911    46116    +1205     
- Partials       6048     6927     +879     
Flag Coverage Δ
custom-integration1 100.00% <ø> (+99.99%) ⬆️
integration 100.00% <ø> (+99.99%) ⬆️
integration1 100.00% <ø> (+99.99%) ⬆️
integration2 0.00% <ø> (ø)
java-11 63.82% <0.00%> (+2.11%) ⬆️
java-21 63.73% <0.00%> (+2.10%) ⬆️
skip-bytebuffers-false 63.83% <0.00%> (+2.08%) ⬆️
skip-bytebuffers-true 63.71% <0.00%> (+35.98%) ⬆️
temurin 63.83% <0.00%> (+2.08%) ⬆️
unittests 63.83% <0.00%> (+2.08%) ⬆️
unittests1 55.53% <ø> (+8.64%) ⬆️
unittests2 34.57% <0.00%> (+6.84%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.


🚨 Try these New Features:

@Jackie-Jiang Jackie-Jiang merged commit 18cd776 into apache:master Nov 21, 2024
21 checks passed
@@ -392,6 +392,9 @@ private void validateSchemaName(Schema schema) {
throw new ControllerApplicationException(LOGGER,
"Invalid schema. Reason: 'schemaName' should not be null or empty", Response.Status.BAD_REQUEST);
}
if (schema.getSchemaName().contains(TableConfig.TABLE_NAME_FORBIDDEN_SUBSTRING)) {
throw new IllegalStateException("'schemaName' cannot contain double underscore ('__')");
Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry merged it pre-maturely. Can you change this to a ControllerApplicationException?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, let me raise a PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

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.

3 participants