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

rong pushed a commit to branch dev/1.3
in repository https://gitbox.apache.org/repos/asf/iotdb.git


The following commit(s) were added to refs/heads/dev/1.3 by this push:
     new 1b444270a75 Pipe: Fix the problem that the receiver constructs 
InsertStatement causing the MeasurementShcema to not be correctly set to null 
(NPE) (#14831) (#14858)
1b444270a75 is described below

commit 1b444270a75df20d9e4541df75ce4797e09e4ad6
Author: Zhenyu Luo <[email protected]>
AuthorDate: Mon Feb 17 11:53:03 2025 +0800

    Pipe: Fix the problem that the receiver constructs InsertStatement causing 
the MeasurementShcema to not be correctly set to null (NPE) (#14831) (#14858)
    
    (cherry picked from commit 57ede481a847e1132ffc5ec1b7cfda684d9f86ea)
---
 .../db/pipe/receiver/visitor/PipePlanToStatementVisitor.java      | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/receiver/visitor/PipePlanToStatementVisitor.java
 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/receiver/visitor/PipePlanToStatementVisitor.java
index 593e3715c88..89e931f7ed3 100644
--- 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/receiver/visitor/PipePlanToStatementVisitor.java
+++ 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/receiver/visitor/PipePlanToStatementVisitor.java
@@ -74,6 +74,9 @@ public class PipePlanToStatementVisitor extends 
PlanVisitor<Statement, Void> {
 
   @Override
   public InsertRowStatement visitInsertRow(final InsertRowNode node, final 
Void context) {
+    // MeasurementSchema is only allowed to be set at the analysis type stage. 
However, InsertNode
+    // has already set MeasurementSchema at the sending end. If the statement 
constructed this time
+    // calls SetMeasurementSchema, it will cause NPE
     final InsertRowStatement statement = new InsertRowStatement();
     statement.setDevicePath(node.getDevicePath());
     statement.setTime(node.getTime());
@@ -82,12 +85,14 @@ public class PipePlanToStatementVisitor extends 
PlanVisitor<Statement, Void> {
     statement.setValues(node.getValues());
     statement.setNeedInferType(node.isNeedInferType());
     statement.setAligned(node.isAligned());
-    statement.setMeasurementSchemas(node.getMeasurementSchemas());
     return statement;
   }
 
   @Override
   public InsertTabletStatement visitInsertTablet(final InsertTabletNode node, 
final Void context) {
+    // MeasurementSchema is only allowed to be set at the analysis type stage. 
However, InsertNode
+    // has already set MeasurementSchema at the sending end. If the statement 
constructed this time
+    // calls SetMeasurementSchema, it will cause NPE
     final InsertTabletStatement statement = new InsertTabletStatement();
     statement.setDevicePath(node.getDevicePath());
     statement.setMeasurements(node.getMeasurements());
@@ -97,7 +102,6 @@ public class PipePlanToStatementVisitor extends 
PlanVisitor<Statement, Void> {
     statement.setRowCount(node.getRowCount());
     statement.setDataTypes(node.getDataTypes());
     statement.setAligned(node.isAligned());
-    statement.setMeasurementSchemas(node.getMeasurementSchemas());
     return statement;
   }
 

Reply via email to