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 73871498918 temp save
73871498918 is described below

commit 738714989181170599f291b8911952a88552a788
Author: Tian Jiang <[email protected]>
AuthorDate: Mon Jul 15 09:56:47 2024 +0800

    temp save
---
 .../iotdb/session/it/IoTDBSessionRelationalIT.java  |  7 ++++---
 .../schema/source/TableDeviceQuerySource.java       |  3 +++
 .../fetcher/TableHeaderSchemaValidator.java         |  1 -
 .../plan/relational/planner/LogicalPlanner.java     |  2 ++
 .../distribute/DistributedPlanGenerator.java        |  5 ++---
 .../schemaregion/impl/SchemaRegionMemoryImpl.java   |  2 ++
 .../mtree/impl/mem/MTreeBelowSGMemoryImpl.java      | 21 +++++++++++----------
 7 files changed, 24 insertions(+), 17 deletions(-)

diff --git 
a/integration-test/src/test/java/org/apache/iotdb/session/it/IoTDBSessionRelationalIT.java
 
b/integration-test/src/test/java/org/apache/iotdb/session/it/IoTDBSessionRelationalIT.java
index e6ad59da345..84d5211f024 100644
--- 
a/integration-test/src/test/java/org/apache/iotdb/session/it/IoTDBSessionRelationalIT.java
+++ 
b/integration-test/src/test/java/org/apache/iotdb/session/it/IoTDBSessionRelationalIT.java
@@ -94,7 +94,7 @@ public class IoTDBSessionRelationalIT {
       final List<ColumnType> columnTypes =
           Arrays.asList(ColumnType.ID, ColumnType.ATTRIBUTE, 
ColumnType.MEASUREMENT);
 
-      Tablet tablet = new Tablet("table1", schemaList, columnTypes, 10);
+      Tablet tablet = new Tablet("table1", schemaList, columnTypes, 15);
 
       long timestamp = System.currentTimeMillis();
 
@@ -116,10 +116,11 @@ public class IoTDBSessionRelationalIT {
         tablet.reset();
       }
 
-      SessionDataSet dataSet = session.executeQueryStatement("select count(*) 
from table1");
+      SessionDataSet dataSet = session.executeQueryStatement("select * from 
table1");
       while (dataSet.hasNext()) {
         RowRecord rowRecord = dataSet.next();
         assertEquals(15L, rowRecord.getFields().get(0).getLongV());
+        System.out.println(rowRecord);
       }
     }
   }
@@ -164,7 +165,7 @@ public class IoTDBSessionRelationalIT {
         tablet.reset();
       }
 
-      SessionDataSet dataSet = session.executeQueryStatement("select count(*) 
from table1");
+      SessionDataSet dataSet = session.executeQueryStatement("select * from 
table1");
       while (dataSet.hasNext()) {
         RowRecord rowRecord = dataSet.next();
         assertEquals(15L, rowRecord.getFields().get(0).getLongV());
diff --git 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/operator/schema/source/TableDeviceQuerySource.java
 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/operator/schema/source/TableDeviceQuerySource.java
index 8dc1ce33ed8..b745115d06b 100644
--- 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/operator/schema/source/TableDeviceQuerySource.java
+++ 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/operator/schema/source/TableDeviceQuerySource.java
@@ -181,6 +181,9 @@ public class TableDeviceQuerySource implements 
ISchemaSource<IDeviceSchemaInfo>
   }
 
   private SchemaFilter getExecutableIdFuzzyFilter(Expression 
idFuzzyExpression) {
+    if (idFuzzyExpression == null) {
+      return null;
+    }
     ConvertSchemaPredicateToFilterVisitor visitor = new 
ConvertSchemaPredicateToFilterVisitor();
     return visitor.process(
         idFuzzyExpression, new 
ConvertSchemaPredicateToFilterVisitor.Context(table));
diff --git 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/metadata/fetcher/TableHeaderSchemaValidator.java
 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/metadata/fetcher/TableHeaderSchemaValidator.java
index f0fca77afcc..99069e23e71 100644
--- 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/metadata/fetcher/TableHeaderSchemaValidator.java
+++ 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/metadata/fetcher/TableHeaderSchemaValidator.java
@@ -87,7 +87,6 @@ public class TableHeaderSchemaValidator {
           "Column List in TableSchema should never be null or empty.");
     }
     TsTable table = DataNodeTableCache.getInstance().getTable(database, 
tableSchema.getTableName());
-    LOGGER.info("Get TsTable from cache: {}", table);
     List<ColumnSchema> missingColumnList = new ArrayList<>();
     List<ColumnSchema> resultColumnList = new ArrayList<>();
 
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 5568f27a366..7ef9f35f541 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
@@ -247,6 +247,8 @@ public class LogicalPlanner {
     List<ColumnHeader> columnHeaderList =
         getColumnHeaderList(statement.getDatabase(), statement.getTableName());
 
+    analysis.setRespDatasetHeader(new DatasetHeader(columnHeaderList, true));
+
     TableDeviceQueryNode queryNode =
         new TableDeviceQueryNode(
             context.getQueryId().genPlanNodeId(),
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 adf4d63514c..40166d9413d 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,8 +415,7 @@ public class DistributedPlanGenerator
   @Override
   public List<PlanNode> visitTableDeviceQuery(TableDeviceQueryNode node, 
PlanContext context) {
     String database =
-        PathUtils.qualifyDatabaseName(
-            ((TableDeviceSourceNode) node.getChildren().get(0)).getDatabase());
+        PathUtils.qualifyDatabaseName(node.getDatabase());
     Set<TRegionReplicaSet> schemaRegionSet = new HashSet<>();
     analysis
         .getSchemaPartitionInfo()
@@ -444,7 +443,7 @@ public class DistributedPlanGenerator
   @Override
   public List<PlanNode> visitTableDeviceFetch(TableDeviceFetchNode node, 
PlanContext context) {
     String database =
-        ROOT + "." + ((TableDeviceSourceNode) 
node.getChildren().get(0)).getDatabase();
+        PathUtils.qualifyDatabaseName(node.getDatabase());
     Set<TRegionReplicaSet> schemaRegionSet = new HashSet<>();
     SchemaPartition schemaPartition = analysis.getSchemaPartitionInfo();
     Map<TSeriesPartitionSlot, TRegionReplicaSet> databaseMap =
diff --git 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/impl/SchemaRegionMemoryImpl.java
 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/impl/SchemaRegionMemoryImpl.java
index f7d38484cc5..b26c316a63a 100644
--- 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/impl/SchemaRegionMemoryImpl.java
+++ 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/impl/SchemaRegionMemoryImpl.java
@@ -19,6 +19,7 @@
 
 package org.apache.iotdb.db.schemaengine.schemaregion.impl;
 
+import java.util.Arrays;
 import org.apache.iotdb.commons.consensus.SchemaRegionId;
 import org.apache.iotdb.commons.exception.IllegalPathException;
 import org.apache.iotdb.commons.exception.MetadataException;
@@ -1304,6 +1305,7 @@ public class SchemaRegionMemoryImpl implements 
ISchemaRegion {
           pointer ->
               deviceAttributeStore.alterAttribute(
                   pointer, attributeNameList, attributeValueList.get(finalI)));
+      logger.info("Created table device [{}-{}]", tableName, 
Arrays.toString(devicePathList.get(i)));
     }
   }
 
diff --git 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/impl/mem/MTreeBelowSGMemoryImpl.java
 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/impl/mem/MTreeBelowSGMemoryImpl.java
index 22fc44c4b43..d2b3f5d6f1e 100644
--- 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/impl/mem/MTreeBelowSGMemoryImpl.java
+++ 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/impl/mem/MTreeBelowSGMemoryImpl.java
@@ -99,6 +99,8 @@ import java.util.function.Consumer;
 import java.util.function.Function;
 import java.util.function.IntConsumer;
 import java.util.function.IntSupplier;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 import static org.apache.iotdb.commons.conf.IoTDBConstant.PATH_SEPARATOR;
 
@@ -123,6 +125,8 @@ import static 
org.apache.iotdb.commons.conf.IoTDBConstant.PATH_SEPARATOR;
  */
 public class MTreeBelowSGMemoryImpl {
 
+  private static final Logger LOGGER = 
LoggerFactory.getLogger(MTreeBelowSGMemoryImpl.class);
+
   // this implementation is based on memory, thus only MTree write operation 
must invoke MTreeStore
   private final MemMTreeStore store;
 
@@ -1185,6 +1189,7 @@ public class MTreeBelowSGMemoryImpl {
         while (deviceIdIterator.hasNext()) {
           try {
             IMemMNode node = getTableDeviceNode(table, 
deviceIdIterator.next());
+
             if (!node.isDevice()) {
               continue;
             }
@@ -1223,6 +1228,7 @@ public class MTreeBelowSGMemoryImpl {
     IMemMNode next;
 
     next = cur.getChild(table);
+    LOGGER.info("The node of table {} is {}", table, next);
     if (next == null) {
       throw new PathNotExistException(
           storageGroupMNode.getFullPath() + PATH_SEPARATOR + table + 
Arrays.toString(deviceId),
@@ -1502,19 +1508,14 @@ public class MTreeBelowSGMemoryImpl {
       IntConsumer attributeUppdater)
       throws MetadataException {
     // todo implement storage for device of diverse data types
-    IMemMNode cur = storageGroupMNode;
-    IMemMNode child = cur.getChild(tableName);
-    if (child == null) {
-      child = store.addChild(cur, tableName, 
nodeFactory.createInternalMNode(cur, tableName));
-    }
-    cur = child;
 
-    String nodeName;
+
+    IMemMNode cur = storageGroupMNode;
     for (Object o : devicePath) {
-      nodeName = o == null ? null : (String) o;
-      child = cur.getChild(nodeName);
+      String childName = o.toString();
+      IMemMNode child = cur.getChild(childName);
       if (child == null) {
-        child = store.addChild(cur, nodeName, 
nodeFactory.createInternalMNode(cur, nodeName));
+        child = store.addChild(cur, childName, 
nodeFactory.createInternalMNode(cur, childName));
       }
       cur = child;
     }

Reply via email to