This is an automated email from the ASF dual-hosted git repository.

shuwenwei pushed a commit to branch addColumnForTableDiskUsageTable
in repository https://gitbox.apache.org/repos/asf/iotdb.git

commit 484c8213cd97ddb236a68da7b6bc3a80ede84961
Author: shuwenwei <[email protected]>
AuthorDate: Tue May 26 12:15:53 2026 +0800

    Add table type to table disk usage
---
 .../relational/it/IoTDBShowDiskUsageTableIT.java   |  1 +
 .../relational/it/schema/IoTDBDatabaseIT.java      |  1 +
 .../InformationSchemaContentSupplierFactory.java   | 29 ++++++++++++++++------
 .../commons/schema/table/InformationSchema.java    |  3 +++
 4 files changed, 26 insertions(+), 8 deletions(-)

diff --git 
a/integration-test/src/test/java/org/apache/iotdb/relational/it/IoTDBShowDiskUsageTableIT.java
 
b/integration-test/src/test/java/org/apache/iotdb/relational/it/IoTDBShowDiskUsageTableIT.java
index 76ac3ccc758..f9bb0cfc90b 100644
--- 
a/integration-test/src/test/java/org/apache/iotdb/relational/it/IoTDBShowDiskUsageTableIT.java
+++ 
b/integration-test/src/test/java/org/apache/iotdb/relational/it/IoTDBShowDiskUsageTableIT.java
@@ -80,6 +80,7 @@ public class IoTDBShowDiskUsageTableIT {
       Map<String, Long> tableSizes = new HashMap<>();
       while (iterator.next()) {
         String table = iterator.getString("table_name");
+        Assert.assertEquals("BASE TABLE", iterator.getString("table_type"));
         long timePartition = iterator.getLong("time_partition");
         long size = iterator.getLong("size_in_bytes");
         timePartitionSizes.compute(timePartition, (k, v) -> v == null ? size : 
v + size);
diff --git 
a/integration-test/src/test/java/org/apache/iotdb/relational/it/schema/IoTDBDatabaseIT.java
 
b/integration-test/src/test/java/org/apache/iotdb/relational/it/schema/IoTDBDatabaseIT.java
index 2b367b70b22..46d27d997e9 100644
--- 
a/integration-test/src/test/java/org/apache/iotdb/relational/it/schema/IoTDBDatabaseIT.java
+++ 
b/integration-test/src/test/java/org/apache/iotdb/relational/it/schema/IoTDBDatabaseIT.java
@@ -578,6 +578,7 @@ public class IoTDBDatabaseIT {
               Arrays.asList(
                   "database,STRING,FIELD,",
                   "table_name,STRING,FIELD,",
+                  "table_type,STRING,FIELD,",
                   "datanode_id,INT32,FIELD,",
                   "region_id,INT32,FIELD,",
                   "time_partition,INT64,FIELD,",
diff --git 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/operator/source/relational/InformationSchemaContentSupplierFactory.java
 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/operator/source/relational/InformationSchemaContentSupplierFactory.java
index 0dbd86d600c..910c5afb5ab 100644
--- 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/operator/source/relational/InformationSchemaContentSupplierFactory.java
+++ 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/operator/source/relational/InformationSchemaContentSupplierFactory.java
@@ -1271,6 +1271,7 @@ public class InformationSchemaContentSupplierFactory {
     private final Filter pushDownFilter;
     private final PaginationController paginationController;
     private final OperatorContext operatorContext;
+    private final Map<String, String> currentTableTypeMap = new HashMap<>();
 
     private DataRegion currentDataRegion;
     private boolean currentDatabaseOnlyHasOneTable;
@@ -1347,6 +1348,7 @@ public class InformationSchemaContentSupplierFactory {
       try {
         while (dataRegionIterator.nextDataRegion()) {
           currentDataRegion = dataRegionIterator.currentDataRegion();
+          currentTableTypeMap.clear();
           for (Long timePartition : 
currentDataRegion.getTsFileManager().getTimePartitions()) {
             Map<String, Long> tablesToScan = 
getTablesToScan(currentDataRegion, timePartition);
             if (!tablesToScan.isEmpty()) {
@@ -1420,12 +1422,13 @@ public class InformationSchemaContentSupplierFactory {
         }
         totalValidTableCount++;
         if (pushDownFilter != null) {
-          Object[] row = new Object[5];
+          Object[] row = new Object[6];
           row[0] = new Binary(dataRegion.getDatabaseName(), 
TSFileConfig.STRING_CHARSET);
           row[1] = new Binary(tTableInfo.getTableName(), 
TSFileConfig.STRING_CHARSET);
-          row[2] = IoTDBDescriptor.getInstance().getConfig().getDataNodeId();
-          row[3] = dataRegion.getDataRegionId();
-          row[4] = timePartition;
+          row[2] = new Binary(getTableTypeName(tTableInfo), 
TSFileConfig.STRING_CHARSET);
+          row[3] = IoTDBDescriptor.getInstance().getConfig().getDataNodeId();
+          row[4] = dataRegion.getDataRegionId();
+          row[5] = timePartition;
           if (!pushDownFilter.satisfyRow(0, row)) {
             continue;
           }
@@ -1439,11 +1442,19 @@ public class InformationSchemaContentSupplierFactory {
         }
         paginationController.consumeLimit();
         tablesToScan.put(tTableInfo.getTableName(), 0L);
+        currentTableTypeMap.put(tTableInfo.getTableName(), 
getTableTypeName(tTableInfo));
       }
       currentDatabaseOnlyHasOneTable = totalValidTableCount == 1;
       return tablesToScan;
     }
 
+    private String getTableTypeName(final TTableInfo tableInfo) {
+      if (tableInfo.isSetType()) {
+        return TableType.values()[tableInfo.getType()].getName();
+      }
+      return TableType.BASE_TABLE.getName();
+    }
+
     @Override
     public TsBlock next() {
       if (!hasNext()) {
@@ -1531,10 +1542,12 @@ public class InformationSchemaContentSupplierFactory {
           columns[0].writeBinary(
               new Binary(currentDataRegion.getDatabaseName(), 
TSFileConfig.STRING_CHARSET));
           columns[1].writeBinary(new Binary(tableName, 
TSFileConfig.STRING_CHARSET));
-          
columns[2].writeInt(IoTDBDescriptor.getInstance().getConfig().getDataNodeId());
-          columns[3].writeInt(currentDataRegion.getDataRegionId());
-          columns[4].writeLong(timePartition);
-          columns[5].writeLong(size);
+          columns[2].writeBinary(
+              new Binary(currentTableTypeMap.get(tableName), 
TSFileConfig.STRING_CHARSET));
+          
columns[3].writeInt(IoTDBDescriptor.getInstance().getConfig().getDataNodeId());
+          columns[4].writeInt(currentDataRegion.getDataRegionId());
+          columns[5].writeLong(timePartition);
+          columns[6].writeLong(size);
           builder.declarePosition();
         }
       }
diff --git 
a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/table/InformationSchema.java
 
b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/table/InformationSchema.java
index 75b71efc75d..c4001ecbb1e 100644
--- 
a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/table/InformationSchema.java
+++ 
b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/table/InformationSchema.java
@@ -356,6 +356,8 @@ public class InformationSchema {
             ColumnHeaderConstant.DATABASE.toLowerCase(Locale.ENGLISH), 
TSDataType.STRING));
     tableDiskUsageTable.addColumnSchema(
         new FieldColumnSchema(ColumnHeaderConstant.TABLE_NAME_TABLE_MODEL, 
TSDataType.STRING));
+    tableDiskUsageTable.addColumnSchema(
+        new FieldColumnSchema(ColumnHeaderConstant.TABLE_TYPE_TABLE_MODEL, 
TSDataType.STRING));
     tableDiskUsageTable.addColumnSchema(
         new FieldColumnSchema(ColumnHeaderConstant.DATA_NODE_ID_TABLE_MODEL, 
TSDataType.INT32));
     tableDiskUsageTable.addColumnSchema(
@@ -430,6 +432,7 @@ public class InformationSchema {
         ImmutableSet.of(
             ColumnHeaderConstant.DATABASE.toLowerCase(),
             ColumnHeaderConstant.TABLE_NAME_TABLE_MODEL,
+            ColumnHeaderConstant.TABLE_TYPE_TABLE_MODEL,
             ColumnHeaderConstant.DATA_NODE_ID_TABLE_MODEL,
             ColumnHeaderConstant.REGION_ID_TABLE_MODEL,
             ColumnHeaderConstant.TIME_PARTITION_TABLE_MODEL));

Reply via email to