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

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


The following commit(s) were added to refs/heads/object_type by this push:
     new adfbd4aeffa debug
adfbd4aeffa is described below

commit adfbd4aeffaf3a26b113a301cc0a9726aa20b987
Author: HTHou <[email protected]>
AuthorDate: Thu Jul 3 17:30:02 2025 +0800

    debug
---
 .../resource/memory/InsertNodeMemoryEstimator.java |  1 +
 .../plan/planner/plan/node/write/FileNode.java     | 18 +++++++
 .../plan/relational/planner/RelationPlanner.java   |  4 +-
 .../memtable/AlignedReadOnlyMemChunk.java          |  1 +
 .../memtable/AlignedWritableMemChunk.java          |  1 +
 .../dataregion/memtable/TsFileProcessor.java       | 10 ++--
 .../dataregion/memtable/WritableMemChunk.java      |  1 +
 .../rescon/memory/PrimitiveArrayManager.java       |  1 +
 .../org/apache/iotdb/db/utils/ObjectWriter.java    | 55 ++++++++++++++++++++++
 .../apache/iotdb/db/utils/QueryDataSetUtils.java   |  1 +
 .../db/utils/datastructure/AlignedTVList.java      | 12 +++++
 11 files changed, 100 insertions(+), 5 deletions(-)

diff --git 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/resource/memory/InsertNodeMemoryEstimator.java
 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/resource/memory/InsertNodeMemoryEstimator.java
index ed34f0de310..38e8fac057f 100644
--- 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/resource/memory/InsertNodeMemoryEstimator.java
+++ 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/resource/memory/InsertNodeMemoryEstimator.java
@@ -630,6 +630,7 @@ public class InsertNodeMemoryEstimator {
         case STRING:
         case TEXT:
         case BLOB:
+        case OBJECT:
           {
             size += getBinarySize((Binary[]) columns[i]);
             break;
diff --git 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/plan/node/write/FileNode.java
 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/plan/node/write/FileNode.java
index 55b756a4d3f..e57d0d7b222 100644
--- 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/plan/node/write/FileNode.java
+++ 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/plan/node/write/FileNode.java
@@ -19,6 +19,8 @@
 
 package org.apache.iotdb.db.queryengine.plan.planner.plan.node.write;
 
+// TODO:[OBJECT] WAL serde
+// TODO:[OBJECT] dispatch serde
 public class FileNode {
 
   private String filePath;
@@ -35,4 +37,20 @@ public class FileNode {
     this.offset = offset;
     this.content = content;
   }
+
+  public String getFilePath() {
+    return filePath;
+  }
+
+  public boolean isEOF() {
+    return isEOF;
+  }
+
+  public byte[] getContent() {
+    return content;
+  }
+
+  public long getOffset() {
+    return offset;
+  }
 }
diff --git 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/planner/RelationPlanner.java
 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/planner/RelationPlanner.java
index 1e7ebdebcf5..3274de4c9ac 100644
--- 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/planner/RelationPlanner.java
+++ 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/planner/RelationPlanner.java
@@ -1141,8 +1141,8 @@ public class RelationPlanner extends 
AstVisitor<RelationPlan, Void> {
           long offset = BytesUtils.bytesToLong(offsetBytes);
           byte[] content = new byte[value.getLength() - 9];
           System.arraycopy(value.getValues(), 9, content, 0, value.getLength() 
- 9);
-          // Generate File name
-          String fileName = "assssd";
+          // TODO:[OBJECT] Generate File name
+          String fileName = "/Users/ht/Documents/iotdb/data/object/file1";
           FileNode fileNode = new FileNode(fileName, isEoF, offset, content);
           fileNodeList.add(fileNode);
           if (isEoF) {
diff --git 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/memtable/AlignedReadOnlyMemChunk.java
 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/memtable/AlignedReadOnlyMemChunk.java
index 5ad706df121..47ad6a16e84 100644
--- 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/memtable/AlignedReadOnlyMemChunk.java
+++ 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/memtable/AlignedReadOnlyMemChunk.java
@@ -233,6 +233,7 @@ public class AlignedReadOnlyMemChunk extends 
ReadOnlyMemChunk {
           case TEXT:
           case BLOB:
           case STRING:
+          case OBJECT:
             for (int i = 0; i < tsBlock.getPositionCount(); i++) {
               if (tsBlock.getColumn(column).isNull(i)) {
                 continue;
diff --git 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/memtable/AlignedWritableMemChunk.java
 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/memtable/AlignedWritableMemChunk.java
index d41ef855d36..84f2a7e5d0b 100644
--- 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/memtable/AlignedWritableMemChunk.java
+++ 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/memtable/AlignedWritableMemChunk.java
@@ -592,6 +592,7 @@ public class AlignedWritableMemChunk extends 
AbstractWritableMemChunk {
               case TEXT:
               case STRING:
               case BLOB:
+              case OBJECT:
                 alignedChunkWriter.writeByColumn(
                     time,
                     isNull ? null : list.getBinaryByValueIndex(originRowIndex, 
columnIndex),
diff --git 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/memtable/TsFileProcessor.java
 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/memtable/TsFileProcessor.java
index e34f1b22339..eeddf861b10 100644
--- 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/memtable/TsFileProcessor.java
+++ 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/memtable/TsFileProcessor.java
@@ -77,6 +77,7 @@ import 
org.apache.iotdb.db.storageengine.rescon.memory.PrimitiveArrayManager;
 import org.apache.iotdb.db.storageengine.rescon.memory.SystemInfo;
 import org.apache.iotdb.db.utils.MemUtils;
 import org.apache.iotdb.db.utils.ModificationUtils;
+import org.apache.iotdb.db.utils.ObjectWriter;
 import org.apache.iotdb.db.utils.datastructure.AlignedTVList;
 import org.apache.iotdb.db.utils.datastructure.TVList;
 import org.apache.iotdb.rpc.RpcUtils;
@@ -565,9 +566,12 @@ public class TsFileProcessor {
           ((RelationalInsertTabletNode) insertTabletNode).getFileNodeList();
       if (fileNodeList != null) {
         for (FileNode fileNode : fileNodeList) {
-          System.out.println(fileNode);
-          //          fileNode.writeFile();
-          // TODO write file node wal
+          try (ObjectWriter writer = new ObjectWriter(fileNode.getFilePath())) 
{
+            writer.write(fileNode.getContent());
+          } catch (Exception e) {
+            throw new WriteProcessException(e);
+          }
+          // TODO:[OBJECT] write file node wal
         }
       }
     }
diff --git 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/memtable/WritableMemChunk.java
 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/memtable/WritableMemChunk.java
index 1f4078dfc7d..450dd01d85d 100644
--- 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/memtable/WritableMemChunk.java
+++ 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/memtable/WritableMemChunk.java
@@ -150,6 +150,7 @@ public class WritableMemChunk extends 
AbstractWritableMemChunk {
       case TEXT:
       case BLOB:
       case STRING:
+      case OBJECT:
         Binary[] binaryValues = (Binary[]) valueList;
         putBinaries(times, binaryValues, bitMap, start, end);
         break;
diff --git 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/rescon/memory/PrimitiveArrayManager.java
 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/rescon/memory/PrimitiveArrayManager.java
index e8a2a9bb837..3281b67c034 100644
--- 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/rescon/memory/PrimitiveArrayManager.java
+++ 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/rescon/memory/PrimitiveArrayManager.java
@@ -249,6 +249,7 @@ public class PrimitiveArrayManager {
       case TEXT:
       case STRING:
       case BLOB:
+      case OBJECT:
         dataArray = new Binary[ARRAY_SIZE];
         break;
       default:
diff --git 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/utils/ObjectWriter.java 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/utils/ObjectWriter.java
new file mode 100644
index 00000000000..7d572344ce1
--- /dev/null
+++ 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/utils/ObjectWriter.java
@@ -0,0 +1,55 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.iotdb.db.utils;
+
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+
+public class ObjectWriter implements AutoCloseable {
+
+  private final FileOutputStream fos;
+
+  public ObjectWriter(String filePath) throws FileNotFoundException {
+    // TODO:[OBJECT] Dir creation
+    Path path = Paths.get(filePath);
+    if (!Files.exists(path)) {
+      try {
+        Files.createFile(path);
+      } catch (IOException e) {
+        e.printStackTrace();
+        throw new FileNotFoundException(e.getMessage());
+      }
+    }
+    fos = new FileOutputStream(filePath, true);
+  }
+
+  public void write(byte[] content) throws IOException {
+    fos.write(content);
+  }
+
+  @Override
+  public void close() throws Exception {
+    fos.close();
+  }
+}
diff --git 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/utils/QueryDataSetUtils.java
 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/utils/QueryDataSetUtils.java
index 876a63a197d..8b914d6ab0d 100644
--- 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/utils/QueryDataSetUtils.java
+++ 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/utils/QueryDataSetUtils.java
@@ -796,6 +796,7 @@ public class QueryDataSetUtils {
         case TEXT:
         case BLOB:
         case STRING:
+        case OBJECT:
           parseTextColumn(size, stream, values, i);
           break;
         default:
diff --git 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/utils/datastructure/AlignedTVList.java
 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/utils/datastructure/AlignedTVList.java
index 80649eb182d..7c0acb166a3 100644
--- 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/utils/datastructure/AlignedTVList.java
+++ 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/utils/datastructure/AlignedTVList.java
@@ -201,6 +201,7 @@ public abstract class AlignedTVList extends TVList {
         case TEXT:
         case BLOB:
         case STRING:
+        case OBJECT:
           ((Binary[]) columnValues.get(arrayIndex))[elementIndex] =
               columnValue != null ? (Binary) columnValue : Binary.EMPTY_VALUE;
           memoryBinaryChunkSize[i] +=
@@ -300,6 +301,7 @@ public abstract class AlignedTVList extends TVList {
         case TEXT:
         case BLOB:
         case STRING:
+        case OBJECT:
           Binary valueT = ((Binary[]) 
columnValues.get(arrayIndex))[elementIndex];
           vector[columnIndex] = TsPrimitiveType.getByType(TSDataType.TEXT, 
valueT);
           break;
@@ -361,6 +363,7 @@ public abstract class AlignedTVList extends TVList {
         case TEXT:
         case STRING:
         case BLOB:
+        case OBJECT:
           columnValue.add(getPrimitiveArraysByType(TSDataType.TEXT));
           break;
         case FLOAT:
@@ -640,6 +643,7 @@ public abstract class AlignedTVList extends TVList {
       case TEXT:
       case BLOB:
       case STRING:
+      case OBJECT:
         Binary[] valueT = (Binary[]) value;
         Binary[] cloneT = new Binary[valueT.length];
         System.arraycopy(valueT, 0, cloneT, 0, valueT.length);
@@ -834,6 +838,7 @@ public abstract class AlignedTVList extends TVList {
         case TEXT:
         case BLOB:
         case STRING:
+        case OBJECT:
           Binary[] arrayT = ((Binary[]) columnValues.get(arrayIndex));
           System.arraycopy(value[i], idx, arrayT, elementIndex, remaining);
 
@@ -1122,6 +1127,7 @@ public abstract class AlignedTVList extends TVList {
           case TEXT:
           case BLOB:
           case STRING:
+          case OBJECT:
             valueBuilder.writeBinary(getBinaryByValueIndex(originRowIndex, 
columnIndex));
             break;
           default:
@@ -1199,6 +1205,7 @@ public abstract class AlignedTVList extends TVList {
         case TEXT:
         case BLOB:
         case STRING:
+        case OBJECT:
           for (int rowIdx = 0; rowIdx < rowCount; ++rowIdx) {
             size += ReadWriteIOUtils.sizeToWrite(getBinaryByValueIndex(rowIdx, 
columnIndex));
           }
@@ -1259,6 +1266,7 @@ public abstract class AlignedTVList extends TVList {
           case TEXT:
           case BLOB:
           case STRING:
+          case OBJECT:
             Binary valueT = ((Binary[]) 
columnValues.get(arrayIndex))[elementIndex];
             // In some scenario, the Binary in AlignedTVList will be null if 
this field is empty in
             // current row. We need to handle this scenario to get rid of NPE. 
See the similar issue
@@ -1338,6 +1346,7 @@ public abstract class AlignedTVList extends TVList {
         case TEXT:
         case BLOB:
         case STRING:
+        case OBJECT:
           Binary[] binaryValues = new Binary[rowCount];
           for (int rowIndex = 0; rowIndex < rowCount; ++rowIndex) {
             binaryValues[rowIndex] = ReadWriteIOUtils.readBinary(stream);
@@ -1725,6 +1734,7 @@ public abstract class AlignedTVList extends TVList {
         case TEXT:
         case BLOB:
         case STRING:
+        case OBJECT:
           return TsPrimitiveType.getByType(
               TSDataType.TEXT, getBinaryByValueIndex(valueIndex, 
validColumnIndex));
         default:
@@ -1889,6 +1899,7 @@ public abstract class AlignedTVList extends TVList {
             case TEXT:
             case BLOB:
             case STRING:
+            case OBJECT:
               valueBuilder.writeBinary(getBinaryByValueIndex(originRowIndex, 
validColumnIndex));
               break;
             default:
@@ -2060,6 +2071,7 @@ public abstract class AlignedTVList extends TVList {
             case TEXT:
             case BLOB:
             case STRING:
+            case OBJECT:
               valueChunkWriter.write(
                   time,
                   isNull ? null : getBinaryByValueIndex(originRowIndex, 
validColumnIndex),

Reply via email to