diff --git a/server/src/assembly/resources/conf/iotdb-engine.properties b/server/src/assembly/resources/conf/iotdb-engine.properties index 3d45d57b6076fc07b0f9f0a9510b9f0a36c415e9..44d69fe899a1162c27d7ee0403ae3952d1cb86f4 100644 --- a/server/src/assembly/resources/conf/iotdb-engine.properties +++ b/server/src/assembly/resources/conf/iotdb-engine.properties @@ -330,7 +330,7 @@ watermark_method=GroupBasedLSBMethod(embed_row_cycle=2,embed_lsb_num=5) #################### # Whether creating schema automatically is enabled -enable_auto_create_schema=false +enable_auto_create_schema=true # Storage group level when creating schema automatically is enabled # e.g. root.sg0.d1.s2 diff --git a/server/src/main/java/org/apache/iotdb/db/utils/TypeInferenceUtils.java b/server/src/main/java/org/apache/iotdb/db/utils/TypeInferenceUtils.java index 934bc8ce03a88e854de26914bf08ee5181f8ecda..63c79a3125439bc47b434ab5a48fddc8b3abcf8b 100644 --- a/server/src/main/java/org/apache/iotdb/db/utils/TypeInferenceUtils.java +++ b/server/src/main/java/org/apache/iotdb/db/utils/TypeInferenceUtils.java @@ -19,6 +19,7 @@ package org.apache.iotdb.db.utils; +import org.apache.iotdb.db.qp.constant.SQLConstant; import org.apache.iotdb.tsfile.file.metadata.enums.TSDataType; public class TypeInferenceUtils { @@ -27,7 +28,7 @@ public class TypeInferenceUtils { } - public static boolean isNumber(String s) { + static boolean isNumber(String s) { try { Double.parseDouble(s); } catch (NumberFormatException e) { @@ -36,11 +37,16 @@ public class TypeInferenceUtils { return true; } + private static boolean isBoolean(String s) { + return s.equalsIgnoreCase(SQLConstant.BOOLEN_TRUE) || s + .equalsIgnoreCase(SQLConstant.BOOLEN_FALSE); + } + /** * Get predicted DataType of the given value */ public static TSDataType getPredictedDataType(Object value) { - if (value instanceof Boolean) { + if (value instanceof Boolean || (value instanceof String && isBoolean((String) value))) { return TSDataType.BOOLEAN; } else if (value instanceof Number || (value instanceof String && isNumber((String) value))) { String v = String.valueOf(value);