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

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


The following commit(s) were added to refs/heads/rel/0.13 by this push:
     new 45f26515fb [IOTDB-4318][RESTAPI]data type conversion failed (#7260)
45f26515fb is described below

commit 45f26515fb87891af8333c3a53c2af269bae4dfc
Author: Summer <[email protected]>
AuthorDate: Wed Sep 7 18:45:14 2022 +0800

    [IOTDB-4318][RESTAPI]data type conversion failed (#7260)
---
 .../rest/handler/PhysicalPlanConstructionHandler.java   | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git 
a/server/src/main/java/org/apache/iotdb/db/protocol/rest/handler/PhysicalPlanConstructionHandler.java
 
b/server/src/main/java/org/apache/iotdb/db/protocol/rest/handler/PhysicalPlanConstructionHandler.java
index efc8bcdfb8..9c49d98f49 100644
--- 
a/server/src/main/java/org/apache/iotdb/db/protocol/rest/handler/PhysicalPlanConstructionHandler.java
+++ 
b/server/src/main/java/org/apache/iotdb/db/protocol/rest/handler/PhysicalPlanConstructionHandler.java
@@ -58,10 +58,17 @@ public class PhysicalPlanConstructionHandler {
         case BOOLEAN:
           boolean[] booleanValues = new boolean[rowSize];
           for (int rowIndex = 0; rowIndex < rowSize; rowIndex++) {
-            if (rawData.get(columnIndex).get(rowIndex) == null) {
+            Object data = rawData.get(columnIndex).get(rowIndex);
+            if (data == null) {
               bitMaps[columnIndex].mark(rowIndex);
             } else {
-              booleanValues[rowIndex] = (Boolean) 
rawData.get(columnIndex).get(rowIndex);
+              if ("1".equals(data.toString())) {
+                booleanValues[rowIndex] = true;
+              } else if ("0".equals(data.toString())) {
+                booleanValues[rowIndex] = false;
+              } else {
+                booleanValues[rowIndex] = (Boolean) data;
+              }
             }
           }
           columns[columnIndex] = booleanValues;
@@ -101,11 +108,11 @@ public class PhysicalPlanConstructionHandler {
         case FLOAT:
           float[] floatValues = new float[rowSize];
           for (int rowIndex = 0; rowIndex < rowSize; rowIndex++) {
-            if (rawData.get(columnIndex).get(rowIndex) == null) {
+            Object data = rawData.get(columnIndex).get(rowIndex);
+            if (data == null) {
               bitMaps[columnIndex].mark(rowIndex);
             } else {
-              floatValues[rowIndex] =
-                  ((Double) 
rawData.get(columnIndex).get(rowIndex)).floatValue();
+              floatValues[rowIndex] = Float.valueOf(String.valueOf(data));
             }
           }
           columns[columnIndex] = floatValues;

Reply via email to