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

haonan pushed a commit to branch rel/1.0
in repository https://gitbox.apache.org/repos/asf/iotdb.git


The following commit(s) were added to refs/heads/rel/1.0 by this push:
     new 64f94bff47 [IOTDB-5412][To rel/1.0]Print Help Message when loading 
empty tsfile (#8875)
64f94bff47 is described below

commit 64f94bff47c5676a22de9936d8f2422bc5643bca
Author: yschengzi <[email protected]>
AuthorDate: Fri Jan 13 17:17:25 2023 +0800

    [IOTDB-5412][To rel/1.0]Print Help Message when loading empty tsfile (#8875)
---
 .../apache/iotdb/db/mpp/plan/analyze/AnalyzeVisitor.java   | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git 
a/server/src/main/java/org/apache/iotdb/db/mpp/plan/analyze/AnalyzeVisitor.java 
b/server/src/main/java/org/apache/iotdb/db/mpp/plan/analyze/AnalyzeVisitor.java
index e060e05a5f..637dfe73e2 100644
--- 
a/server/src/main/java/org/apache/iotdb/db/mpp/plan/analyze/AnalyzeVisitor.java
+++ 
b/server/src/main/java/org/apache/iotdb/db/mpp/plan/analyze/AnalyzeVisitor.java
@@ -1748,6 +1748,13 @@ public class AnalyzeVisitor extends 
StatementVisitor<Analysis, MPPQueryContext>
 
     // analyze tsfile metadata
     for (File tsFile : loadTsFileStatement.getTsFiles()) {
+      if (tsFile.length() == 0) {
+        logger.warn(String.format("TsFile %s is empty.", tsFile.getPath()));
+        throw new SemanticException(
+            String.format(
+                "TsFile %s is empty, please check it be flushed to disk 
correctly.",
+                tsFile.getPath()));
+      }
       try {
         TsFileResource resource =
             analyzeTsFile(
@@ -1758,6 +1765,13 @@ public class AnalyzeVisitor extends 
StatementVisitor<Analysis, MPPQueryContext>
                 device2Schemas,
                 device2IsAligned);
         loadTsFileStatement.addTsFileResource(resource);
+      } catch (IllegalArgumentException e) {
+        logger.warn(
+            String.format(
+                "Parse file %s to resource error, this TsFile maybe empty.", 
tsFile.getPath()),
+            e);
+        throw new SemanticException(
+            String.format("TsFile %s is empty or incomplete.", 
tsFile.getPath()));
       } catch (Exception e) {
         logger.warn(String.format("Parse file %s to resource error.", 
tsFile.getPath()), e);
         throw new SemanticException(

Reply via email to