luoluoyuyu commented on code in PR #16722:
URL: https://github.com/apache/iotdb/pull/16722#discussion_r2516448640


##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/load/active/ActiveLoadTsFileLoader.java:
##########
@@ -216,24 +217,29 @@ private Optional<ActiveLoadPendingQueue.ActiveLoadEntry> 
tryGetNextPendingFile()
   private TSStatus loadTsFile(
       final ActiveLoadPendingQueue.ActiveLoadEntry entry, final IClientSession 
session)
       throws FileNotFoundException {
-    final LoadTsFileStatement statement = new 
LoadTsFileStatement(entry.getFile());
+    final File tsFile = new File(entry.getFile());
+    final LoadTsFileStatement statement = new 
LoadTsFileStatement(tsFile.getAbsolutePath());
     final List<File> files = statement.getTsFiles();
 
-    // It should be noted here that the instructions in this code block do not 
need to use the
-    // DataBase, so the DataBase is assigned a value of null. If the DataBase 
is used later, an
-    // exception will be thrown.
-    final File parentFile;
-    statement.setDatabase(
-        files.isEmpty()
-                || !entry.isTableModel()
-                || (parentFile = files.get(0).getParentFile()) == null
-            ? null
-            : parentFile.getName());
     statement.setDeleteAfterLoad(true);
-    statement.setConvertOnTypeMismatch(true);
-    statement.setVerifySchema(isVerify);
     statement.setAutoCreateDatabase(
         IoTDBDescriptor.getInstance().getConfig().isAutoCreateSchemaEnabled());
+
+    final File pendingDir =
+        entry.getPendingDir() == null
+            ? ActiveLoadPathHelper.findPendingDirectory(tsFile)
+            : new File(entry.getPendingDir());
+    final Map<String, String> attributes = 
ActiveLoadPathHelper.parseAttributes(tsFile, pendingDir);
+    ActiveLoadPathHelper.applyAttributesToStatement(attributes, statement, 
isVerify);
+
+    final File parentFile;
+    if (statement.getDatabase() == null && entry.isTableModel()) {
+      statement.setDatabase(
+          files.isEmpty() || (parentFile = files.get(0).getParentFile()) == 
null

Review Comment:
   This is the old function definition; see 
https://iotdb.apache.org/UserGuide/latest-Table/Tools-System/Data-Import-Tool.html#_3-tsfile-auto-loadingfor
 details.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to