diff --git a/iotdb-2.0/src/main/java/cn/edu/tsinghua/iot/benchmark/iotdb200/DMLStrategy/SessionStrategy.java b/iotdb-2.0/src/main/java/cn/edu/tsinghua/iot/benchmark/iotdb200/DMLStrategy/SessionStrategy.java index b7cca7737..0c6185db5 100644 --- a/iotdb-2.0/src/main/java/cn/edu/tsinghua/iot/benchmark/iotdb200/DMLStrategy/SessionStrategy.java +++ b/iotdb-2.0/src/main/java/cn/edu/tsinghua/iot/benchmark/iotdb200/DMLStrategy/SessionStrategy.java @@ -122,7 +122,7 @@ private Status insertOneBatchByTablet(IBatch batch) { private Tablet genTablet(IBatch batch) { List schemaList = new ArrayList<>(); - List columnTypes = new ArrayList<>(); + List columnTypes = new ArrayList<>(); List sensors = batch.getDeviceSchema().getSensors(); if (config.isIS_DOUBLE_WRITE()) { iotdb.deleteIDColumnIfNecessary(columnTypes, sensors, batch); @@ -147,7 +147,6 @@ private Tablet genTablet(IBatch batch) { schemaList, columnTypes, batch.getRecords().size() * config.getDEVICE_NUM_PER_WRITE()); - long[] timestamps = tablet.timestamps; Object[] values = tablet.values; int stepOff = 0; batch.reset(); @@ -156,11 +155,10 @@ private Tablet genTablet(IBatch batch) { for (int recordIndex = stepOff; recordIndex < (batch.getRecords().size() + stepOff); recordIndex++) { - tablet.rowSize++; Record record = batch.getRecords().get(recordIndex % batch.getRecords().size()); sensorIndex = 0; long currentTime = record.getTimestamp(); - timestamps[recordIndex] = currentTime; + tablet.addTimestamp(recordIndex, currentTime); for (int recordValueIndex = 0; recordValueIndex < record.getRecordDataValue().size(); recordValueIndex++) { diff --git a/iotdb-2.0/src/main/java/cn/edu/tsinghua/iot/benchmark/iotdb200/IoTDB.java b/iotdb-2.0/src/main/java/cn/edu/tsinghua/iot/benchmark/iotdb200/IoTDB.java index 432e2c453..f16b8f027 100644 --- a/iotdb-2.0/src/main/java/cn/edu/tsinghua/iot/benchmark/iotdb200/IoTDB.java +++ b/iotdb-2.0/src/main/java/cn/edu/tsinghua/iot/benchmark/iotdb200/IoTDB.java @@ -658,7 +658,7 @@ public String getInsertTargetName(DeviceSchema schema) { public Tablet createTablet( String insertTargetName, List schemas, - List columnTypes, + List columnTypes, int maxRowNumber) { return modelStrategy.createTablet(insertTargetName, schemas, columnTypes, maxRowNumber); } @@ -674,12 +674,12 @@ public void sessionInsertImpl(Session session, Tablet tablet, DeviceSchema devic } public void addIDColumnIfNecessary( - List columnTypes, List sensors, IBatch batch) { + List columnTypes, List sensors, IBatch batch) { modelStrategy.addIDColumnIfNecessary(columnTypes, sensors, batch); } public void deleteIDColumnIfNecessary( - List columnTypes, List sensors, IBatch batch) { + List columnTypes, List sensors, IBatch batch) { modelStrategy.deleteIDColumnIfNecessary(columnTypes, sensors, batch); } diff --git a/iotdb-2.0/src/main/java/cn/edu/tsinghua/iot/benchmark/iotdb200/ModelStrategy/IoTDBModelStrategy.java b/iotdb-2.0/src/main/java/cn/edu/tsinghua/iot/benchmark/iotdb200/ModelStrategy/IoTDBModelStrategy.java index 8a22d460a..f527fdb1b 100644 --- a/iotdb-2.0/src/main/java/cn/edu/tsinghua/iot/benchmark/iotdb200/ModelStrategy/IoTDBModelStrategy.java +++ b/iotdb-2.0/src/main/java/cn/edu/tsinghua/iot/benchmark/iotdb200/ModelStrategy/IoTDBModelStrategy.java @@ -108,7 +108,7 @@ public abstract void addVerificationQueryWhereClause( DeviceSchema deviceSchema); public abstract void deleteIDColumnIfNecessary( - List columnTypes, List sensors, IBatch batch); + List columnTypes, List sensors, IBatch batch); public abstract String getValueFilterClause(List deviceSchemas, int valueThreshold); @@ -146,13 +146,13 @@ public abstract void registerDatabases(Session metaSession, List schemas, - List columnTypes, + List columnTypes, int maxRowNumber); public abstract String getInsertTargetName(DeviceSchema schema); public abstract void addIDColumnIfNecessary( - List columnTypes, List sensors, IBatch batch); + List columnTypes, List sensors, IBatch batch); public abstract void sessionInsertImpl(Session session, Tablet tablet, DeviceSchema deviceSchema) throws IoTDBConnectionException, StatementExecutionException; diff --git a/iotdb-2.0/src/main/java/cn/edu/tsinghua/iot/benchmark/iotdb200/ModelStrategy/TableStrategy.java b/iotdb-2.0/src/main/java/cn/edu/tsinghua/iot/benchmark/iotdb200/ModelStrategy/TableStrategy.java index a29f7abbf..ece2cb595 100644 --- a/iotdb-2.0/src/main/java/cn/edu/tsinghua/iot/benchmark/iotdb200/ModelStrategy/TableStrategy.java +++ b/iotdb-2.0/src/main/java/cn/edu/tsinghua/iot/benchmark/iotdb200/ModelStrategy/TableStrategy.java @@ -118,7 +118,7 @@ private void registerTable(Session metaSession, List timeserie .append(" ") .append(SensorType.STRING) .append(" ") - .append(Tablet.ColumnType.ID); + .append(Tablet.ColumnCategory.ID); for (String key : deviceSchema.getTags().keySet()) { builder .append(", ") @@ -126,7 +126,7 @@ private void registerTable(Session metaSession, List timeserie .append(" ") .append(SensorType.STRING) .append(" ") - .append(Tablet.ColumnType.ID); + .append(Tablet.ColumnCategory.ID); } builder.append(")"); tables @@ -451,9 +451,14 @@ public String getMinTimeStampSql(DeviceSchema deviceSchema) { public Tablet createTablet( String insertTargetName, List schemas, - List columnTypes, + List columnTypes, int maxRowNumber) { - return new Tablet(insertTargetName, schemas, columnTypes, maxRowNumber); + return new Tablet( + insertTargetName, + IMeasurementSchema.getMeasurementNameList(schemas), + IMeasurementSchema.getDataTypeList(schemas), + columnTypes, + maxRowNumber); } @Override @@ -463,19 +468,19 @@ public String getInsertTargetName(DeviceSchema schema) { @Override public void addIDColumnIfNecessary( - List columnTypes, List sensors, IBatch batch) { + List columnTypes, List sensors, IBatch batch) { // All sensors are of type measurement for (int i = 0; i < sensors.size(); i++) { - columnTypes.add(Tablet.ColumnType.MEASUREMENT); + columnTypes.add(Tablet.ColumnCategory.MEASUREMENT); } // tag and device as ID column // Add Identity Column Information to Schema sensors.add(new Sensor("device_id", SensorType.STRING)); - columnTypes.add(Tablet.ColumnType.ID); + columnTypes.add(Tablet.ColumnCategory.ID); for (String key : batch.getDeviceSchema().getTags().keySet()) { // Currently, the identity column can only be String sensors.add(new Sensor(key, SensorType.STRING)); - columnTypes.add(Tablet.ColumnType.ID); + columnTypes.add(Tablet.ColumnCategory.ID); } // Add the value of the identity column to the value of each record for (int loop = 0; loop < config.getDEVICE_NUM_PER_WRITE(); loop++) { @@ -494,7 +499,7 @@ public void addIDColumnIfNecessary( @Override public void deleteIDColumnIfNecessary( - List columnTypes, List sensors, IBatch batch) { + List columnTypes, List sensors, IBatch batch) { // do nothing } diff --git a/iotdb-2.0/src/main/java/cn/edu/tsinghua/iot/benchmark/iotdb200/ModelStrategy/TreeStrategy.java b/iotdb-2.0/src/main/java/cn/edu/tsinghua/iot/benchmark/iotdb200/ModelStrategy/TreeStrategy.java index 5d50a1bc6..c50dacae1 100644 --- a/iotdb-2.0/src/main/java/cn/edu/tsinghua/iot/benchmark/iotdb200/ModelStrategy/TreeStrategy.java +++ b/iotdb-2.0/src/main/java/cn/edu/tsinghua/iot/benchmark/iotdb200/ModelStrategy/TreeStrategy.java @@ -444,7 +444,7 @@ public String getMinTimeStampSql(DeviceSchema deviceSchema) { public Tablet createTablet( String insertTargetName, List schemas, - List columnTypes, + List columnTypes, int maxRowNumber) { return new Tablet(insertTargetName, schemas, maxRowNumber); } @@ -456,13 +456,13 @@ public String getInsertTargetName(DeviceSchema schema) { @Override public void addIDColumnIfNecessary( - List columnTypes, List sensors, IBatch batch) { + List columnTypes, List sensors, IBatch batch) { // do nothing } @Override public void deleteIDColumnIfNecessary( - List columnTypes, List sensors, IBatch batch) { + List columnTypes, List sensors, IBatch batch) { // delete the value of the identity column to the value of each record for (int i = 0; i < batch.getRecords().size(); i++) { List dataValue = batch.getRecords().get(i).getRecordDataValue();