You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by ja...@apache.org on 2021/05/18 05:14:07 UTC
[incubator-pinot] branch master updated: Simplify the schema check
in SegmentConverter (#6931)
This is an automated email from the ASF dual-hosted git repository.
jackie pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-pinot.git
The following commit(s) were added to refs/heads/master by this push:
new 08ed07c Simplify the schema check in SegmentConverter (#6931)
08ed07c is described below
commit 08ed07ce27cd56b341fa634fa1cad9e440f39f6e
Author: Xiaotian (Jackie) Jiang <17...@users.noreply.github.com>
AuthorDate: Mon May 17 22:13:46 2021 -0700
Simplify the schema check in SegmentConverter (#6931)
---
.../org/apache/pinot/core/minion/SegmentConverter.java | 16 +++++++---------
1 file changed, 7 insertions(+), 9 deletions(-)
diff --git a/pinot-core/src/main/java/org/apache/pinot/core/minion/SegmentConverter.java b/pinot-core/src/main/java/org/apache/pinot/core/minion/SegmentConverter.java
index c2321ba..72482ed 100644
--- a/pinot-core/src/main/java/org/apache/pinot/core/minion/SegmentConverter.java
+++ b/pinot-core/src/main/java/org/apache/pinot/core/minion/SegmentConverter.java
@@ -22,9 +22,7 @@ import com.google.common.base.Preconditions;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
-import java.util.HashSet;
import java.util.List;
-import java.util.Set;
import javax.annotation.Nullable;
import org.apache.commons.collections.CollectionUtils;
import org.apache.pinot.core.minion.segment.DefaultRecordPartitioner;
@@ -97,18 +95,18 @@ public class SegmentConverter {
_skipTimeValueCheck = skipTimeValueCheck;
// Validate that segment schemas from all segments are the same
- Set<Schema> schemas = new HashSet<>();
for (File indexDir : inputIndexDirs) {
+ Schema schema;
try {
- schemas.add(new SegmentMetadataImpl(indexDir).getSchema());
+ schema = new SegmentMetadataImpl(indexDir).getSchema();
} catch (IOException e) {
throw new RuntimeException("Caught exception while reading schema from: " + indexDir);
}
- }
- if (schemas.size() == 1) {
- _schema = schemas.iterator().next();
- } else {
- throw new IllegalStateException("Schemas from input segments are not the same");
+ if (_schema == null) {
+ _schema = schema;
+ } else {
+ Preconditions.checkState(_schema.equals(schema), "Schemas from input segments are not the same");
+ }
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org