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

justinchen pushed a commit to branch UserDefineTime-TsFile
in repository https://gitbox.apache.org/repos/asf/iotdb.git

commit d6942af70fcbe080ebdb85a2cd5feb05b83758bc
Author: Caideyipi <[email protected]>
AuthorDate: Mon Jan 26 18:49:56 2026 +0800

    fix
---
 .../fetcher/TableHeaderSchemaValidator.java        | 24 +++++++++++++++++++++-
 1 file changed, 23 insertions(+), 1 deletion(-)

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 14a5e1cb06d..432670a8c33 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
@@ -60,6 +60,7 @@ import org.apache.tsfile.read.common.type.TypeFactory;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import javax.annotation.Nonnull;
 import javax.annotation.Nullable;
 
 import java.util.ArrayList;
@@ -101,7 +102,7 @@ public class TableHeaderSchemaValidator {
       final MPPQueryContext context,
       final boolean allowCreateTable,
       final boolean isStrictTagColumn,
-      final AtomicBoolean needDecode4DifferentTimeColumn)
+      final @Nonnull AtomicBoolean needDecode4DifferentTimeColumn)
       throws LoadAnalyzeTableColumnDisorderException {
     // The schema cache R/W and fetch operation must be locked together thus 
the cache clean
     // operation executed by delete timeSeries will be effective.
@@ -175,6 +176,27 @@ public class TableHeaderSchemaValidator {
           }
         }
       }
+      long realTimeIndex = 0;
+      for (final TsTableColumnSchema schema : table.getColumnList()) {
+        if (schema.getColumnCategory() == TsTableColumnCategory.TIME) {
+          break;
+        }
+        if (schema.getColumnCategory() != TsTableColumnCategory.ATTRIBUTE) {
+          ++realTimeIndex;
+        }
+      }
+      long inputTimeIndex = 0;
+      for (final ColumnSchema schema : tableSchema.getColumns()) {
+        if (schema.getColumnCategory() == TsTableColumnCategory.TIME) {
+          break;
+        }
+        if (schema.getColumnCategory() != TsTableColumnCategory.ATTRIBUTE) {
+          ++inputTimeIndex;
+        }
+      }
+      if (inputTimeIndex != realTimeIndex) {
+        needDecode4DifferentTimeColumn.set(true);
+      }
     }
 
     boolean refreshed = false;

Reply via email to