use common function.

This commit is contained in:
Abhishek Balaji Radhakrishnan 2024-03-13 12:02:45 +05:30
parent c916cd6363
commit 82dd841f7b
1 changed files with 1 additions and 10 deletions

View File

@ -419,16 +419,7 @@ public class IndexerSQLMetadataStorageCoordinator implements IndexerMetadataStor
@Nullable final DataSourceMetadata endMetadata @Nullable final DataSourceMetadata endMetadata
) throws IOException ) throws IOException
{ {
if (segments.isEmpty()) { verifySegmentsToCommit(segments);
throw new IllegalArgumentException("segment set must not be empty");
}
final String dataSource = segments.iterator().next().getDataSource();
for (DataSegment segment : segments) {
if (!dataSource.equals(segment.getDataSource())) {
throw new IllegalArgumentException("segments must all be from the same dataSource");
}
}
if ((startMetadata == null && endMetadata != null) || (startMetadata != null && endMetadata == null)) { if ((startMetadata == null && endMetadata != null) || (startMetadata != null && endMetadata == null)) {
throw new IllegalArgumentException("start/end metadata pair must be either null or non-null"); throw new IllegalArgumentException("start/end metadata pair must be either null or non-null");