This is an automated email from the ASF dual-hosted git repository.
jiangtian pushed a commit to branch TableModelIngestion
in repository https://gitbox.apache.org/repos/asf/iotdb.git
The following commit(s) were added to refs/heads/TableModelIngestion by this
push:
new 2dd002b68be merge with TableModelGrammar
2dd002b68be is described below
commit 2dd002b68beeabc3d1a0266c61f1302f993229ea
Author: Tian Jiang <[email protected]>
AuthorDate: Fri Jul 12 17:01:03 2024 +0800
merge with TableModelGrammar
---
.../java/org/apache/iotdb/session/Session.java | 5 +-
.../apache/iotdb/session/util/SessionUtils.java | 1 -
.../iotdb/confignode/manager/ConfigManager.java | 5 +-
.../apache/iotdb/confignode/manager/IManager.java | 5 +-
.../thrift/ConfigNodeRPCServiceProcessor.java | 2 +-
.../request/ConfigPhysicalPlanSerDeTest.java | 1 -
.../iotdb/db/protocol/client/ConfigNodeClient.java | 5 +-
.../iotdb/db/protocol/session/IClientSession.java | 1 -
.../protocol/thrift/impl/ClientRPCServiceImpl.java | 35 +--
.../db/queryengine/plan/analyze/AnalyzeUtils.java | 22 +-
.../plan/analyze/ClusterPartitionFetcher.java | 19 +-
.../plan/analyze/schema/SchemaValidator.java | 3 +-
.../plan/planner/OperatorTreeGenerator.java | 1 -
.../plan/planner/plan/node/PlanVisitor.java | 1 -
.../plan/planner/plan/node/write/InsertNode.java | 28 +--
.../plan/node/write/InsertRowsOfOneDeviceNode.java | 14 +-
.../planner/plan/node/write/InsertTabletNode.java | 1 -
.../plan/node/write/RelationalInsertRowNode.java | 26 +-
.../plan/relational/planner/LogicalPlanner.java | 1 -
.../plan/relational/planner/RelationPlanner.java | 17 +-
.../distribute/DistributedPlanGenerator.java | 3 +-
.../optimizations/PushPredicateIntoTableScan.java | 3 +-
.../plan/relational/sql/ast/InsertRow.java | 9 +-
.../relational/sql/ast/WrappedInsertStatement.java | 43 ++--
.../plan/statement/crud/InsertRowStatement.java | 2 +-
.../attribute/DeviceAttributeStore.java | 5 +-
.../db/schemaengine/table/DataNodeTableCache.java | 2 +-
.../db/storageengine/dataregion/DataRegion.java | 275 ++++++++-------------
.../dataregion/memtable/AbstractMemTable.java | 58 ++---
.../dataregion/memtable/TsFileProcessor.java | 177 +++++--------
.../org/apache/iotdb/db/utils/CommonUtils.java | 1 -
.../java/org/apache/iotdb/db/utils/MemUtils.java | 26 +-
.../plan/relational/analyzer/AnalyzerTest.java | 30 ++-
.../plan/statement/StatementTestUtils.java | 7 +-
.../storageengine/dataregion/DataRegionTest.java | 3 +-
.../org/apache/iotdb/db/utils/MemUtilsTest.java | 3 +-
.../iotdb/commons/partition/DataPartition.java | 9 +-
37 files changed, 343 insertions(+), 506 deletions(-)
diff --git
a/iotdb-client/session/src/main/java/org/apache/iotdb/session/Session.java
b/iotdb-client/session/src/main/java/org/apache/iotdb/session/Session.java
index 28f884291cc..76a7a2a24a7 100644
--- a/iotdb-client/session/src/main/java/org/apache/iotdb/session/Session.java
+++ b/iotdb-client/session/src/main/java/org/apache/iotdb/session/Session.java
@@ -1227,8 +1227,8 @@ public class Session implements ISession {
}
/**
- * insert data in one row to the table model, if you want to improve your
performance, please use insertRecords
- * method or insertTablet method
+ * insert data in one row to the table model, if you want to improve your
performance, please use
+ * insertRecords method or insertTablet method
*
* @see Session#insertRecords(List, List, List, List, List)
* @see Session#insertTablet(Tablet)
@@ -1255,7 +1255,6 @@ public class Session implements ISession {
insertRecord(deviceId, request);
}
-
private void insertRecord(String prefixPath, TSInsertRecordReq request)
throws IoTDBConnectionException, StatementExecutionException {
try {
diff --git
a/iotdb-client/session/src/main/java/org/apache/iotdb/session/util/SessionUtils.java
b/iotdb-client/session/src/main/java/org/apache/iotdb/session/util/SessionUtils.java
index 01177a1ee40..81642b3734c 100644
---
a/iotdb-client/session/src/main/java/org/apache/iotdb/session/util/SessionUtils.java
+++
b/iotdb-client/session/src/main/java/org/apache/iotdb/session/util/SessionUtils.java
@@ -32,7 +32,6 @@ import org.apache.tsfile.utils.DateUtils;
import org.apache.tsfile.utils.ReadWriteIOUtils;
import org.apache.tsfile.write.UnSupportedDataTypeException;
import org.apache.tsfile.write.record.Tablet;
-import org.apache.tsfile.write.record.Tablet.ColumnType;
import org.apache.tsfile.write.schema.IMeasurementSchema;
import java.nio.ByteBuffer;
diff --git
a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/ConfigManager.java
b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/ConfigManager.java
index 94f01099632..04725887121 100644
---
a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/ConfigManager.java
+++
b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/ConfigManager.java
@@ -740,7 +740,7 @@ public class ConfigManager implements IManager {
Map<String, List<TSeriesPartitionSlot>> databaseSlotMap = new HashMap<>();
partitionSlotsMap.forEach((db, slots) -> databaseSlotMap.put(db, new
ArrayList<>(slots)));
- return getSchemaPartition(databaseSlotMap);
+ return getSchemaPartition(databaseSlotMap);
}
@Override
@@ -755,7 +755,7 @@ public class ConfigManager implements IManager {
GetSchemaPartitionPlan getSchemaPartitionPlan =
new GetSchemaPartitionPlan(
- dbSlotMap.entrySet().stream()
+ dbSlotMap.entrySet().stream()
.collect(Collectors.toMap(Map.Entry::getKey, e -> new
ArrayList<>(e.getValue()))));
SchemaPartitionResp queryResult =
partitionManager.getSchemaPartition(getSchemaPartitionPlan);
resp = queryResult.convertToRpcSchemaPartitionTableResp();
@@ -869,7 +869,6 @@ public class ConfigManager implements IManager {
}
devicePathString.append(lineSeparator).append("}");
-
if (LOGGER.isDebugEnabled()) {
LOGGER.debug(
"[GetOrCreateSchemaPartition]:{}Receive PathPatternTree: {}, Return
TSchemaPartitionTableResp: {}",
diff --git
a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/IManager.java
b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/IManager.java
index 54a54e4c19d..5e9dd2f57c2 100644
---
a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/IManager.java
+++
b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/IManager.java
@@ -19,7 +19,6 @@
package org.apache.iotdb.confignode.manager;
-import java.util.Map;
import org.apache.iotdb.common.rpc.thrift.TConfigNodeLocation;
import org.apache.iotdb.common.rpc.thrift.TDataNodeLocation;
import org.apache.iotdb.common.rpc.thrift.TFlushReq;
@@ -132,6 +131,7 @@ import org.apache.iotdb.rpc.TSStatusCode;
import java.nio.ByteBuffer;
import java.util.List;
+import java.util.Map;
/**
* A subset of services provided by {@link ConfigManager}. For use internally
only, passed to
@@ -379,7 +379,8 @@ public interface IManager {
*
* @return TSchemaPartitionResp
*/
- TSchemaPartitionTableResp getOrCreateSchemaPartition(Map<String,
List<TSeriesPartitionSlot>> dbSlotMap);
+ TSchemaPartitionTableResp getOrCreateSchemaPartition(
+ Map<String, List<TSeriesPartitionSlot>> dbSlotMap);
/**
* Create SchemaNodeManagementPartition for child paths node management.
diff --git
a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/service/thrift/ConfigNodeRPCServiceProcessor.java
b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/service/thrift/ConfigNodeRPCServiceProcessor.java
index 22073fd61f3..5597610980f 100644
---
a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/service/thrift/ConfigNodeRPCServiceProcessor.java
+++
b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/service/thrift/ConfigNodeRPCServiceProcessor.java
@@ -19,7 +19,6 @@
package org.apache.iotdb.confignode.service.thrift;
-import java.util.Map;
import org.apache.iotdb.common.rpc.thrift.TConfigNodeLocation;
import org.apache.iotdb.common.rpc.thrift.TDataNodeLocation;
import org.apache.iotdb.common.rpc.thrift.TFlushReq;
@@ -193,6 +192,7 @@ import java.io.IOException;
import java.nio.ByteBuffer;
import java.util.Collections;
import java.util.List;
+import java.util.Map;
import java.util.concurrent.TimeUnit;
/** ConfigNodeRPCServer exposes the interface that interacts with the DataNode
*/
diff --git
a/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/consensus/request/ConfigPhysicalPlanSerDeTest.java
b/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/consensus/request/ConfigPhysicalPlanSerDeTest.java
index e902c2f3676..2a6d53c61ba 100644
---
a/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/consensus/request/ConfigPhysicalPlanSerDeTest.java
+++
b/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/consensus/request/ConfigPhysicalPlanSerDeTest.java
@@ -19,7 +19,6 @@
package org.apache.iotdb.confignode.consensus.request;
-import java.util.Collection;
import org.apache.iotdb.common.rpc.thrift.TConfigNodeLocation;
import org.apache.iotdb.common.rpc.thrift.TConsensusGroupId;
import org.apache.iotdb.common.rpc.thrift.TConsensusGroupType;
diff --git
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/client/ConfigNodeClient.java
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/client/ConfigNodeClient.java
index 9527c2be026..351ed85ee4e 100644
---
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/client/ConfigNodeClient.java
+++
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/client/ConfigNodeClient.java
@@ -19,7 +19,6 @@
package org.apache.iotdb.db.protocol.client;
-import java.util.Map;
import org.apache.iotdb.common.rpc.thrift.TConfigNodeLocation;
import org.apache.iotdb.common.rpc.thrift.TDataNodeLocation;
import org.apache.iotdb.common.rpc.thrift.TEndPoint;
@@ -164,6 +163,7 @@ import org.slf4j.LoggerFactory;
import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.List;
+import java.util.Map;
import java.util.Optional;
import java.util.function.Predicate;
@@ -545,7 +545,8 @@ public class ConfigNodeClient implements
IConfigNodeRPCService.Iface, ThriftClie
public TSchemaPartitionTableResp getSchemaPartitionTableWithSlots(
Map<String, List<TSeriesPartitionSlot>> dbSlotMap) throws TException {
return executeRemoteCallWithRetry(
- () -> client.getSchemaPartitionTableWithSlots(dbSlotMap), resp ->
!updateConfigNodeLeader(resp.status));
+ () -> client.getSchemaPartitionTableWithSlots(dbSlotMap),
+ resp -> !updateConfigNodeLeader(resp.status));
}
@Override
diff --git
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/session/IClientSession.java
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/session/IClientSession.java
index d50ab5e61d3..edba5195ce8 100644
---
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/session/IClientSession.java
+++
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/session/IClientSession.java
@@ -20,7 +20,6 @@
package org.apache.iotdb.db.protocol.session;
import org.apache.iotdb.commons.conf.IoTDBConstant.ClientVersion;
-import org.apache.iotdb.db.utils.CommonUtils;
import org.apache.iotdb.service.rpc.thrift.TSConnectionInfo;
import org.apache.iotdb.service.rpc.thrift.TSConnectionType;
diff --git
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/thrift/impl/ClientRPCServiceImpl.java
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/thrift/impl/ClientRPCServiceImpl.java
index aaf7af5047a..7bd6236dce2 100644
---
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/thrift/impl/ClientRPCServiceImpl.java
+++
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/thrift/impl/ClientRPCServiceImpl.java
@@ -2008,24 +2008,25 @@ public class ClientRPCServiceImpl implements
IClientRPCServiceWithHandler {
long queryId = SESSION_MANAGER.requestQueryId();
ExecutionResult result;
if (statement.isWriteToTable()) {
- result = COORDINATOR.executeForTableModel(
- statement,
- relationSqlParser,
- clientSession,
- queryId,
- SESSION_MANAGER.getSessionInfo(clientSession),
- "",
- metadata,
- config.getConnectionTimeoutInMS()
- );
+ result =
+ COORDINATOR.executeForTableModel(
+ statement,
+ relationSqlParser,
+ clientSession,
+ queryId,
+ SESSION_MANAGER.getSessionInfo(clientSession),
+ "",
+ metadata,
+ config.getConnectionTimeoutInMS());
} else {
- result = COORDINATOR.executeForTreeModel(
- statement,
- queryId,
- SESSION_MANAGER.getSessionInfo(clientSession),
- "",
- partitionFetcher,
- schemaFetcher);
+ result =
+ COORDINATOR.executeForTreeModel(
+ statement,
+ queryId,
+ SESSION_MANAGER.getSessionInfo(clientSession),
+ "",
+ partitionFetcher,
+ schemaFetcher);
}
return result.status;
} catch (IoTDBException e) {
diff --git
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/AnalyzeUtils.java
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/AnalyzeUtils.java
index 13c6ce9bd42..9ed6ed043b7 100644
---
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/AnalyzeUtils.java
+++
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/AnalyzeUtils.java
@@ -112,7 +112,9 @@ public class AnalyzeUtils {
} else if (statement instanceof InsertRowStatement) {
InsertRowStatement insertRowStatement = (InsertRowStatement) statement;
return computeDataPartitionParams(
- Collections.singletonMap(insertRowStatement.getTableDeviceID(),
Collections.singleton(insertRowStatement.getTimePartitionSlot())),
+ Collections.singletonMap(
+ insertRowStatement.getTableDeviceID(),
+
Collections.singleton(insertRowStatement.getTimePartitionSlot())),
context.getSession().getDatabaseName().orElse(null));
}
throw new UnsupportedOperationException("computeDataPartitionParams for "
+ statement);
@@ -121,8 +123,8 @@ public class AnalyzeUtils {
public static List<DataPartitionQueryParam> computeTreeDataPartitionParams(
InsertBaseStatement statement, MPPQueryContext context) {
if (statement instanceof InsertTabletStatement) {
- DataPartitionQueryParam dataPartitionQueryParam =
getTreeDataPartitionQueryParam(
- (InsertTabletStatement) statement, context);
+ DataPartitionQueryParam dataPartitionQueryParam =
+ getTreeDataPartitionQueryParam((InsertTabletStatement) statement,
context);
return Collections.singletonList(dataPartitionQueryParam);
} else if (statement instanceof InsertMultiTabletsStatement) {
InsertMultiTabletsStatement insertMultiTabletsStatement =
@@ -155,13 +157,11 @@ public class AnalyzeUtils {
throw new UnsupportedOperationException("computeDataPartitionParams for "
+ statement);
}
- private static DataPartitionQueryParam
getTreeDataPartitionQueryParam(InsertTabletStatement statement,
- MPPQueryContext context) {
+ private static DataPartitionQueryParam getTreeDataPartitionQueryParam(
+ InsertTabletStatement statement, MPPQueryContext context) {
DataPartitionQueryParam dataPartitionQueryParam = new
DataPartitionQueryParam();
- dataPartitionQueryParam.setDeviceID(
- statement.getDevicePath().getIDeviceIDAsFullDevice());
- dataPartitionQueryParam.setTimePartitionSlotList(
- statement.getTimePartitionSlots());
+
dataPartitionQueryParam.setDeviceID(statement.getDevicePath().getIDeviceIDAsFullDevice());
+
dataPartitionQueryParam.setTimePartitionSlotList(statement.getTimePartitionSlots());
dataPartitionQueryParam.setDatabaseName(context.getSession().getDatabaseName().orElse(null));
return dataPartitionQueryParam;
}
@@ -227,9 +227,7 @@ public class AnalyzeUtils {
}
}
- /**
- * get analysis according to statement and params
- */
+ /** get analysis according to statement and params */
public static void analyzeDataPartition(
IAnalysis analysis,
List<DataPartitionQueryParam> dataPartitionQueryParams,
diff --git
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/ClusterPartitionFetcher.java
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/ClusterPartitionFetcher.java
index a1942da7701..1c74d6ddf3d 100644
---
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/ClusterPartitionFetcher.java
+++
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/ClusterPartitionFetcher.java
@@ -19,7 +19,6 @@
package org.apache.iotdb.db.queryengine.plan.analyze;
-import java.util.stream.Collectors;
import org.apache.iotdb.common.rpc.thrift.TConsensusGroupId;
import org.apache.iotdb.common.rpc.thrift.TRegionReplicaSet;
import org.apache.iotdb.common.rpc.thrift.TSeriesPartitionSlot;
@@ -64,6 +63,7 @@ import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Set;
+import java.util.stream.Collectors;
public class ClusterPartitionFetcher implements IPartitionFetcher {
@@ -313,11 +313,14 @@ public class ClusterPartitionFetcher implements
IPartitionFetcher {
partitionCache.getSchemaPartition(Collections.singletonMap(database,
deviceIDs));
if (null == schemaPartition) {
- List<TSeriesPartitionSlot> partitionSlots = deviceIDs.stream()
- .map(partitionExecutor::getSeriesPartitionSlot).distinct().collect(
- Collectors.toList());
+ List<TSeriesPartitionSlot> partitionSlots =
+ deviceIDs.stream()
+ .map(partitionExecutor::getSeriesPartitionSlot)
+ .distinct()
+ .collect(Collectors.toList());
TSchemaPartitionTableResp schemaPartitionTableResp =
-
client.getOrCreateSchemaPartitionTableWithSlots(Collections.singletonMap(database,
partitionSlots));
+ client.getOrCreateSchemaPartitionTableWithSlots(
+ Collections.singletonMap(database, partitionSlots));
if (schemaPartitionTableResp.getStatus().getCode()
== TSStatusCode.SUCCESS_STATUS.getStatusCode()) {
schemaPartition =
parseSchemaPartitionTableResp(schemaPartitionTableResp);
@@ -358,7 +361,8 @@ public class ClusterPartitionFetcher implements
IPartitionFetcher {
String database = null;
if (dataPartitionQueryParam.getDatabaseName() == null) {
if (deviceToDatabase == null) {
- deviceToDatabase = partitionCache.getDeviceToDatabase(deviceIDs,
true, isAutoCreate, userName);
+ deviceToDatabase =
+ partitionCache.getDeviceToDatabase(deviceIDs, true,
isAutoCreate, userName);
}
if (deviceToDatabase.containsKey(deviceID)) {
database = deviceToDatabase.get(deviceID);
@@ -440,7 +444,8 @@ public class ClusterPartitionFetcher implements
IPartitionFetcher {
k,
new TTimeSlotList(
new ArrayList<>(v.timeSlotList), v.needLeftAll,
v.needRightAll)));
- partitionSlotsMap.put(PathUtils.qualifyDatabaseName(entry.getKey()),
deviceToTimePartitionMap);
+ partitionSlotsMap.put(
+ PathUtils.qualifyDatabaseName(entry.getKey()),
deviceToTimePartitionMap);
}
return new TDataPartitionReq(partitionSlotsMap);
}
diff --git
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/schema/SchemaValidator.java
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/schema/SchemaValidator.java
index 63f9d3afd9c..4f838b2f931 100644
---
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/schema/SchemaValidator.java
+++
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/schema/SchemaValidator.java
@@ -70,7 +70,8 @@ public class SchemaValidator {
final TableSchema realSchema =
metadata.validateTableHeaderSchema(databaseName, incomingSchema,
context).orElse(null);
if (realSchema == null) {
- throw new SemanticException("Schema validation failed, table cannot be
created: " + incomingSchema);
+ throw new SemanticException(
+ "Schema validation failed, table cannot be created: " +
incomingSchema);
}
insertStatement.validate(realSchema);
metadata.validateDeviceSchema(insertStatement, context);
diff --git
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/OperatorTreeGenerator.java
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/OperatorTreeGenerator.java
index c937e3e9794..71dc05861d4 100644
---
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/OperatorTreeGenerator.java
+++
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/OperatorTreeGenerator.java
@@ -186,7 +186,6 @@ import
org.apache.iotdb.db.queryengine.plan.planner.plan.node.metedata.read.Sche
import
org.apache.iotdb.db.queryengine.plan.planner.plan.node.metedata.read.SchemaQueryOrderByHeatNode;
import
org.apache.iotdb.db.queryengine.plan.planner.plan.node.metedata.read.SchemaQueryScanNode;
import
org.apache.iotdb.db.queryengine.plan.planner.plan.node.metedata.read.SeriesSchemaFetchScanNode;
-import
org.apache.iotdb.db.queryengine.plan.planner.plan.node.metedata.read.TableDeviceFetchNode;
import
org.apache.iotdb.db.queryengine.plan.planner.plan.node.metedata.read.TimeSeriesCountNode;
import
org.apache.iotdb.db.queryengine.plan.planner.plan.node.metedata.read.TimeSeriesSchemaScanNode;
import
org.apache.iotdb.db.queryengine.plan.planner.plan.node.process.ActiveRegionScanMergeNode;
diff --git
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/plan/node/PlanVisitor.java
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/plan/node/PlanVisitor.java
index 289c13d7615..d4e9577c1a0 100644
---
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/plan/node/PlanVisitor.java
+++
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/plan/node/PlanVisitor.java
@@ -516,7 +516,6 @@ public abstract class PlanVisitor<R, C> {
return visitPlan(node, context);
}
-
public R visitInsertTablet(InsertTabletNode node, C context) {
return visitPlan(node, context);
}
diff --git
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/plan/node/write/InsertNode.java
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/plan/node/write/InsertNode.java
index 5912fe2272f..f18de9ef2b9 100644
---
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/plan/node/write/InsertNode.java
+++
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/plan/node/write/InsertNode.java
@@ -25,11 +25,10 @@ import
org.apache.iotdb.commons.consensus.index.ProgressIndex;
import org.apache.iotdb.commons.path.PartialPath;
import org.apache.iotdb.commons.schema.table.column.TsTableColumnCategory;
import org.apache.iotdb.commons.utils.TestOnly;
-import org.apache.iotdb.consensus.iot.log.ConsensusReqReader;
-import org.apache.iotdb.db.queryengine.plan.planner.plan.node.PlanNode;
import org.apache.iotdb.consensus.ConsensusFactory;
import org.apache.iotdb.db.conf.IoTDBConfig;
import org.apache.iotdb.db.conf.IoTDBDescriptor;
+import org.apache.iotdb.db.queryengine.plan.planner.plan.node.PlanNode;
import org.apache.iotdb.db.queryengine.plan.planner.plan.node.PlanNodeId;
import org.apache.iotdb.db.storageengine.dataregion.memtable.DeviceIDFactory;
import
org.apache.iotdb.db.storageengine.dataregion.wal.buffer.IWALByteBufferView;
@@ -55,8 +54,8 @@ public abstract class InsertNode extends SearchNode
implements ComparableConsens
private static final IoTDBConfig config =
IoTDBDescriptor.getInstance().getConfig();
/**
- * if use id table, this filed is id form of device path <br> if not, this
filed is device
- * path<br>
+ * if use id table, this filed is id form of device path <br>
+ * if not, this filed is device path<br>
*/
protected PartialPath devicePath;
@@ -72,15 +71,14 @@ public abstract class InsertNode extends SearchNode
implements ComparableConsens
protected int failedMeasurementNumber = 0;
/**
- * device id reference, for reuse device id in both id table and memtable
<br> used in memtable
+ * device id reference, for reuse device id in both id table and memtable
<br>
+ * used in memtable
*/
protected IDeviceID deviceID;
protected boolean isGeneratedByRemoteConsensusLeader = false;
- /**
- * Physical address of data region after splitting
- */
+ /** Physical address of data region after splitting */
protected TRegionReplicaSet dataRegionReplicaSet;
protected ProgressIndex progressIndex;
@@ -155,8 +153,10 @@ public abstract class InsertNode extends SearchNode
implements ComparableConsens
if (columnCategories == null) {
return measurements.length;
}
- return (int) Arrays.stream(columnCategories)
- .filter(col -> col == TsTableColumnCategory.MEASUREMENT).count();
+ return (int)
+ Arrays.stream(columnCategories)
+ .filter(col -> col == TsTableColumnCategory.MEASUREMENT)
+ .count();
}
public boolean isValidMeasurement(int i) {
@@ -236,9 +236,7 @@ public abstract class InsertNode extends SearchNode
implements ComparableConsens
// region Serialization methods for WAL
- /**
- * Serialized size of measurement schemas, ignoring failed time series
- */
+ /** Serialized size of measurement schemas, ignoring failed time series */
protected int serializeMeasurementSchemasSize() {
int byteLen = 0;
for (int i = 0; i < measurements.length; i++) {
@@ -251,9 +249,7 @@ public abstract class InsertNode extends SearchNode
implements ComparableConsens
return byteLen;
}
- /**
- * Serialize measurement schemas, ignoring failed time series
- */
+ /** Serialize measurement schemas, ignoring failed time series */
protected void serializeMeasurementSchemasToWAL(IWALByteBufferView buffer) {
for (int i = 0; i < measurements.length; i++) {
// ignore failed partial insert
diff --git
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/plan/node/write/InsertRowsOfOneDeviceNode.java
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/plan/node/write/InsertRowsOfOneDeviceNode.java
index dcbe301f2b9..c9de66c7aa8 100644
---
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/plan/node/write/InsertRowsOfOneDeviceNode.java
+++
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/plan/node/write/InsertRowsOfOneDeviceNode.java
@@ -65,14 +65,10 @@ public class InsertRowsOfOneDeviceNode extends InsertNode {
*/
private List<Integer> insertRowNodeIndexList;
- /**
- * the InsertRowsNode list
- */
+ /** the InsertRowsNode list */
private List<InsertRowNode> insertRowNodeList;
- /**
- * record the result of insert rows
- */
+ /** record the result of insert rows */
private Map<Integer, TSStatus> results = new HashMap<>();
public InsertRowsOfOneDeviceNode(PlanNodeId id) {
@@ -131,8 +127,7 @@ public class InsertRowsOfOneDeviceNode extends InsertNode {
}
@Override
- public void addChild(PlanNode child) {
- }
+ public void addChild(PlanNode child) {}
@Override
public PlanNodeType getType() {
@@ -170,7 +165,8 @@ public class InsertRowsOfOneDeviceNode extends InsertNode {
analysis
.getDataPartitionInfo()
.getDataRegionReplicaSetForWriting(
- devicePath.getIDeviceIDAsFullDevice(), timePartitionSlot,
+ devicePath.getIDeviceIDAsFullDevice(),
+ timePartitionSlot,
analysis.getDatabaseName());
Map<TTimePartitionSlot, List<InsertRowNode>> tmpMap =
splitMap.computeIfAbsent(dataRegionReplicaSet, k -> new HashMap<>());
diff --git
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/plan/node/write/InsertTabletNode.java
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/plan/node/write/InsertTabletNode.java
index 2c20c3e2204..c9b258425df 100644
---
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/plan/node/write/InsertTabletNode.java
+++
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/plan/node/write/InsertTabletNode.java
@@ -60,7 +60,6 @@ import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.nio.ByteBuffer;
-import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
diff --git
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/plan/node/write/RelationalInsertRowNode.java
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/plan/node/write/RelationalInsertRowNode.java
index 79910ceea8c..b8f726ee4ef 100644
---
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/plan/node/write/RelationalInsertRowNode.java
+++
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/plan/node/write/RelationalInsertRowNode.java
@@ -19,25 +19,19 @@
package org.apache.iotdb.db.queryengine.plan.planner.plan.node.write;
-import java.io.DataOutputStream;
-import java.io.IOException;
-import java.nio.ByteBuffer;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.function.IntToLongFunction;
-import org.apache.iotdb.common.rpc.thrift.TSStatus;
import org.apache.iotdb.commons.path.PartialPath;
import org.apache.iotdb.commons.schema.table.column.TsTableColumnCategory;
-import org.apache.iotdb.db.exception.query.OutOfTTLException;
import org.apache.iotdb.db.queryengine.plan.planner.plan.node.PlanNodeId;
import org.apache.iotdb.db.queryengine.plan.planner.plan.node.PlanNodeType;
import org.apache.iotdb.db.queryengine.plan.planner.plan.node.PlanVisitor;
+
import org.apache.tsfile.enums.TSDataType;
import org.apache.tsfile.file.metadata.IDeviceID;
import org.apache.tsfile.file.metadata.IDeviceID.Factory;
-import org.apache.tsfile.utils.BitMap;
-import org.apache.tsfile.utils.Pair;
-import org.apache.tsfile.write.schema.MeasurementSchema;
+
+import java.io.DataOutputStream;
+import java.io.IOException;
+import java.nio.ByteBuffer;
public class RelationalInsertRowNode extends InsertRowNode {
// deviceId cache for Table-view insertion
@@ -53,15 +47,7 @@ public class RelationalInsertRowNode extends InsertRowNode {
Object[] values,
boolean isNeedInferType,
TsTableColumnCategory[] columnCategories) {
- super(
- id,
- devicePath,
- isAligned,
- measurements,
- dataTypes,
- time,
- values,
- isNeedInferType);
+ super(id, devicePath, isAligned, measurements, dataTypes, time, values,
isNeedInferType);
setColumnCategories(columnCategories);
}
diff --git
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/planner/LogicalPlanner.java
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/planner/LogicalPlanner.java
index 39d90b5a43f..5568f27a366 100644
---
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/planner/LogicalPlanner.java
+++
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/planner/LogicalPlanner.java
@@ -26,7 +26,6 @@ import org.apache.iotdb.db.queryengine.plan.analyze.QueryType;
import org.apache.iotdb.db.queryengine.plan.planner.plan.LogicalQueryPlan;
import org.apache.iotdb.db.queryengine.plan.planner.plan.node.PlanNode;
import org.apache.iotdb.db.queryengine.plan.planner.plan.node.WritePlanNode;
-import
org.apache.iotdb.db.queryengine.plan.planner.plan.node.metedata.read.SchemaQueryMergeNode;
import
org.apache.iotdb.db.queryengine.plan.planner.plan.node.metedata.read.TableDeviceFetchNode;
import
org.apache.iotdb.db.queryengine.plan.planner.plan.node.metedata.read.TableDeviceQueryNode;
import org.apache.iotdb.db.queryengine.plan.relational.analyzer.Analysis;
diff --git
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/planner/RelationPlanner.java
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/planner/RelationPlanner.java
index 810937d2285..5065f822eeb 100644
---
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/planner/RelationPlanner.java
+++
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/planner/RelationPlanner.java
@@ -88,7 +88,7 @@ public class RelationPlanner extends AstVisitor<RelationPlan,
Void> {
@Override
protected RelationPlan visitQuery(Query node, Void context) {
return new QueryPlanner(
- analysis, symbolAllocator, queryContext, sessionInfo,
recursiveSubqueries)
+ analysis, symbolAllocator, queryContext, sessionInfo,
recursiveSubqueries)
.plan(node);
}
@@ -158,7 +158,7 @@ public class RelationPlanner extends
AstVisitor<RelationPlan, Void> {
@Override
protected RelationPlan visitQuerySpecification(QuerySpecification node, Void
context) {
return new QueryPlanner(
- analysis, symbolAllocator, queryContext, sessionInfo,
recursiveSubqueries)
+ analysis, symbolAllocator, queryContext, sessionInfo,
recursiveSubqueries)
.plan(node);
}
@@ -235,11 +235,16 @@ public class RelationPlanner extends
AstVisitor<RelationPlan, Void> {
protected RelationPlan visitInsertRow(InsertRow node, Void context) {
InsertRowStatement insertRowStatement = node.getInnerTreeStatement();
RelationalInsertRowNode insertNode =
- new RelationalInsertRowNode(idAllocator.genPlanNodeId(),
insertRowStatement.getDevicePath(),
+ new RelationalInsertRowNode(
+ idAllocator.genPlanNodeId(),
+ insertRowStatement.getDevicePath(),
insertRowStatement.isAligned(),
- insertRowStatement.getMeasurements(),
insertRowStatement.getDataTypes(),
- insertRowStatement.getTime(), insertRowStatement.getValues(),
- insertRowStatement.isNeedInferType(),
insertRowStatement.getColumnCategories());
+ insertRowStatement.getMeasurements(),
+ insertRowStatement.getDataTypes(),
+ insertRowStatement.getTime(),
+ insertRowStatement.getValues(),
+ insertRowStatement.isNeedInferType(),
+ insertRowStatement.getColumnCategories());
insertNode.setFailedMeasurementNumber(insertRowStatement.getFailedMeasurementNumber());
return new RelationPlan(insertNode, analysis.getRootScope(),
Collections.emptyList());
}
diff --git
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/planner/distribute/DistributedPlanGenerator.java
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/planner/distribute/DistributedPlanGenerator.java
index e77791a8bf4..adf4d63514c 100644
---
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/planner/distribute/DistributedPlanGenerator.java
+++
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/planner/distribute/DistributedPlanGenerator.java
@@ -415,7 +415,8 @@ public class DistributedPlanGenerator
@Override
public List<PlanNode> visitTableDeviceQuery(TableDeviceQueryNode node,
PlanContext context) {
String database =
- PathUtils.qualifyDatabaseName(((TableDeviceSourceNode)
node.getChildren().get(0)).getDatabase());
+ PathUtils.qualifyDatabaseName(
+ ((TableDeviceSourceNode) node.getChildren().get(0)).getDatabase());
Set<TRegionReplicaSet> schemaRegionSet = new HashSet<>();
analysis
.getSchemaPartitionInfo()
diff --git
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/planner/optimizations/PushPredicateIntoTableScan.java
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/planner/optimizations/PushPredicateIntoTableScan.java
index 0e4c48e5a24..2d5919bd384 100644
---
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/planner/optimizations/PushPredicateIntoTableScan.java
+++
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/planner/optimizations/PushPredicateIntoTableScan.java
@@ -254,8 +254,7 @@ public class PushPredicateIntoTableScan implements
TablePlanOptimizer {
}
@Override
- public PlanNode visitRelationalInsertTablet(
- RelationalInsertTabletNode node, Void context) {
+ public PlanNode visitRelationalInsertTablet(RelationalInsertTabletNode
node, Void context) {
return node;
}
diff --git
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/sql/ast/InsertRow.java
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/sql/ast/InsertRow.java
index 2d8ecc3d4e8..9a8a7367b6d 100644
---
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/sql/ast/InsertRow.java
+++
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/sql/ast/InsertRow.java
@@ -19,15 +19,14 @@
package org.apache.iotdb.db.queryengine.plan.relational.sql.ast;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
import org.apache.iotdb.commons.schema.table.column.TsTableColumnCategory;
import org.apache.iotdb.db.exception.query.QueryProcessException;
import org.apache.iotdb.db.queryengine.common.MPPQueryContext;
import org.apache.iotdb.db.queryengine.plan.statement.crud.InsertRowStatement;
-import
org.apache.iotdb.db.queryengine.plan.statement.crud.InsertTabletStatement;
-import org.apache.tsfile.file.metadata.IDeviceID;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
public class InsertRow extends WrappedInsertStatement {
diff --git
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/sql/ast/WrappedInsertStatement.java
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/sql/ast/WrappedInsertStatement.java
index 2eeb7b08c7d..fd240c626d2 100644
---
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/sql/ast/WrappedInsertStatement.java
+++
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/sql/ast/WrappedInsertStatement.java
@@ -19,13 +19,7 @@
package org.apache.iotdb.db.queryengine.plan.relational.sql.ast;
-import static
org.apache.iotdb.db.utils.EncodingInferenceUtils.getDefaultEncoding;
-
-import java.util.Arrays;
-import java.util.Collections;
import org.apache.iotdb.commons.schema.table.column.TsTableColumnCategory;
-import org.apache.iotdb.db.conf.IoTDBConfig;
-import org.apache.iotdb.db.conf.IoTDBDescriptor;
import org.apache.iotdb.db.exception.query.QueryProcessException;
import org.apache.iotdb.db.exception.sql.SemanticException;
import org.apache.iotdb.db.queryengine.common.MPPQueryContext;
@@ -35,16 +29,17 @@ import
org.apache.iotdb.db.queryengine.plan.relational.metadata.TableSchema;
import
org.apache.iotdb.db.queryengine.plan.relational.type.InternalTypeManager;
import org.apache.iotdb.db.queryengine.plan.statement.crud.InsertBaseStatement;
-import org.apache.tsfile.common.conf.TSFileConfig;
import org.apache.tsfile.common.conf.TSFileDescriptor;
import org.apache.tsfile.enums.TSDataType;
import org.apache.tsfile.read.common.type.TypeFactory;
+import org.apache.tsfile.write.schema.MeasurementSchema;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import org.apache.tsfile.write.schema.MeasurementSchema;
+
+import static
org.apache.iotdb.db.utils.EncodingInferenceUtils.getDefaultEncoding;
public abstract class WrappedInsertStatement extends WrappedStatement
implements ITableDeviceSchemaValidation {
@@ -92,7 +87,8 @@ public abstract class WrappedInsertStatement extends
WrappedStatement
InsertBaseStatement innerTreeStatement = getInnerTreeStatement();
// incoming schema should be consistent with real schema
for (int i = 0, incomingSchemaColumnsSize = incomingSchemaColumns.size();
- i < incomingSchemaColumnsSize; i++) {
+ i < incomingSchemaColumnsSize;
+ i++) {
ColumnSchema incomingSchemaColumn = incomingSchemaColumns.get(i);
final ColumnSchema realSchemaColumn =
realSchemaMap.get(incomingSchemaColumn.getName());
validate(incomingSchemaColumn, realSchemaColumn, i, innerTreeStatement);
@@ -126,12 +122,13 @@ public abstract class WrappedInsertStatement extends
WrappedStatement
tableSchema = null;
}
- public static void validate(ColumnSchema incoming, ColumnSchema real, int i,
- InsertBaseStatement innerTreeStatement) {
+ public static void validate(
+ ColumnSchema incoming, ColumnSchema real, int i, InsertBaseStatement
innerTreeStatement) {
if (real == null) {
// the column does not exist and auto-creation is disabled
- SemanticException semanticException = new SemanticException(
- "Column " + incoming.getName() + " does not exists or fails to be "
+ "created");
+ SemanticException semanticException =
+ new SemanticException(
+ "Column " + incoming.getName() + " does not exists or fails to
be " + "created");
if (incoming.getColumnCategory() != TsTableColumnCategory.MEASUREMENT) {
// non-measurement columns cannot be partially inserted
throw semanticException;
@@ -145,10 +142,11 @@ public abstract class WrappedInsertStatement extends
WrappedStatement
// sql insertion does not provide type
innerTreeStatement.setDataType(InternalTypeManager.getTSDataType(real.getType()),
i);
} else if (!incoming.getType().equals(real.getType())) {
- SemanticException semanticException = new SemanticException(
- String.format(
- "Inconsistent data type of column %s: %s/%s",
- incoming.getName(), incoming.getType(), real.getType()));
+ SemanticException semanticException =
+ new SemanticException(
+ String.format(
+ "Inconsistent data type of column %s: %s/%s",
+ incoming.getName(), incoming.getType(), real.getType()));
if (incoming.getColumnCategory() != TsTableColumnCategory.MEASUREMENT) {
// non-measurement columns cannot be partially inserted
throw semanticException;
@@ -166,10 +164,13 @@ public abstract class WrappedInsertStatement extends
WrappedStatement
"Inconsistent column category of column %s: %s/%s",
incoming.getName(), incoming.getColumnCategory(),
real.getColumnCategory()));
}
- TSDataType tsDataType = InternalTypeManager.getTSDataType(
- real.getType());
- MeasurementSchema measurementSchema = new
MeasurementSchema(real.getName(), tsDataType,
- getDefaultEncoding(tsDataType),
TSFileDescriptor.getInstance().getConfig().getCompressor());
+ TSDataType tsDataType = InternalTypeManager.getTSDataType(real.getType());
+ MeasurementSchema measurementSchema =
+ new MeasurementSchema(
+ real.getName(),
+ tsDataType,
+ getDefaultEncoding(tsDataType),
+ TSFileDescriptor.getInstance().getConfig().getCompressor());
innerTreeStatement.setMeasurementSchema(measurementSchema, i);
}
}
diff --git
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/statement/crud/InsertRowStatement.java
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/statement/crud/InsertRowStatement.java
index be8c38d1107..fa4d3cf39fe 100644
---
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/statement/crud/InsertRowStatement.java
+++
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/statement/crud/InsertRowStatement.java
@@ -457,7 +457,7 @@ public class InsertRowStatement extends InsertBaseStatement
implements ISchemaVa
deviceIdSegments[0] = this.devicePath.getFullPath();
for (int i = 0; i < getIdColumnIndices().size(); i++) {
final Integer columnIndex = getIdColumnIndices().get(i);
- deviceIdSegments[i + 1] = values[columnIndex].toString();
+ deviceIdSegments[i + 1] = values[columnIndex].toString();
}
deviceID = Factory.DEFAULT_FACTORY.create(deviceIdSegments);
}
diff --git
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/attribute/DeviceAttributeStore.java
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/attribute/DeviceAttributeStore.java
index 90a6a156c1f..e52d66ea1fd 100644
---
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/attribute/DeviceAttributeStore.java
+++
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/attribute/DeviceAttributeStore.java
@@ -125,7 +125,10 @@ public class DeviceAttributeStore implements
IDeviceAttributeStore {
Map<String, String> attributeMap = new HashMap<>();
String value;
for (int i = 0; i < nameList.size(); i++) {
- value = valueList[i] == null ? null : ((Binary)
valueList[i]).getStringValue(TSFileConfig.STRING_CHARSET);
+ value =
+ valueList[i] == null
+ ? null
+ : ((Binary)
valueList[i]).getStringValue(TSFileConfig.STRING_CHARSET);
if (value != null) {
attributeMap.put(nameList.get(i), value);
memUsage += MemUsageUtil.computeKVMemUsageInMap(nameList.get(i),
value);
diff --git
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/table/DataNodeTableCache.java
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/table/DataNodeTableCache.java
index c514c749315..0ab7fc37fab 100644
---
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/table/DataNodeTableCache.java
+++
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/table/DataNodeTableCache.java
@@ -22,8 +22,8 @@ package org.apache.iotdb.db.schemaengine.table;
import org.apache.iotdb.commons.path.PartialPath;
import org.apache.iotdb.commons.schema.table.TsTable;
import org.apache.iotdb.commons.schema.table.TsTableInternalRPCUtil;
-
import org.apache.iotdb.commons.utils.PathUtils;
+
import org.apache.tsfile.utils.Pair;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
diff --git
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/DataRegion.java
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/DataRegion.java
index b88d3105752..adb6701ecfd 100644
---
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/DataRegion.java
+++
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/DataRegion.java
@@ -215,19 +215,13 @@ public class DataRegion implements IDataRegionForQuery {
*/
private final ReadWriteLock insertLock = new ReentrantReadWriteLock();
- /**
- * Condition to safely delete data region.
- */
+ /** Condition to safely delete data region. */
private final Condition deletedCondition =
insertLock.writeLock().newCondition();
- /**
- * Data region has been deleted or not.
- */
+ /** Data region has been deleted or not. */
private volatile boolean deleted = false;
- /**
- * closeStorageGroupCondition is used to wait for all currently closing
TsFiles to be done.
- */
+ /** closeStorageGroupCondition is used to wait for all currently closing
TsFiles to be done. */
private final Object closeStorageGroupCondition = new Object();
/**
@@ -235,50 +229,32 @@ public class DataRegion implements IDataRegionForQuery {
*/
private final ReadWriteLock closeQueryLock = new ReentrantReadWriteLock();
- /**
- * time partition id in the database -> {@link TsFileProcessor} for this
time partition.
- */
+ /** time partition id in the database -> {@link TsFileProcessor} for this
time partition. */
private final TreeMap<Long, TsFileProcessor> workSequenceTsFileProcessors =
new TreeMap<>();
- /**
- * time partition id in the database -> {@link TsFileProcessor} for this
time partition.
- */
+ /** time partition id in the database -> {@link TsFileProcessor} for this
time partition. */
private final TreeMap<Long, TsFileProcessor> workUnsequenceTsFileProcessors
= new TreeMap<>();
- /**
- * sequence {@link TsFileProcessor}s which are closing.
- */
+ /** sequence {@link TsFileProcessor}s which are closing. */
private final Set<TsFileProcessor> closingSequenceTsFileProcessor =
ConcurrentHashMap.newKeySet();
- /**
- * unsequence {@link TsFileProcessor}s which are closing.
- */
+ /** unsequence {@link TsFileProcessor}s which are closing. */
private final Set<TsFileProcessor> closingUnSequenceTsFileProcessor =
ConcurrentHashMap.newKeySet();
- /**
- * data region id.
- */
+ /** data region id. */
private final String dataRegionId;
- /**
- * database name.
- */
+ /** database name. */
private final String databaseName;
- /**
- * database system directory.
- */
+ /** database system directory. */
private File storageGroupSysDir;
- /**
- * manage seqFileList and unSeqFileList.
- */
+ /** manage seqFileList and unSeqFileList. */
private final TsFileManager tsFileManager;
- /**
- * manage tsFileResource degrade.
- */
+ /** manage tsFileResource degrade. */
private final TsFileResourceManager tsFileResourceManager =
TsFileResourceManager.getInstance();
/**
@@ -289,14 +265,10 @@ public class DataRegion implements IDataRegionForQuery {
private final HashMap<Long, VersionController>
timePartitionIdVersionControllerMap =
new HashMap<>();
- /**
- * file system factory (local or hdfs).
- */
+ /** file system factory (local or hdfs). */
private final FSFactory fsFactory = FSFactoryProducer.getFSFactory();
- /**
- * File flush policy.
- */
+ /** File flush policy. */
private TsFileFlushPolicy fileFlushPolicy;
/**
@@ -307,24 +279,16 @@ public class DataRegion implements IDataRegionForQuery {
*/
private Map<Long, Long> partitionMaxFileVersions = new ConcurrentHashMap<>();
- /**
- * database info for mem control.
- */
+ /** database info for mem control. */
private final DataRegionInfo dataRegionInfo = new DataRegionInfo(this);
- /**
- * whether it's ready from recovery.
- */
+ /** whether it's ready from recovery. */
private boolean isReady = false;
- /**
- * close file listeners.
- */
+ /** close file listeners. */
private List<CloseFileListener> customCloseFileListeners =
Collections.emptyList();
- /**
- * flush listeners.
- */
+ /** flush listeners. */
private List<FlushListener> customFlushListeners = Collections.emptyList();
private ILastFlushTimeMap lastFlushTimeMap;
@@ -348,10 +312,10 @@ public class DataRegion implements IDataRegionForQuery {
/**
* Construct a database processor.
*
- * @param systemDir system dir path
- * @param dataRegionId data region id e.g. 1
+ * @param systemDir system dir path
+ * @param dataRegionId data region id e.g. 1
* @param fileFlushPolicy file flush policy
- * @param databaseName database name e.g. root.sg1
+ * @param databaseName database name e.g. root.sg1
*/
public DataRegion(
String systemDir, String dataRegionId, TsFileFlushPolicy
fileFlushPolicy, String databaseName)
@@ -434,29 +398,19 @@ public class DataRegion implements IDataRegionForQuery {
return ret;
}
- /**
- * this class is used to store recovering context.
- */
+ /** this class is used to store recovering context. */
private class DataRegionRecoveryContext {
- /**
- * number of files to be recovered.
- */
+ /** number of files to be recovered. */
private final long numOfFilesToRecover;
- /**
- * number of already recovered files.
- */
+ /** number of already recovered files. */
private long recoveredFilesNum;
- /**
- * last recovery log time.
- */
+ /** last recovery log time. */
private long lastLogTime;
- /**
- * recover performers of unsealed TsFiles.
- */
+ /** recover performers of unsealed TsFiles. */
private final List<UnsealedTsFileRecoverPerformer> recoverPerformers = new
ArrayList<>();
public DataRegionRecoveryContext(long numOfFilesToRecover) {
@@ -488,9 +442,7 @@ public class DataRegion implements IDataRegionForQuery {
}
}
- /**
- * recover from file
- */
+ /** recover from file */
@SuppressWarnings({"squid:S3776", "squid:S6541"}) // Suppress high Cognitive
Complexity warning
private void recover() throws DataRegionException {
try {
@@ -760,9 +712,7 @@ public class DataRegion implements IDataRegionForQuery {
}
}
- /**
- * check if the tsfile's time is smaller than system current time.
- */
+ /** check if the tsfile's time is smaller than system current time. */
private void checkTsFileTime(File tsFile, long currentTime) throws
DataRegionException {
String[] items = tsFile.getName().replace(TSFILE_SUFFIX,
"").split(FILE_NAME_SEPARATOR);
long fileTime = Long.parseLong(items[0]);
@@ -775,9 +725,7 @@ public class DataRegion implements IDataRegionForQuery {
}
}
- /**
- * submit unsealed TsFile to WALRecoverManager.
- */
+ /** submit unsealed TsFile to WALRecoverManager. */
private WALRecoverListener recoverUnsealedTsFile(
TsFileResource unsealedTsFile, DataRegionRecoveryContext context,
boolean isSeq) {
UnsealedTsFileRecoverPerformer recoverPerformer =
@@ -862,9 +810,7 @@ public class DataRegion implements IDataRegionForQuery {
}
}
- /**
- * recover sealed TsFile.
- */
+ /** recover sealed TsFile. */
private void recoverSealedTsFiles(
TsFileResource sealedTsFile, DataRegionRecoveryContext context, boolean
isSeq) {
try (SealedTsFileRecoverPerformer recoverPerformer =
@@ -955,7 +901,7 @@ public class DataRegion implements IDataRegionForQuery {
boolean isSequence =
config.isEnableSeparateData()
&& insertRowNode.getTime()
- > lastFlushTimeMap.getFlushedTime(timePartitionId,
insertRowNode.getDeviceID());
+ > lastFlushTimeMap.getFlushedTime(timePartitionId,
insertRowNode.getDeviceID());
// insert to sequence or unSequence file
TsFileProcessor tsFileProcessor =
@@ -1010,13 +956,13 @@ public class DataRegion implements IDataRegionForQuery {
// a new partition, insert the remaining of the previous partition
noFailure =
insertTabletToTsFileProcessor(
- insertTabletNode,
- before,
- loc,
- isSequence,
- results,
- beforeTimePartition,
- noFailure)
+ insertTabletNode,
+ before,
+ loc,
+ isSequence,
+ results,
+ beforeTimePartition,
+ noFailure)
&& noFailure;
before = loc;
beforeTimePartition = timePartitionId;
@@ -1026,13 +972,13 @@ public class DataRegion implements IDataRegionForQuery {
// insert previous range into unsequence
noFailure =
insertTabletToTsFileProcessor(
- insertTabletNode,
- before,
- loc,
- isSequence,
- results,
- beforeTimePartition,
- noFailure)
+ insertTabletNode,
+ before,
+ loc,
+ isSequence,
+ results,
+ beforeTimePartition,
+ noFailure)
&& noFailure;
before = loc;
isSequence = true;
@@ -1045,13 +991,13 @@ public class DataRegion implements IDataRegionForQuery {
if (before < loc) {
noFailure =
insertTabletToTsFileProcessor(
- insertTabletNode,
- before,
- loc,
- isSequence,
- results,
- beforeTimePartition,
- noFailure)
+ insertTabletNode,
+ before,
+ loc,
+ isSequence,
+ results,
+ beforeTimePartition,
+ noFailure)
&& noFailure;
}
@@ -1073,7 +1019,8 @@ public class DataRegion implements IDataRegionForQuery {
try {
if (deleted) {
logger.info(
- "Won't insert tablet {}, because region is deleted",
insertTabletNode.getSearchIndex()); return;
+ "Won't insert tablet {}, because region is deleted",
insertTabletNode.getSearchIndex());
+ return;
}
TSStatus[] results = new TSStatus[insertTabletNode.getRowCount()];
Arrays.fill(results, RpcUtils.SUCCESS_STATUS);
@@ -1168,11 +1115,11 @@ public class DataRegion implements IDataRegionForQuery {
* subsequent non-null value, e.g., {1, null, 3, null, 5} will be {1, 3, 5,
null, 5}
*
* @param insertTabletNode insert a tablet of a device
- * @param sequence whether is sequence
- * @param start start index of rows to be inserted in
insertTabletPlan
- * @param end end index of rows to be inserted in
insertTabletPlan
- * @param results result array
- * @param timePartitionId time partition id
+ * @param sequence whether is sequence
+ * @param start start index of rows to be inserted in insertTabletPlan
+ * @param end end index of rows to be inserted in insertTabletPlan
+ * @param results result array
+ * @param timePartitionId time partition id
* @return false if any failure occurs when inserting the tablet, true
otherwise
*/
private boolean insertTabletToTsFileProcessor(
@@ -1258,8 +1205,10 @@ public class DataRegion implements IDataRegionForQuery {
node.getMeasurementSchemas(),
node.isAligned(),
node::composeLastTimeValuePair,
- index -> node.getColumns()[index] != null &&
(node.getColumnCategories() == null
- || node.getColumnCategories()[index] ==
TsTableColumnCategory.MEASUREMENT),
+ index ->
+ node.getColumns()[index] != null
+ && (node.getColumnCategories() == null
+ || node.getColumnCategories()[index] ==
TsTableColumnCategory.MEASUREMENT),
true,
latestFlushedTime);
}
@@ -1301,8 +1250,10 @@ public class DataRegion implements IDataRegionForQuery {
node.getMeasurementSchemas(),
node.isAligned(),
node::composeTimeValuePair,
- index -> node.getValues()[index] != null &&
(node.getColumnCategories() == null
- || node.getColumnCategories()[index] ==
TsTableColumnCategory.MEASUREMENT),
+ index ->
+ node.getValues()[index] != null
+ && (node.getColumnCategories() == null
+ || node.getColumnCategories()[index] ==
TsTableColumnCategory.MEASUREMENT),
true,
latestFlushedTime);
}
@@ -1507,9 +1458,9 @@ public class DataRegion implements IDataRegionForQuery {
/**
* get processor from hashmap, flush oldest processor if necessary
*
- * @param timeRangeId time partition range
+ * @param timeRangeId time partition range
* @param tsFileProcessorTreeMap tsFileProcessorTreeMap
- * @param sequence whether is sequence or not
+ * @param sequence whether is sequence or not
*/
private TsFileProcessor getOrCreateTsFileProcessorIntern(
long timeRangeId, TreeMap<Long, TsFileProcessor> tsFileProcessorTreeMap,
boolean sequence)
@@ -1593,7 +1544,7 @@ public class DataRegion implements IDataRegionForQuery {
/**
* close one tsfile processor
*
- * @param sequence whether this tsfile processor is sequence or not
+ * @param sequence whether this tsfile processor is sequence or not
* @param tsFileProcessor tsfile processor
*/
public void syncCloseOneTsFileProcessor(boolean sequence, TsFileProcessor
tsFileProcessor) {
@@ -1626,7 +1577,7 @@ public class DataRegion implements IDataRegionForQuery {
/**
* close one tsfile processor, thread-safety should be ensured by caller
*
- * @param sequence whether this tsfile processor is sequence or not
+ * @param sequence whether this tsfile processor is sequence or not
* @param tsFileProcessor tsfile processor
*/
public Future<?> asyncCloseOneTsFileProcessor(boolean sequence,
TsFileProcessor tsFileProcessor) {
@@ -1691,9 +1642,7 @@ public class DataRegion implements IDataRegionForQuery {
}
}
- /**
- * close all tsfile resource
- */
+ /** close all tsfile resource */
public void closeAllResources() {
for (TsFileResource tsFileResource : tsFileManager.getTsFileList(false)) {
try {
@@ -1711,9 +1660,7 @@ public class DataRegion implements IDataRegionForQuery {
}
}
- /**
- * delete tsfile
- */
+ /** delete tsfile */
public void syncDeleteDataFiles() throws TsFileProcessorException {
logger.info(
"{} will close all files for deleting data files", databaseName + "-"
+ dataRegionId);
@@ -1823,9 +1770,7 @@ public class DataRegion implements IDataRegionForQuery {
WritingMetrics.getInstance().recordTimedFlushMemTableCount(count);
}
- /**
- * This method will be blocked until all tsfile processors are closed.
- */
+ /** This method will be blocked until all tsfile processors are closed. */
public void syncCloseAllWorkingTsFileProcessors() {
try {
List<Future<?>> tsFileProcessorsClosingFutures =
asyncCloseAllWorkingTsFileProcessors();
@@ -1864,9 +1809,7 @@ public class DataRegion implements IDataRegionForQuery {
}
}
- /**
- * close all working tsfile processors
- */
+ /** close all working tsfile processors */
List<Future<?>> asyncCloseAllWorkingTsFileProcessors() {
writeLock("asyncCloseAllWorkingTsFileProcessors");
List<Future<?>> futures = new ArrayList<>();
@@ -1892,9 +1835,7 @@ public class DataRegion implements IDataRegionForQuery {
return futures;
}
- /**
- * force close all working tsfile processors
- */
+ /** force close all working tsfile processors */
public void forceCloseAllWorkingTsFileProcessors() throws
TsFileProcessorException {
writeLock("forceCloseAllWorkingTsFileProcessors");
try {
@@ -1915,9 +1856,7 @@ public class DataRegion implements IDataRegionForQuery {
}
}
- /**
- * used for queryengine
- */
+ /** used for queryengine */
@Override
public QueryDataSource query(
List<IFullPath> pathList,
@@ -2081,9 +2020,7 @@ public class DataRegion implements IDataRegionForQuery {
return fileScanHandles;
}
- /**
- * lock the read lock of the insert lock
- */
+ /** lock the read lock of the insert lock */
@Override
public void readLock() {
// apply read lock for SG insert lock to prevent inconsistent with
concurrently writing memtable
@@ -2092,26 +2029,20 @@ public class DataRegion implements IDataRegionForQuery {
tsFileManager.readLock();
}
- /**
- * unlock the read lock of insert lock
- */
+ /** unlock the read lock of insert lock */
@Override
public void readUnlock() {
tsFileManager.readUnlock();
insertLock.readLock().unlock();
}
- /**
- * lock the write lock of the insert lock
- */
+ /** lock the write lock of the insert lock */
public void writeLock(String holder) {
insertLock.writeLock().lock();
insertWriteLockHolder = holder;
}
- /**
- * unlock the write lock of the insert lock
- */
+ /** unlock the write lock of the insert lock */
public void writeUnlock() {
insertWriteLockHolder = "";
insertLock.writeLock().unlock();
@@ -2588,9 +2519,7 @@ public class DataRegion implements IDataRegionForQuery {
}
}
- /**
- * Put the memtable back to the MemTablePool and make the metadata in writer
visible
- */
+ /** Put the memtable back to the MemTablePool and make the metadata in
writer visible */
// TODO please consider concurrency with read and insert method.
private void closeUnsealedTsFileProcessorCallBack(TsFileProcessor
tsFileProcessor)
throws TsFileProcessorException {
@@ -2686,9 +2615,7 @@ public class DataRegion implements IDataRegionForQuery {
return trySubmitCount;
}
- /**
- * Schedule settle compaction for ttl check.
- */
+ /** Schedule settle compaction for ttl check. */
public int executeTTLCheck() throws InterruptedException {
while (!isCompactionSelecting.compareAndSet(false, true)) {
// wait until success
@@ -2817,9 +2744,7 @@ public class DataRegion implements IDataRegionForQuery {
return getNonSystemDatabaseName(databaseName);
}
- /**
- * Merge file under this database processor
- */
+ /** Merge file under this database processor */
public int compact() {
writeLock("merge");
CompactionScheduler.exclusiveLockCompactionSelection();
@@ -2839,7 +2764,7 @@ public class DataRegion implements IDataRegionForQuery {
* <p>Then, update the latestTimeForEachDevice and
partitionLatestFlushedTimeForEachDevice.
*
* @param newTsFileResource tsfile resource @UsedBy load external tsfile
module
- * @param deleteOriginFile whether to delete origin tsfile
+ * @param deleteOriginFile whether to delete origin tsfile
* @param isGeneratedByPipe whether the load tsfile request is generated by
pipe
*/
public void loadNewTsFile(
@@ -3028,8 +2953,8 @@ public class DataRegion implements IDataRegionForQuery {
}
/**
- * Update latest time in latestTimeForEachDevice and
partitionLatestFlushedTimeForEachDevice.
- * @UsedBy sync module, load external tsfile module.
+ * Update latest time in latestTimeForEachDevice and
+ * partitionLatestFlushedTimeForEachDevice. @UsedBy sync module, load
external tsfile module.
*/
protected void updateLastFlushTime(TsFileResource newTsFileResource) {
for (IDeviceID device : newTsFileResource.getDevices()) {
@@ -3047,8 +2972,8 @@ public class DataRegion implements IDataRegionForQuery {
/**
* Execute the loading process by the type.
*
- * @param tsFileResource tsfile resource to be loaded
- * @param filePartitionId the partition id of the new file
+ * @param tsFileResource tsfile resource to be loaded
+ * @param filePartitionId the partition id of the new file
* @param deleteOriginFile whether to delete the original file
* @return load the file successfully @UsedBy sync module, load external
tsfile module.
*/
@@ -3298,14 +3223,14 @@ public class DataRegion implements IDataRegionForQuery {
* "tsFileResource" have the same plan indexes as the local one.
*
* @return true if any file contains plans with indexes no less than the max
plan index of
- * "tsFileResource", otherwise false.
+ * "tsFileResource", otherwise false.
*/
public boolean isFileAlreadyExist(TsFileResource tsFileResource, long
partitionNum) {
// examine working processor first as they have the largest plan index
return isFileAlreadyExistInWorking(
- tsFileResource, partitionNum, getWorkSequenceTsFileProcessors())
+ tsFileResource, partitionNum, getWorkSequenceTsFileProcessors())
|| isFileAlreadyExistInWorking(
- tsFileResource, partitionNum, getWorkUnsequenceTsFileProcessors())
+ tsFileResource, partitionNum, getWorkUnsequenceTsFileProcessors())
|| isFileAlreadyExistInClosed(tsFileResource, partitionNum,
getSequenceFileList())
|| isFileAlreadyExistInClosed(tsFileResource, partitionNum,
getUnSequenceFileList());
}
@@ -3429,7 +3354,7 @@ public class DataRegion implements IDataRegionForQuery {
boolean isSequence =
config.isEnableSeparateData()
&& insertRowNode.getTime()
- > lastFlushTimeMap.getFlushedTime(timePartitionId,
insertRowNode.getDeviceID());
+ > lastFlushTimeMap.getFlushedTime(timePartitionId,
insertRowNode.getDeviceID());
TsFileProcessor tsFileProcessor =
getOrCreateTsFileProcessor(timePartitionId, isSequence);
if (tsFileProcessor == null) {
continue;
@@ -3543,8 +3468,8 @@ public class DataRegion implements IDataRegionForQuery {
areSequence[i] =
config.isEnableSeparateData()
&& insertRowNode.getTime()
- > lastFlushTimeMap.getFlushedTime(
- timePartitionIds[i], insertRowNode.getDeviceID());
+ > lastFlushTimeMap.getFlushedTime(
+ timePartitionIds[i], insertRowNode.getDeviceID());
}
List<InsertRowNode> executedInsertRowNodeList =
insertToTsFileProcessors(insertRowsNode, areSequence,
timePartitionIds);
@@ -3620,7 +3545,7 @@ public class DataRegion implements IDataRegionForQuery {
}
/**
- * @param folder the folder's path
+ * @param folder the folder's path
* @param diskSize the disk space occupied by this folder, unit is MB
*/
private void countFolderDiskSize(String folder, AtomicLong diskSize) {
@@ -3741,9 +3666,7 @@ public class DataRegion implements IDataRegionForQuery {
.applyForWALNode(databaseName + FILE_NAME_SEPARATOR +
dataRegionId));
}
- /**
- * Wait for this data region successfully deleted
- */
+ /** Wait for this data region successfully deleted */
public void waitForDeleted() {
writeLock("waitForDeleted");
try {
@@ -3759,9 +3682,7 @@ public class DataRegion implements IDataRegionForQuery {
}
}
- /**
- * Release all threads waiting for this data region successfully deleted
- */
+ /** Release all threads waiting for this data region successfully deleted */
public void markDeleted() {
writeLock("markDeleted");
try {
diff --git
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/memtable/AbstractMemTable.java
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/memtable/AbstractMemTable.java
index 5b6a7ac1ff1..22b1dadb394 100644
---
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/memtable/AbstractMemTable.java
+++
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/memtable/AbstractMemTable.java
@@ -84,16 +84,12 @@ import static
org.apache.iotdb.db.storageengine.rescon.memory.PrimitiveArrayMana
public abstract class AbstractMemTable implements IMemTable {
- /**
- * Each memTable node has a unique int value identifier, init when
recovering wal.
- */
+ /** Each memTable node has a unique int value identifier, init when
recovering wal. */
public static final AtomicLong memTableIdCounter = new AtomicLong(-1);
private static final int FIXED_SERIALIZED_SIZE = Byte.BYTES + 2 *
Integer.BYTES + 6 * Long.BYTES;
- /**
- * DeviceId -> chunkGroup(MeasurementId -> chunk).
- */
+ /** DeviceId -> chunkGroup(MeasurementId -> chunk). */
private final Map<IDeviceID, IWritableMemChunkGroup> memTableMap;
private static final DeviceIDFactory deviceIDFactory =
DeviceIDFactory.getInstance();
@@ -103,9 +99,7 @@ public abstract class AbstractMemTable implements IMemTable {
private final int avgSeriesPointNumThreshold =
IoTDBDescriptor.getInstance().getConfig().getAvgSeriesPointNumberThreshold();
- /**
- * Memory size of data points, including TEXT values.
- */
+ /** Memory size of data points, including TEXT values. */
private long memSize = 0;
/**
@@ -128,9 +122,7 @@ public abstract class AbstractMemTable implements IMemTable
{
private final long createdTime = System.currentTimeMillis();
- /**
- * this time is updated by the timed flush, same as createdTime when the
feature is disabled.
- */
+ /** this time is updated by the timed flush, same as createdTime when the
feature is disabled. */
private long updateTime = createdTime;
/**
@@ -173,7 +165,7 @@ public abstract class AbstractMemTable implements IMemTable
{
/**
* Create this MemChunk if it's not exist.
*
- * @param deviceId device id
+ * @param deviceId device id
* @param schemaList measurement schemaList
* @return this MemChunkGroup
*/
@@ -281,9 +273,10 @@ public abstract class AbstractMemTable implements
IMemTable {
List<TSDataType> dataTypes = new ArrayList<>();
for (int i = 0; i < insertRowNode.getMeasurements().length; i++) {
// Use measurements[i] to ignore failed partial insert
- if (measurements[i] == null || values[i] == null
+ if (measurements[i] == null
+ || values[i] == null
|| insertRowNode.getColumnCategories() != null
- && insertRowNode.getColumnCategories()[i] !=
TsTableColumnCategory.MEASUREMENT) {
+ && insertRowNode.getColumnCategories()[i] !=
TsTableColumnCategory.MEASUREMENT) {
schemaList.add(null);
continue;
}
@@ -294,8 +287,8 @@ public abstract class AbstractMemTable implements IMemTable
{
if (schemaList.isEmpty()) {
return;
}
- memSize += MemUtils.getAlignedRowRecordSize(dataTypes, values,
- insertRowNode.getColumnCategories());
+ memSize +=
+ MemUtils.getAlignedRowRecordSize(dataTypes, values,
insertRowNode.getColumnCategories());
writeAlignedRow(insertRowNode.getDeviceID(), schemaList,
insertRowNode.getTime(), values);
int pointsInserted =
insertRowNode.getMeasurementColumnCnt() -
insertRowNode.getFailedMeasurementNumber();
@@ -384,7 +377,7 @@ public abstract class AbstractMemTable implements IMemTable
{
memSize += MemUtils.getAlignedTabletSize(insertTabletNode, start, end,
results);
int pointsInserted =
(insertTabletNode.getMeasurementColumnCnt()
- - insertTabletNode.getFailedMeasurementNumber())
+ - insertTabletNode.getFailedMeasurementNumber())
* (end - start);
totalPointsNum += pointsInserted;
MetricService.getInstance()
@@ -476,7 +469,7 @@ public abstract class AbstractMemTable implements IMemTable
{
for (int i = 0; i < insertTabletNode.getMeasurementSchemas().length; i++) {
if (insertTabletNode.getColumns()[i] == null
|| (insertTabletNode.getColumnCategories() != null
- && insertTabletNode.getColumnCategories()[i] !=
TsTableColumnCategory.MEASUREMENT)) {
+ && insertTabletNode.getColumnCategories()[i] !=
TsTableColumnCategory.MEASUREMENT)) {
schemaList.add(null);
} else {
schemaList.add(insertTabletNode.getMeasurementSchemas()[i]);
@@ -835,7 +828,7 @@ public abstract class AbstractMemTable implements IMemTable
{
private long[] calculateStartEndTime(long[] timestamps, List<BitMap>
bitMaps) {
if (bitMaps.isEmpty()) {
- return new long[]{timestamps[0], timestamps[timestamps.length - 1]};
+ return new long[] {timestamps[0], timestamps[timestamps.length - 1]};
}
long startTime = -1, endTime = -1;
for (int i = 0; i < timestamps.length; i++) {
@@ -855,7 +848,7 @@ public abstract class AbstractMemTable implements IMemTable
{
break;
}
}
- return new long[]{startTime, endTime};
+ return new long[] {startTime, endTime};
}
private IChunkMetadata buildChunkMetaDataForMemoryChunk(
@@ -904,13 +897,12 @@ public abstract class AbstractMemTable implements
IMemTable {
/**
* Delete data by path and timeStamp.
*
- * @param originalPath the original path pattern or full path to be used
to match timeseries,
- * e.g. root.sg.**, root.sg.*.s, root.sg.d.s
- * @param devicePath one of the device path patterns generated by
original path, e.g. given
- * original path root.sg.** and the device path may be
root.sg or
- * root.sg.**
+ * @param originalPath the original path pattern or full path to be used to
match timeseries, e.g.
+ * root.sg.**, root.sg.*.s, root.sg.d.s
+ * @param devicePath one of the device path patterns generated by original
path, e.g. given
+ * original path root.sg.** and the device path may be root.sg or
root.sg.**
* @param startTimestamp the lower-bound of deletion time.
- * @param endTimestamp the upper-bound of deletion time
+ * @param endTimestamp the upper-bound of deletion time
*/
@SuppressWarnings("squid:S3776") // high Cognitive Complexity
@Override
@@ -1019,9 +1011,7 @@ public abstract class AbstractMemTable implements
IMemTable {
return createdTime;
}
- /**
- * Check whether updated since last get method
- */
+ /** Check whether updated since last get method */
@Override
public long getUpdateTime() {
if (lastTotalPointsNum != totalPointsNum) {
@@ -1041,9 +1031,7 @@ public abstract class AbstractMemTable implements
IMemTable {
this.flushStatus = flushStatus;
}
- /**
- * Notice: this method is concurrent unsafe.
- */
+ /** Notice: this method is concurrent unsafe. */
@Override
public int serializedSize() {
if (isSignalMemTable()) {
@@ -1058,9 +1046,7 @@ public abstract class AbstractMemTable implements
IMemTable {
return size;
}
- /**
- * Notice: this method is concurrent unsafe.
- */
+ /** Notice: this method is concurrent unsafe. */
@Override
public void serializeToWAL(IWALByteBufferView buffer) {
// TODO:[WAL]
diff --git
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/memtable/TsFileProcessor.java
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/memtable/TsFileProcessor.java
index 375bce28133..d504eafe1aa 100644
---
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/memtable/TsFileProcessor.java
+++
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/memtable/TsFileProcessor.java
@@ -118,56 +118,36 @@ import static
org.apache.iotdb.db.queryengine.metric.QueryResourceMetricSet.WORK
@SuppressWarnings("java:S1135") // ignore todos
public class TsFileProcessor {
- /**
- * Logger fot this class.
- */
+ /** Logger fot this class. */
private static final Logger logger =
LoggerFactory.getLogger(TsFileProcessor.class);
private static final int NUM_MEM_TO_ESTIMATE = 3;
- /**
- * Storage group name of this tsfile.
- */
+ /** Storage group name of this tsfile. */
private final String storageGroupName;
- /**
- * IoTDB config.
- */
+ /** IoTDB config. */
private final IoTDBConfig config = IoTDBDescriptor.getInstance().getConfig();
- /**
- * Database info for mem control.
- */
+ /** Database info for mem control. */
private final DataRegionInfo dataRegionInfo;
- /**
- * Tsfile processor info for mem control.
- */
+ /** Tsfile processor info for mem control. */
private TsFileProcessorInfo tsFileProcessorInfo;
- /**
- * Sync this object in read() and asyncTryToFlush().
- */
+ /** Sync this object in read() and asyncTryToFlush(). */
private final ConcurrentLinkedDeque<IMemTable> flushingMemTables = new
ConcurrentLinkedDeque<>();
- /**
- * Modification to memtable mapping.
- */
+ /** Modification to memtable mapping. */
private final List<Pair<Modification, IMemTable>> modsToMemtable = new
ArrayList<>();
- /**
- * Writer for restore tsfile and flushing.
- */
+ /** Writer for restore tsfile and flushing. */
private RestorableTsFileIOWriter writer;
- /**
- * Tsfile resource for index this tsfile.
- */
+ /** Tsfile resource for index this tsfile. */
private final TsFileResource tsFileResource;
- /**
- * Time range index to indicate this processor belongs to which time range
- */
+ /** Time range index to indicate this processor belongs to which time range
*/
private long timeRangeId;
/**
@@ -175,9 +155,7 @@ public class TsFileProcessor {
*/
private volatile boolean managedByFlushManager;
- /**
- * A lock to mutual exclude read and read
- */
+ /** A lock to mutual exclude read and read */
private final ReadWriteLock flushQueryLock = new ReentrantReadWriteLock();
/**
@@ -186,19 +164,13 @@ public class TsFileProcessor {
*/
private volatile boolean shouldClose;
- /**
- * Working memtable.
- */
+ /** Working memtable. */
private IMemTable workMemTable;
- /**
- * Last flush time to flush the working memtable.
- */
+ /** Last flush time to flush the working memtable. */
private long lastWorkMemtableFlushTime;
- /**
- * This callback is called before the workMemtable is added into the
flushingMemTables.
- */
+ /** This callback is called before the workMemtable is added into the
flushingMemTables. */
private final DataRegion.UpdateEndTimeCallBack updateLatestFlushTimeCallback;
public static final long FLUSH_POINT_COUNT_NOT_SET = -1;
@@ -209,28 +181,20 @@ public class TsFileProcessor {
/** Wal node. */
private final IWALNode walNode;
- /**
- * Whether it's a sequence file or not.
- */
+ /** Whether it's a sequence file or not. */
private final boolean sequence;
- /**
- * Total memtable size for mem control.
- */
+ /** Total memtable size for mem control. */
private long totalMemTableSize;
private static final String FLUSH_QUERY_WRITE_LOCKED = "{}: {} get
flushQueryLock write lock";
private static final String FLUSH_QUERY_WRITE_RELEASE =
"{}: {} get flushQueryLock write lock released";
- /**
- * Close file listener.
- */
+ /** Close file listener. */
private final List<CloseFileListener> closeFileListeners = new
CopyOnWriteArrayList<>();
- /**
- * Flush file listener.
- */
+ /** Flush file listener. */
private final List<FlushListener> flushListeners = new ArrayList<>();
private final QueryExecutionMetricSet QUERY_EXECUTION_METRICS =
@@ -302,7 +266,6 @@ public class TsFileProcessor {
WritingMetrics.getInstance()
.recordActiveMemTableCount(dataRegionInfo.getDataRegion().getDataRegionId(), 1);
}
-
}
/**
@@ -320,8 +283,10 @@ public class TsFileProcessor {
if (insertRowNode.isAligned()) {
memIncrements =
checkAlignedMemCostAndAddToTspInfoForRow(
- insertRowNode.getDeviceID(), insertRowNode.getMeasurements(),
- insertRowNode.getDataTypes(), insertRowNode.getValues(),
+ insertRowNode.getDeviceID(),
+ insertRowNode.getMeasurements(),
+ insertRowNode.getDataTypes(),
+ insertRowNode.getValues(),
insertRowNode.getColumnCategories());
} else {
memIncrements =
@@ -531,9 +496,9 @@ public class TsFileProcessor {
* non-null value, e.g., {1, null, 3, null, 5} will be {1, 3, 5, null, 5}
*
* @param insertTabletNode insert a tablet of a device
- * @param start start index of rows to be inserted in
insertTabletPlan
- * @param end end index of rows to be inserted in
insertTabletPlan
- * @param results result array
+ * @param start start index of rows to be inserted in insertTabletPlan
+ * @param end end index of rows to be inserted in insertTabletPlan
+ * @param results result array
*/
public void insertTablet(
InsertTabletNode insertTabletNode, int start, int end, TSStatus[]
results, boolean noFailure)
@@ -652,7 +617,7 @@ public class TsFileProcessor {
}
}
updateMemoryInfo(memTableIncrement, chunkMetadataIncrement,
textDataIncrement);
- return new long[]{memTableIncrement, textDataIncrement,
chunkMetadataIncrement};
+ return new long[] {memTableIncrement, textDataIncrement,
chunkMetadataIncrement};
}
@SuppressWarnings("squid:S3776") // High Cognitive Complexity
@@ -676,7 +641,7 @@ public class TsFileProcessor {
}
if (workMemTable.chunkNotExist(deviceId, measurements[i])
&& (!increasingMemTableInfo.containsKey(deviceId)
- ||
!increasingMemTableInfo.get(deviceId).containsKey(measurements[i]))) {
+ ||
!increasingMemTableInfo.get(deviceId).containsKey(measurements[i]))) {
// ChunkMetadataIncrement
chunkMetadataIncrement +=
ChunkMetadata.calculateRamSize(measurements[i], dataTypes[i]);
memTableIncrement += TVList.tvListArrayMemCost(dataTypes[i]);
@@ -703,12 +668,15 @@ public class TsFileProcessor {
}
}
updateMemoryInfo(memTableIncrement, chunkMetadataIncrement,
textDataIncrement);
- return new long[]{memTableIncrement, textDataIncrement,
chunkMetadataIncrement};
+ return new long[] {memTableIncrement, textDataIncrement,
chunkMetadataIncrement};
}
@SuppressWarnings("squid:S3776") // high Cognitive Complexity
private long[] checkAlignedMemCostAndAddToTspInfoForRow(
- IDeviceID deviceId, String[] measurements, TSDataType[] dataTypes,
Object[] values,
+ IDeviceID deviceId,
+ String[] measurements,
+ TSDataType[] dataTypes,
+ Object[] values,
TsTableColumnCategory[] columnCategories)
throws WriteProcessException {
// Memory of increased PrimitiveArray and TEXT values, e.g., add a
long[128], add 128*8
@@ -731,17 +699,22 @@ public class TsFileProcessor {
List<TSDataType> dataTypesInTVList = new ArrayList<>();
for (int i = 0; i < dataTypes.length; i++) {
// Skip failed Measurements
- if (dataTypes[i] == null || measurements[i] == null ||
(columnCategories != null
- && columnCategories[i] != TsTableColumnCategory.MEASUREMENT)) {
+ if (dataTypes[i] == null
+ || measurements[i] == null
+ || (columnCategories != null
+ && columnCategories[i] != TsTableColumnCategory.MEASUREMENT)) {
continue;
}
// add arrays for new columns
if (!alignedMemChunk.containsMeasurement(measurements[i])) {
- int currentArrayNum = alignedMemChunk.alignedListSize() /
PrimitiveArrayManager.ARRAY_SIZE +
- alignedMemChunk.alignedListSize() %
PrimitiveArrayManager.ARRAY_SIZE > 0 ? 1 : 0;
- memTableIncrement +=
- currentArrayNum *
AlignedTVList.valueListArrayMemCost(dataTypes[i]);
+ int currentArrayNum =
+ alignedMemChunk.alignedListSize() /
PrimitiveArrayManager.ARRAY_SIZE
+ + alignedMemChunk.alignedListSize() %
PrimitiveArrayManager.ARRAY_SIZE
+ > 0
+ ? 1
+ : 0;
+ memTableIncrement += currentArrayNum *
AlignedTVList.valueListArrayMemCost(dataTypes[i]);
dataTypesInTVList.add(dataTypes[i]);
}
}
@@ -759,7 +732,7 @@ public class TsFileProcessor {
}
}
updateMemoryInfo(memTableIncrement, chunkMetadataIncrement,
textDataIncrement);
- return new long[]{memTableIncrement, textDataIncrement,
chunkMetadataIncrement};
+ return new long[] {memTableIncrement, textDataIncrement,
chunkMetadataIncrement};
}
@SuppressWarnings("squid:S3776") // high Cognitive Complexity
@@ -843,7 +816,7 @@ public class TsFileProcessor {
}
}
updateMemoryInfo(memTableIncrement, chunkMetadataIncrement,
textDataIncrement);
- return new long[]{memTableIncrement, textDataIncrement,
chunkMetadataIncrement};
+ return new long[] {memTableIncrement, textDataIncrement,
chunkMetadataIncrement};
}
private long[] checkMemCostAndAddToTspInfoForTablet(
@@ -855,7 +828,7 @@ public class TsFileProcessor {
int end)
throws WriteProcessException {
if (start >= end) {
- return new long[]{0, 0, 0};
+ return new long[] {0, 0, 0};
}
long[] memIncrements = new long[3]; // memTable, text, chunk metadata
@@ -885,7 +858,7 @@ public class TsFileProcessor {
TSStatus[] results)
throws WriteProcessException {
if (start >= end) {
- return new long[]{0, 0, 0};
+ return new long[] {0, 0, 0};
}
long[] memIncrements = new long[3]; // memTable, text, chunk metadata
@@ -990,8 +963,8 @@ public class TsFileProcessor {
int numArraysToAdd =
incomingPointNum / PrimitiveArrayManager.ARRAY_SIZE
- + incomingPointNum % PrimitiveArrayManager.ARRAY_SIZE
- > 0
+ + incomingPointNum % PrimitiveArrayManager.ARRAY_SIZE
+ > 0
? 1
: 0;
memIncrements[0] +=
@@ -1011,7 +984,7 @@ public class TsFileProcessor {
|| column == null
|| measurement == null
|| (columnCategories != null
- && columnCategories[i] != TsTableColumnCategory.MEASUREMENT)) {
+ && columnCategories[i] != TsTableColumnCategory.MEASUREMENT)) {
continue;
}
@@ -1027,14 +1000,14 @@ public class TsFileProcessor {
// calculate how many new arrays will be added after this insertion
int currentArrayCnt =
currentPointNum / PrimitiveArrayManager.ARRAY_SIZE
- + currentPointNum % PrimitiveArrayManager.ARRAY_SIZE
- > 0
+ + currentPointNum % PrimitiveArrayManager.ARRAY_SIZE
+ > 0
? 1
: 0;
int newArrayCnt =
newPointNum / PrimitiveArrayManager.ARRAY_SIZE
- + newPointNum % PrimitiveArrayManager.ARRAY_SIZE
- > 0
+ + newPointNum % PrimitiveArrayManager.ARRAY_SIZE
+ > 0
? 1
: 0;
long acquireArray = newArrayCnt - currentArrayCnt;
@@ -1056,7 +1029,7 @@ public class TsFileProcessor {
|| column == null
|| measurement == null
|| (columnCategories != null
- && columnCategories[i] != TsTableColumnCategory.MEASUREMENT)) {
+ && columnCategories[i] != TsTableColumnCategory.MEASUREMENT)) {
continue;
}
@@ -1207,9 +1180,7 @@ public class TsFileProcessor {
logger.info("File {} is closed synchronously",
tsFileResource.getTsFile().getAbsolutePath());
}
- /**
- * async close one tsfile, register and close it by another thread
- */
+ /** async close one tsfile, register and close it by another thread */
public Future<?> asyncClose() {
flushQueryLock.writeLock().lock();
if (logger.isDebugEnabled()) {
@@ -1335,9 +1306,7 @@ public class TsFileProcessor {
}
}
- /**
- * Put the working memtable into flushing list and set the working memtable
to null
- */
+ /** Put the working memtable into flushing list and set the working memtable
to null */
public void asyncFlush() {
flushQueryLock.writeLock().lock();
if (logger.isDebugEnabled()) {
@@ -1415,9 +1384,7 @@ public class TsFileProcessor {
return FlushManager.getInstance().registerTsFileProcessor(this);
}
- /**
- * Put back the memtable to MemTablePool and make metadata in writer visible
- */
+ /** Put back the memtable to MemTablePool and make metadata in writer
visible */
private void releaseFlushedMemTable(IMemTable memTable) {
flushQueryLock.writeLock().lock();
if (logger.isDebugEnabled()) {
@@ -1474,9 +1441,7 @@ public class TsFileProcessor {
}
}
- /**
- * This method will synchronize the memTable and release its flushing
resources
- */
+ /** This method will synchronize the memTable and release its flushing
resources */
private void syncReleaseFlushedMemTable(IMemTable memTable) {
synchronized (flushingMemTables) {
releaseFlushedMemTable(memTable);
@@ -1712,9 +1677,7 @@ public class TsFileProcessor {
}
}
- /**
- * end file and write some meta
- */
+ /** end file and write some meta */
private void endFile() throws IOException, TsFileProcessorException {
if (logger.isDebugEnabled()) {
logger.debug("Start to end file {}", tsFileResource);
@@ -1736,9 +1699,7 @@ public class TsFileProcessor {
writer = null;
}
- /**
- * End empty file and remove it from file system
- */
+ /** End empty file and remove it from file system */
private void endEmptyFile() throws TsFileProcessorException, IOException {
logger.info("Start to end empty file {}", tsFileResource);
@@ -1766,9 +1727,7 @@ public class TsFileProcessor {
this.managedByFlushManager = managedByFlushManager;
}
- /**
- * Close this tsfile
- */
+ /** Close this tsfile */
public void close() throws TsFileProcessorException {
try {
// When closing resource file, its corresponding mod file is also closed.
@@ -2220,9 +2179,7 @@ public class TsFileProcessor {
this.timeRangeId = timeRangeId;
}
- /**
- * Release resource of a memtable
- */
+ /** Release resource of a memtable */
public void putMemTableBackAndClose() throws TsFileProcessorException {
if (workMemTable != null) {
workMemTable.release();
@@ -2246,16 +2203,12 @@ public class TsFileProcessor {
return workMemTable != null ? workMemTable.getTVListsRamCost() : 0;
}
- /**
- * Return Long.MAX_VALUE if workMemTable is null
- */
+ /** Return Long.MAX_VALUE if workMemTable is null */
public long getWorkMemTableCreatedTime() {
return workMemTable != null ? workMemTable.getCreatedTime() :
Long.MAX_VALUE;
}
- /**
- * Return Long.MAX_VALUE if workMemTable is null
- */
+ /** Return Long.MAX_VALUE if workMemTable is null */
public long getWorkMemTableUpdateTime() {
return workMemTable != null ? workMemTable.getUpdateTime() :
Long.MAX_VALUE;
}
diff --git
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/utils/CommonUtils.java
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/utils/CommonUtils.java
index 9a3308d912b..cbadd577eea 100644
---
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/utils/CommonUtils.java
+++
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/utils/CommonUtils.java
@@ -474,5 +474,4 @@ public class CommonUtils {
array[i] = array[j];
array[j] = tmp;
}
-
}
diff --git
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/utils/MemUtils.java
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/utils/MemUtils.java
index 70cc9befd69..3f2e5327fec 100644
--- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/utils/MemUtils.java
+++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/utils/MemUtils.java
@@ -47,8 +47,7 @@ public class MemUtils {
private static final Logger LOGGER = LoggerFactory.getLogger(MemUtils.class);
- private MemUtils() {
- }
+ private MemUtils() {}
/**
* Function for obtaining the value size. For text values, there are two
conditions: 1. During
@@ -83,12 +82,13 @@ public class MemUtils {
* Function for obtaining the value size. For text values, their size has
already been added to
* memory before insertion
*/
- public static long getAlignedRowRecordSize(List<TSDataType> dataTypes,
Object[] value,
- TsTableColumnCategory[] columnCategories) {
+ public static long getAlignedRowRecordSize(
+ List<TSDataType> dataTypes, Object[] value, TsTableColumnCategory[]
columnCategories) {
// time and index size
long memSize = 8L + 4L;
for (int i = 0; i < dataTypes.size(); i++) {
- if (value[i] == null || dataTypes.get(i).isBinary()
+ if (value[i] == null
+ || dataTypes.get(i).isBinary()
|| columnCategories != null && columnCategories[i] !=
TsTableColumnCategory.MEASUREMENT) {
continue;
}
@@ -160,9 +160,7 @@ public class MemUtils {
return memSize;
}
- /**
- * Calculate how much memory will be used if the given record is written to
sequence file.
- */
+ /** Calculate how much memory will be used if the given record is written to
sequence file. */
public static long getTsRecordMem(TSRecord tsRecord) {
long memUsed = 8; // time
memUsed += 8; // deviceId reference
@@ -174,17 +172,13 @@ public class MemUtils {
return memUsed;
}
- /**
- * Function for getting the memory size of the given string.
- */
+ /** Function for getting the memory size of the given string. */
public static long getStringMem(String str) {
// wide char (2 bytes each) and 64B String overhead
return str.length() * 2L + 64L;
}
- /**
- * Function for getting the memory size of the given data point.
- */
+ /** Function for getting the memory size of the given data point. */
public static long getDataPointMem(DataPoint dataPoint) {
// type reference
long memUsed = 8;
@@ -216,9 +210,7 @@ public class MemUtils {
return memUsed;
}
- /**
- * Function for converting the byte count result to readable string.
- */
+ /** Function for converting the byte count result to readable string. */
public static String bytesCntToStr(long inputCnt) {
long cnt = inputCnt;
long gbs = cnt / IoTDBConstant.GB;
diff --git
a/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/queryengine/plan/relational/analyzer/AnalyzerTest.java
b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/queryengine/plan/relational/analyzer/AnalyzerTest.java
index 55e6bbbc251..7a1c7e865e2 100644
---
a/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/queryengine/plan/relational/analyzer/AnalyzerTest.java
+++
b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/queryengine/plan/relational/analyzer/AnalyzerTest.java
@@ -37,9 +37,9 @@ import
org.apache.iotdb.db.queryengine.execution.warnings.WarningCollector;
import org.apache.iotdb.db.queryengine.plan.planner.plan.DistributedQueryPlan;
import org.apache.iotdb.db.queryengine.plan.planner.plan.LogicalQueryPlan;
import org.apache.iotdb.db.queryengine.plan.planner.plan.node.PlanNode;
+import
org.apache.iotdb.db.queryengine.plan.planner.plan.node.process.ExchangeNode;
import
org.apache.iotdb.db.queryengine.plan.planner.plan.node.write.RelationalInsertRowNode;
import
org.apache.iotdb.db.queryengine.plan.planner.plan.node.write.RelationalInsertTabletNode;
-import
org.apache.iotdb.db.queryengine.plan.planner.plan.node.process.ExchangeNode;
import org.apache.iotdb.db.queryengine.plan.relational.function.OperatorType;
import org.apache.iotdb.db.queryengine.plan.relational.metadata.ColumnHandle;
import org.apache.iotdb.db.queryengine.plan.relational.metadata.ColumnSchema;
@@ -815,7 +815,8 @@ public class AnalyzerTest {
assertEquals(1, schemaValidation.getAttributeValueList().size());
for (int i = 0; i < schemaValidation.getAttributeValueList().size();
i++) {
assertEquals(
- ((Object[]) columns[1])[i], ((Object[])
schemaValidation.getAttributeValueList().get(0))[i]);
+ ((Object[]) columns[1])[i],
+ ((Object[]) schemaValidation.getAttributeValueList().get(0))[i]);
}
}
@@ -839,8 +840,7 @@ public class AnalyzerTest {
assertEquals(StatementTestUtils.tableName(), tableName);
TSeriesPartitionSlot partitionSlot =
- seriesPartitionExecutor.getSeriesPartitionSlot(
- dataPartitionQueryParam.getDeviceID());
+
seriesPartitionExecutor.getSeriesPartitionSlot(dataPartitionQueryParam.getDeviceID());
for (TTimePartitionSlot tTimePartitionSlot :
dataPartitionQueryParam.getTimePartitionSlotList()) {
dataPartitionMap
@@ -849,8 +849,7 @@ public class AnalyzerTest {
.computeIfAbsent(tTimePartitionSlot, slot -> new ArrayList<>())
.add(
new TRegionReplicaSet(
- new TConsensusGroupId(
- TConsensusGroupType.DataRegion,
partitionSlot.slotId),
+ new TConsensusGroupId(TConsensusGroupType.DataRegion,
partitionSlot.slotId),
Collections.singletonList(
new TDataNodeLocation(
partitionSlot.slotId, null, null, null, null,
null))));
@@ -874,8 +873,12 @@ public class AnalyzerTest {
new SqlParser(),
sessionInfo);
assertEquals(1,
actualAnalysis.getDataPartition().getDataPartitionMap().size());
- Map<TSeriesPartitionSlot, Map<TTimePartitionSlot,
List<TRegionReplicaSet>>> partitionSlotMapMap =
actualAnalysis.getDataPartition()
- .getDataPartitionMap().get(sessionInfo.getDatabaseName().orElse(null));
+ Map<TSeriesPartitionSlot, Map<TTimePartitionSlot, List<TRegionReplicaSet>>>
+ partitionSlotMapMap =
+ actualAnalysis
+ .getDataPartition()
+ .getDataPartitionMap()
+ .get(sessionInfo.getDatabaseName().orElse(null));
assertEquals(3, partitionSlotMapMap.size());
logicalQueryPlan =
@@ -915,16 +918,19 @@ public class AnalyzerTest {
new SqlParser(),
sessionInfo);
assertEquals(1,
actualAnalysis.getDataPartition().getDataPartitionMap().size());
- Map<TSeriesPartitionSlot, Map<TTimePartitionSlot,
List<TRegionReplicaSet>>> partitionSlotMapMap =
actualAnalysis.getDataPartition()
- .getDataPartitionMap().get(sessionInfo.getDatabaseName().orElse(null));
+ Map<TSeriesPartitionSlot, Map<TTimePartitionSlot, List<TRegionReplicaSet>>>
+ partitionSlotMapMap =
+ actualAnalysis
+ .getDataPartition()
+ .getDataPartitionMap()
+ .get(sessionInfo.getDatabaseName().orElse(null));
assertEquals(1, partitionSlotMapMap.size());
logicalQueryPlan =
new LogicalPlanner(context, mockMetadata, sessionInfo,
WarningCollector.NOOP)
.plan(actualAnalysis);
- RelationalInsertRowNode insertNode =
- (RelationalInsertRowNode) logicalQueryPlan.getRootNode();
+ RelationalInsertRowNode insertNode = (RelationalInsertRowNode)
logicalQueryPlan.getRootNode();
assertEquals(insertNode.getTableName(), StatementTestUtils.tableName());
Object[] columns = StatementTestUtils.genValues(0);
diff --git
a/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/queryengine/plan/statement/StatementTestUtils.java
b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/queryengine/plan/statement/StatementTestUtils.java
index de63b0baf24..84dbc369406 100644
---
a/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/queryengine/plan/statement/StatementTestUtils.java
+++
b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/queryengine/plan/statement/StatementTestUtils.java
@@ -44,7 +44,8 @@ import java.util.List;
public class StatementTestUtils {
- public static final String TEST_PARTITION_EXECUTOR =
"org.apache.iotdb.commons.partition.executor.hash.BKDRHashExecutor";
+ public static final String TEST_PARTITION_EXECUTOR =
+ "org.apache.iotdb.commons.partition.executor.hash.BKDRHashExecutor";
public static final int TEST_SERIES_SLOT_NUM = 1000;
private StatementTestUtils() {
@@ -128,8 +129,7 @@ public class StatementTestUtils {
return timestamps;
}
- public static InsertRowStatement genInsertRowStatement(
- boolean writeToTable, int offset) {
+ public static InsertRowStatement genInsertRowStatement(boolean writeToTable,
int offset) {
String[] measurements = genColumnNames();
TSDataType[] dataTypes = genDataTypes();
TsTableColumnCategory[] columnCategories = genColumnCategories();
@@ -214,7 +214,6 @@ public class StatementTestUtils {
columnCategories);
}
-
public static InsertTabletStatement genInsertTabletStatement(boolean
writeToTable) {
return genInsertTabletStatement(writeToTable, 3, 0);
}
diff --git
a/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/storageengine/dataregion/DataRegionTest.java
b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/storageengine/dataregion/DataRegionTest.java
index eea61bb5dac..3cd38521316 100644
---
a/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/storageengine/dataregion/DataRegionTest.java
+++
b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/storageengine/dataregion/DataRegionTest.java
@@ -91,7 +91,6 @@ import java.util.Collections;
import java.util.List;
import static
org.apache.iotdb.db.queryengine.plan.statement.StatementTestUtils.genInsertRowNode;
-import static
org.apache.iotdb.db.queryengine.plan.statement.StatementTestUtils.genInsertRowStatement;
import static
org.apache.iotdb.db.queryengine.plan.statement.StatementTestUtils.genInsertTabletNode;
public class DataRegionTest {
@@ -314,7 +313,7 @@ public class DataRegionTest {
@Test
public void testRelationRowWriteAndSyncClose()
throws QueryProcessException, WriteProcessException {
- RelationalInsertRowNode insertNode1 = genInsertRowNode( 0);
+ RelationalInsertRowNode insertNode1 = genInsertRowNode(0);
dataRegion.insert(insertNode1);
dataRegion.asyncCloseAllWorkingTsFileProcessors();
diff --git
a/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/utils/MemUtilsTest.java
b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/utils/MemUtilsTest.java
index 450e39e5851..9ea1b03b58b 100644
---
a/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/utils/MemUtilsTest.java
+++
b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/utils/MemUtilsTest.java
@@ -87,8 +87,7 @@ public class MemUtilsTest {
dataTypes.add(TSDataType.TEXT);
// time and index size
sizeSum += 8 + 4;
- Assert.assertEquals(sizeSum, MemUtils.getAlignedRowRecordSize(dataTypes,
row,
- null));
+ Assert.assertEquals(sizeSum, MemUtils.getAlignedRowRecordSize(dataTypes,
row, null));
}
@Test
diff --git
a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/partition/DataPartition.java
b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/partition/DataPartition.java
index b13932da63d..7105e92775e 100644
---
a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/partition/DataPartition.java
+++
b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/partition/DataPartition.java
@@ -21,7 +21,6 @@ package org.apache.iotdb.commons.partition;
import org.apache.iotdb.common.rpc.thrift.TRegionReplicaSet;
import org.apache.iotdb.common.rpc.thrift.TSeriesPartitionSlot;
import org.apache.iotdb.common.rpc.thrift.TTimePartitionSlot;
-import org.apache.iotdb.commons.utils.CommonDateTimeUtils;
import org.apache.iotdb.commons.utils.PathUtils;
import org.apache.iotdb.commons.utils.TimePartitionUtils;
@@ -67,7 +66,7 @@ public class DataPartition extends Partition {
}
public Map<String, Map<TSeriesPartitionSlot, Map<TTimePartitionSlot,
List<TRegionReplicaSet>>>>
- getDataPartitionMap() {
+ getDataPartitionMap() {
return dataPartitionMap;
}
@@ -235,8 +234,8 @@ public class DataPartition extends Partition {
public TRegionReplicaSet getDataRegionReplicaSetForWriting(
IDeviceID deviceID, TTimePartitionSlot timePartitionSlot) {
- return getDataRegionReplicaSetForWriting(deviceID, timePartitionSlot,
- getDatabaseNameByDevice(deviceID));
+ return getDataRegionReplicaSetForWriting(
+ deviceID, timePartitionSlot, getDatabaseNameByDevice(deviceID));
}
private String getDatabaseNameByDevice(IDeviceID deviceID) {
@@ -273,7 +272,7 @@ public class DataPartition extends Partition {
requireNonNull(this.dataPartitionMap, "dataPartitionMap is null");
for (Map.Entry<
- String, Map<TSeriesPartitionSlot, Map<TTimePartitionSlot,
List<TRegionReplicaSet>>>>
+ String, Map<TSeriesPartitionSlot, Map<TTimePartitionSlot,
List<TRegionReplicaSet>>>>
dbEntry : targetDataPartition.getDataPartitionMap().entrySet()) {
String database = dbEntry.getKey();
if (dataPartitionMap.containsKey(database)) {