-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Conversation
Codecov ReportAttention: Patch coverage is
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
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚨 Try these New Features:
|
4d44afb
to
44efb13
Compare
@@ -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 ('__')"); |
There was a problem hiding this comment.
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
?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.pinot/pinot-spi/src/main/java/org/apache/pinot/spi/config/table/TableConfig.java
Line 144 in 81f16f3
pinot/pinot-segment-local/src/main/java/org/apache/pinot/segment/local/utils/TableConfigUtils.java
Line 260 in 81f16f3