This is an automated email from the ASF dual-hosted git repository.
rong pushed a commit to branch load-tsfile-npe
in repository https://gitbox.apache.org/repos/asf/iotdb.git
The following commit(s) were added to refs/heads/load-tsfile-npe by this push:
new 5a209ea22b1 minor fix
5a209ea22b1 is described below
commit 5a209ea22b1d18ec8113033d0d81622a32db3fa8
Author: Steve Yurong Su <[email protected]>
AuthorDate: Wed Aug 9 22:44:31 2023 +0800
minor fix
---
.../plan/analyze/LoadTsfileAnalyzer.java | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/LoadTsfileAnalyzer.java
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/LoadTsfileAnalyzer.java
index 92bf66c5142..bb43868aa00 100644
---
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/LoadTsfileAnalyzer.java
+++
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/LoadTsfileAnalyzer.java
@@ -207,6 +207,10 @@ public class LoadTsfileAnalyzer {
}
try {
+ if (loadTsFileStatement.isVerifySchema()) {
+ makeSureNoDuplicatedMeasurementsInDevices(device2TimeseriesSchemas);
+ }
+
if (loadTsFileStatement.isAutoCreateDatabase()) {
autoCreateDatabase(loadTsFileStatement.getDatabaseLevel(),
device2TimeseriesSchemas);
}
@@ -228,6 +232,23 @@ public class LoadTsfileAnalyzer {
}
}
+ private void makeSureNoDuplicatedMeasurementsInDevices(
+ Map<String, Set<MeasurementSchema>> device2TimeseriesSchemas) throws
VerifyMetadataException {
+ for (final Map.Entry<String, Set<MeasurementSchema>> entry :
+ device2TimeseriesSchemas.entrySet()) {
+ final String device = entry.getKey();
+ final Map<String, MeasurementSchema> measurement2Schema = new
HashMap<>();
+ for (final MeasurementSchema timeseriesSchema : entry.getValue()) {
+ final String measurement = timeseriesSchema.getMeasurementId();
+ if (measurement2Schema.containsKey(measurement)) {
+ throw new VerifyMetadataException(
+ String.format("Duplicated measurements %s in device %s.",
measurement, device));
+ }
+ measurement2Schema.put(measurement, timeseriesSchema);
+ }
+ }
+ }
+
private void autoCreateDatabase(
int databaseLevel, Map<String, Set<MeasurementSchema>>
device2TimeseriesSchemas)
throws VerifyMetadataException, LoadFileException, IllegalPathException {