-
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
Prevent the table creation when the time column name config is invalid #6030
Prevent the table creation when the time column name config is invalid #6030
Conversation
|
@@ -1226,6 +1231,27 @@ void validateTableTenantConfig(TableConfig tableConfig) { | |||
} | |||
} | |||
|
|||
void validateTimeColumnConfig(TableConfig tableConfig, Schema schema) { |
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.
is this the right place? can we create a tableconfigvalidator @icefury71 you were also adding some validations right. lets move all validations related to tableconfig to one class
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.
You can put all the validations for table creation in pinot-core/src/main/java/org/apache/pinot/core/util/TableConfigUtils.java
, check the validate
method there.
Currently, there is no validation on the time column name from the table config when creating a realtime table. Invalid time configuration would cause the failure in commit stage because start/end metadata doesn't get added to the segment metadata. This adds the validation when creating the realtime table.
b1f3309
to
b0c0f9d
Compare
@@ -504,6 +504,8 @@ private LLCRealtimeSegmentZKMetadata updateCommittingSegmentZKMetadata(String re | |||
committingSegmentZKMetadata.setDownloadUrl(isPeerURL(committingSegmentDescriptor.getSegmentLocation()) | |||
? CommonConstants.Segment.METADATA_URI_FOR_PEER_DOWNLOAD : committingSegmentDescriptor.getSegmentLocation()); | |||
committingSegmentZKMetadata.setCrc(Long.valueOf(segmentMetadata.getCrc())); | |||
Preconditions.checkNotNull(segmentMetadata.getTimeInterval(), |
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.
can we log segment and table name here?
@@ -100,9 +101,13 @@ private static void validateValidationConfig(TableConfig tableConfig, @Nullable | |||
} | |||
// timeColumnName can be null in OFFLINE table | |||
if (timeColumnName != null && schema != null) { | |||
Preconditions.checkState(schema.getSpecForTimeColumn(timeColumnName) != null, | |||
FieldSpec timeColumnFieldSpec = schema.getSpecForTimeColumn(timeColumnName); |
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.
There's a TableConfigUtilsTest which exhaustively tests validations done here. Can you add one for timeColumn being TIME/DATE_TIME only?
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.
LGTM. If you end up adding tests in TableConfigUtilsTest, this PR will conflict with #6017 so please check with him
Closing the pull request since the current code correctly validates the time column that I would like to do. |
Currently, there is no validation on the time column name from
the table config when creating a realtime table. Invalid time
configuration would cause the failure in commit stage because
start/end metadata doesn't get added to the segment metadata.
This adds the validation when creating the realtime table.