This is an automated email from the ASF dual-hosted git repository.
rong pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/iotdb.git
The following commit(s) were added to refs/heads/master by this push:
new b3f2a965036 Pipe: Fix the problem that the table model ChunkData is
not registered with TableSchema (#13896)
b3f2a965036 is described below
commit b3f2a965036b13f57401c7c8523b72b2064c6126
Author: Zhenyu Luo <[email protected]>
AuthorDate: Fri Oct 25 17:34:15 2024 +0800
Pipe: Fix the problem that the table model ChunkData is not registered with
TableSchema (#13896)
---
.../db/storageengine/load/LoadTsFileManager.java | 23 +++++++++++++++++++++-
1 file changed, 22 insertions(+), 1 deletion(-)
diff --git
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/load/LoadTsFileManager.java
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/load/LoadTsFileManager.java
index 775dad1df46..fb2a94de916 100644
---
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/load/LoadTsFileManager.java
+++
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/load/LoadTsFileManager.java
@@ -36,7 +36,9 @@ import
org.apache.iotdb.db.exception.DiskSpaceInsufficientException;
import org.apache.iotdb.db.exception.LoadFileException;
import org.apache.iotdb.db.pipe.agent.PipeDataNodeAgent;
import
org.apache.iotdb.db.queryengine.plan.planner.plan.node.load.LoadTsFilePieceNode;
+import org.apache.iotdb.db.queryengine.plan.relational.metadata.TableSchema;
import
org.apache.iotdb.db.queryengine.plan.scheduler.load.LoadTsFileScheduler.LoadCommand;
+import org.apache.iotdb.db.schemaengine.table.DataNodeTableCache;
import org.apache.iotdb.db.storageengine.dataregion.DataRegion;
import org.apache.iotdb.db.storageengine.dataregion.flush.MemTableFlushTask;
import
org.apache.iotdb.db.storageengine.dataregion.modification.ModificationFile;
@@ -71,6 +73,9 @@ import java.util.concurrent.PriorityBlockingQueue;
import java.util.concurrent.atomic.AtomicReference;
import java.util.stream.Stream;
+import static org.apache.iotdb.db.utils.constant.SqlConstant.ROOT;
+import static org.apache.iotdb.db.utils.constant.SqlConstant.ROOT_DOT;
+
/**
* {@link LoadTsFileManager} is used for dealing with {@link
LoadTsFilePieceNode} and {@link
* LoadCommand}. This class turn the content of a piece of loading TsFile into
a new TsFile. When
@@ -404,10 +409,26 @@ public class LoadTsFileManager {
}
final TsFileIOWriter writer = new TsFileIOWriter(newTsFile);
- writer.setGenerateTableSchema(true);
dataPartition2Writer.put(partitionInfo, writer);
}
TsFileIOWriter writer = dataPartition2Writer.get(partitionInfo);
+
+ // Table model needs to register TableSchema
+ final String tableName =
+ chunkData.getDevice() != null ? chunkData.getDevice().getTableName()
: null;
+ if (tableName != null && !(tableName.startsWith(ROOT_DOT) ||
tableName.equals(ROOT))) {
+ writer
+ .getSchema()
+ .getTableSchemaMap()
+ .computeIfAbsent(
+ tableName,
+ t ->
+ TableSchema.of(
+ DataNodeTableCache.getInstance()
+
.getTable(partitionInfo.getDataRegion().getDatabaseName(), t))
+ .toTsFileTableSchemaNoAttribute());
+ }
+
if (!Objects.equals(chunkData.getDevice(),
dataPartition2LastDevice.get(partitionInfo))) {
if (dataPartition2LastDevice.containsKey(partitionInfo)) {
writer.endChunkGroup();