This is an automated email from the ASF dual-hosted git repository.
justinchen pushed a commit to branch object-name-fix
in repository https://gitbox.apache.org/repos/asf/iotdb.git
The following commit(s) were added to refs/heads/object-name-fix by this push:
new 96b584d12c9 partial
96b584d12c9 is described below
commit 96b584d12c9610acf373cdf41e033816429e64d4
Author: Caideyipi <[email protected]>
AuthorDate: Mon Jan 5 17:32:20 2026 +0800
partial
---
.../iotdb/relational/it/schema/IoTDBTableIT.java | 18 ++++++++++++------
.../org/apache/iotdb/commons/schema/table/TsTable.java | 10 ++++++++--
.../org/apache/iotdb/commons/utils/WindowsOSUtils.java | 5 +++++
3 files changed, 25 insertions(+), 8 deletions(-)
diff --git
a/integration-test/src/test/java/org/apache/iotdb/relational/it/schema/IoTDBTableIT.java
b/integration-test/src/test/java/org/apache/iotdb/relational/it/schema/IoTDBTableIT.java
index 7ad5172fca4..39135942dfa 100644
---
a/integration-test/src/test/java/org/apache/iotdb/relational/it/schema/IoTDBTableIT.java
+++
b/integration-test/src/test/java/org/apache/iotdb/relational/it/schema/IoTDBTableIT.java
@@ -31,6 +31,7 @@ import org.apache.iotdb.rpc.StatementExecutionException;
import org.apache.tsfile.enums.ColumnCategory;
import org.apache.tsfile.enums.TSDataType;
+import org.apache.tsfile.external.commons.lang3.SystemUtils;
import org.apache.tsfile.write.record.Tablet;
import org.apache.tsfile.write.schema.IMeasurementSchema;
import org.apache.tsfile.write.schema.MeasurementSchema;
@@ -784,6 +785,11 @@ public class IoTDBTableIT {
@Test
public void testTableObjectCheck() throws Exception {
final Set<String> illegal = new HashSet<>(Arrays.asList("./", ".", "..",
".\\", "../hack"));
+ if (SystemUtils.IS_OS_WINDOWS) {
+ illegal.add("C.");
+ illegal.add("a:b<|");
+ illegal.add("COM1");
+ }
for (final String single : illegal) {
testObject4SingleIllegalPath(single);
}
@@ -804,7 +810,7 @@ public class IoTDBTableIT {
} catch (final SQLException e) {
Assert.assertEquals(
String.format(
- "701: When there are object fields, the tableName %s shall not
be '.', '..' or contain './', '.\\'",
+ "701: When there are object fields, the tableName %s shall not
be '.', '..' or contain './', '.\\'.",
illegal),
e.getMessage());
}
@@ -849,7 +855,7 @@ public class IoTDBTableIT {
} catch (final Exception e) {
Assert.assertEquals(
String.format(
- "701: When there are object fields, the tableName %s shall not
be '.', '..' or contain './', '.\\'",
+ "701: When there are object fields, the tableName %s shall not
be '.', '..' or contain './', '.\\'.",
illegal),
e.getMessage());
}
@@ -860,7 +866,7 @@ public class IoTDBTableIT {
} catch (final SQLException e) {
Assert.assertEquals(
String.format(
- "701: When there are object fields, the objectName %s shall
not be '.', '..' or contain './', '.\\'",
+ "701: When there are object fields, the objectName %s shall
not be '.', '..' or contain './', '.\\'.",
illegal),
e.getMessage());
}
@@ -875,7 +881,7 @@ public class IoTDBTableIT {
} catch (final Exception e) {
Assert.assertEquals(
String.format(
- "701: When there are object fields, the objectName %s shall
not be '.', '..' or contain './', '.\\'",
+ "701: When there are object fields, the objectName %s shall
not be '.', '..' or contain './', '.\\'.",
illegal),
e.getMessage());
}
@@ -891,7 +897,7 @@ public class IoTDBTableIT {
} catch (final SQLException e) {
Assert.assertEquals(
String.format(
- "507: When there are object fields, the deviceId [test, %s]
shall not be '.', '..' or contain './', '.\\'",
+ "507: When there are object fields, the deviceId [test, %s]
shall not be '.', '..' or contain './', '.\\'.",
illegal),
e.getMessage());
}
@@ -902,7 +908,7 @@ public class IoTDBTableIT {
} catch (final SQLException e) {
Assert.assertEquals(
String.format(
- "701: When there are object fields, the objectName %s shall
not be '.', '..' or contain './', '.\\'",
+ "701: When there are object fields, the objectName %s shall
not be '.', '..' or contain './', '.\\'.",
illegal),
e.getMessage());
}
diff --git
a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/table/TsTable.java
b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/table/TsTable.java
index f19d2f58d07..0a28cae2ea0 100644
---
a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/table/TsTable.java
+++
b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/table/TsTable.java
@@ -35,6 +35,7 @@ import org.apache.iotdb.rpc.TSStatusCode;
import com.google.common.collect.ImmutableList;
import org.apache.tsfile.enums.TSDataType;
+import org.apache.tsfile.external.commons.lang3.SystemUtils;
import org.apache.tsfile.utils.Pair;
import org.apache.tsfile.utils.ReadWriteIOUtils;
@@ -72,7 +73,7 @@ public class TsTable {
public static final String TTL_PROPERTY = "ttl";
public static final Set<String> TABLE_ALLOWED_PROPERTIES =
Collections.singleton(TTL_PROPERTY);
private static final String OBJECT_STRING_ERROR =
- "When there are object fields, the %s %s shall not be '.', '..' or
contain './', '.\\'";
+ "When there are object fields, the %s %s shall not be '.', '..' or
contain './', '.\\'.";
protected String tableName;
private final Map<String, TsTableColumnSchema> columnSchemaMap = new
LinkedHashMap<>();
@@ -445,7 +446,12 @@ public class TsTable {
}
public static String getObjectStringError(final String columnType, final
String columnName) {
- return String.format(OBJECT_STRING_ERROR, columnType, columnName);
+ return String.format(
+ SystemUtils.IS_OS_WINDOWS
+ ? OBJECT_STRING_ERROR + " " + WindowsOSUtils.OS_SEGMENT_ERROR
+ : OBJECT_STRING_ERROR,
+ columnType,
+ columnName);
}
@Override
diff --git
a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/utils/WindowsOSUtils.java
b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/utils/WindowsOSUtils.java
index f4fb375c23b..3e8155ed759 100644
---
a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/utils/WindowsOSUtils.java
+++
b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/utils/WindowsOSUtils.java
@@ -37,6 +37,11 @@ public class WindowsOSUtils {
}
}
+ public static final String OS_SEGMENT_ERROR =
+ String.format(
+ "In Windows System, the path shall not contains %s, equals one of
%s, or ends with '.' or ' '.",
+ ILLEGAL_WINDOWS_CHARS, ILLEGAL_WINDOWS_NAMES);
+
public static boolean isLegalPathSegment4Windows(final String pathSegment) {
if (!SystemUtils.IS_OS_WINDOWS) {
return true;