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

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


The following commit(s) were added to refs/heads/master by this push:
     new 91a279a8a6 [IOTDB-4972] Fix NPE when validate schema without auto 
create schema (#8115)
91a279a8a6 is described below

commit 91a279a8a6b8f99600a54392c761f0f4f3f37608
Author: Marcos_Zyk <[email protected]>
AuthorDate: Wed Nov 23 20:13:09 2022 +0800

    [IOTDB-4972] Fix NPE when validate schema without auto create schema (#8115)
---
 .../iotdb/db/mpp/plan/planner/plan/node/write/InsertNode.java      | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git 
a/server/src/main/java/org/apache/iotdb/db/mpp/plan/planner/plan/node/write/InsertNode.java
 
b/server/src/main/java/org/apache/iotdb/db/mpp/plan/planner/plan/node/write/InsertNode.java
index c53bb9fcee..eb2e52cf28 100644
--- 
a/server/src/main/java/org/apache/iotdb/db/mpp/plan/planner/plan/node/write/InsertNode.java
+++ 
b/server/src/main/java/org/apache/iotdb/db/mpp/plan/planner/plan/node/write/InsertNode.java
@@ -248,10 +248,9 @@ public abstract class InsertNode extends WritePlanNode {
   /** Check whether data types are matched with measurement schemas */
   protected void selfCheckDataTypes() throws DataTypeMismatchException {
     for (int i = 0; i < measurementSchemas.length; i++) {
-      if (dataTypes[i] != measurementSchemas[i].getType()) {
-        if (checkAndCastDataType(i, measurementSchemas[i].getType())) {
-          continue;
-        }
+      if (measurementSchemas[i] == null
+          || (dataTypes[i] != measurementSchemas[i].getType()
+              && !checkAndCastDataType(i, measurementSchemas[i].getType()))) {
         if 
(!IoTDBDescriptor.getInstance().getConfig().isEnablePartialInsert()) {
           throw new DataTypeMismatchException(
               devicePath.getFullPath(),

Reply via email to