You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by ja...@apache.org on 2024/08/08 02:13:57 UTC
(iotdb) 27/30: Unify string type inference (#13094)
This is an automated email from the ASF dual-hosted git repository.
jackietien pushed a commit to branch mergemaster0808
in repository https://gitbox.apache.org/repos/asf/iotdb.git
commit 4bd656735fc4fe2cf1d0ce47cd7b15d9fd4074b9
Author: Haonan <hh...@outlook.com>
AuthorDate: Tue Aug 6 18:14:58 2024 +0800
Unify string type inference (#13094)
* Unify string type inference
* rm useless submodule
(cherry picked from commit 74404a333ac5af3d3ba65328897c31f45fa8db12)
---
.../src/main/java/org/apache/iotdb/db/utils/TypeInferenceUtils.java | 2 +-
.../test/java/org/apache/iotdb/db/utils/TypeInferenceUtilsTest.java | 6 +++++-
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/utils/TypeInferenceUtils.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/utils/TypeInferenceUtils.java
index 8167a603844..d4ac57f6599 100644
--- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/utils/TypeInferenceUtils.java
+++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/utils/TypeInferenceUtils.java
@@ -58,7 +58,7 @@ public class TypeInferenceUtils {
} catch (NumberFormatException e) {
return false;
}
- return true;
+ return !s.endsWith("F") && !s.endsWith("f") && !s.endsWith("D") && !s.endsWith("d");
}
private static boolean isBoolean(String s) {
diff --git a/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/utils/TypeInferenceUtilsTest.java b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/utils/TypeInferenceUtilsTest.java
index 9933d61c688..cc63f38edfd 100644
--- a/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/utils/TypeInferenceUtilsTest.java
+++ b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/utils/TypeInferenceUtilsTest.java
@@ -82,6 +82,8 @@ public class TypeInferenceUtilsTest {
"4.9387406015404442E17",
"4E5",
"1.0",
+ "4F",
+ "4L"
};
TSDataType[] inferredTypes = {
TSDataType.INT32,
@@ -100,7 +102,9 @@ public class TypeInferenceUtilsTest {
config.getFloatingStringInferType(),
config.getFloatingStringInferType(),
config.getFloatingStringInferType(),
- config.getFloatingStringInferType()
+ config.getFloatingStringInferType(),
+ TSDataType.TEXT,
+ TSDataType.TEXT,
};
for (int i = 0; i < values.length; i++) {