You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by ha...@apache.org on 2022/04/28 14:56:36 UTC

[iotdb] branch master updated: Predict data type for auto creating timeseries (#5724)

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 d75e5081e4 Predict data type for auto creating timeseries (#5724)
d75e5081e4 is described below

commit d75e5081e44fd84b840c68891388b1487c96aadd
Author: Mrquan <50...@users.noreply.github.com>
AuthorDate: Thu Apr 28 22:56:29 2022 +0800

    Predict data type for auto creating timeseries (#5724)
    
    * [MPP] predict data type when auto create timeseries
---
 .../db/mpp/sql/planner/plan/node/write/InsertRowNode.java  | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/sql/planner/plan/node/write/InsertRowNode.java b/server/src/main/java/org/apache/iotdb/db/mpp/sql/planner/plan/node/write/InsertRowNode.java
index 1ae73f52e8..2378e96ee0 100644
--- a/server/src/main/java/org/apache/iotdb/db/mpp/sql/planner/plan/node/write/InsertRowNode.java
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/sql/planner/plan/node/write/InsertRowNode.java
@@ -35,6 +35,7 @@ import org.apache.iotdb.db.mpp.sql.planner.plan.node.PlanNodeId;
 import org.apache.iotdb.db.mpp.sql.planner.plan.node.PlanNodeType;
 import org.apache.iotdb.db.mpp.sql.planner.plan.node.WritePlanNode;
 import org.apache.iotdb.db.utils.CommonUtils;
+import org.apache.iotdb.db.utils.TypeInferenceUtils;
 import org.apache.iotdb.db.wal.buffer.IWALByteBufferView;
 import org.apache.iotdb.db.wal.buffer.WALEntryValue;
 import org.apache.iotdb.db.wal.utils.WALWriteUtils;
@@ -120,6 +121,19 @@ public class InsertRowNode extends InsertNode implements WALEntryValue {
     return null;
   }
 
+  @Override
+  public TSDataType[] getDataTypes() {
+    if (isNeedInferType) {
+      TSDataType[] predictedDataTypes = new TSDataType[dataTypes.length];
+      for (int i = 0; i < dataTypes.length; i++) {
+        predictedDataTypes[i] = TypeInferenceUtils.getPredictedDataType(values[i], true);
+      }
+      return predictedDataTypes;
+    }
+
+    return dataTypes;
+  }
+
   public Object[] getValues() {
     return values;
   }