This is an automated email from the ASF dual-hosted git repository.
justinchen pushed a commit to branch disable-2
in repository https://gitbox.apache.org/repos/asf/iotdb.git
The following commit(s) were added to refs/heads/disable-2 by this push:
new 565f44e6a17 dis-o
565f44e6a17 is described below
commit 565f44e6a17f9f9c54bb9f95393334362475ad77
Author: Caideyipi <[email protected]>
AuthorDate: Tue Jan 13 12:09:41 2026 +0800
dis-o
---
.../iotdb/relational/it/schema/IoTDBTableIT.java | 141 ---------------------
.../apache/iotdb/commons/schema/table/TsTable.java | 18 +--
2 files changed, 1 insertion(+), 158 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 7915d64a680..0923877d977 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
@@ -19,7 +19,6 @@
package org.apache.iotdb.relational.it.schema;
-import org.apache.iotdb.commons.utils.WindowsOSUtils;
import org.apache.iotdb.db.it.utils.TestUtils;
import org.apache.iotdb.isession.ITableSession;
import org.apache.iotdb.it.env.EnvFactory;
@@ -32,7 +31,6 @@ 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;
@@ -43,9 +41,6 @@ import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.junit.runner.RunWith;
-import java.io.File;
-import java.nio.file.Files;
-import java.nio.file.Paths;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
@@ -783,142 +778,6 @@ 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);
- }
- }
-
- private void testObject4SingleIllegalPath(final String illegal) throws
Exception {
- try (final Connection connection =
- EnvFactory.getEnv().getConnection(BaseEnv.TABLE_SQL_DIALECT);
- final Statement statement = connection.createStatement();
- final ITableSession session =
EnvFactory.getEnv().getTableSessionConnection()) {
- statement.execute("create database if not exists db2");
- statement.execute("use db2");
-
- // Test auto-create table
- final String testObject =
- System.getProperty("user.dir")
- + File.separator
- + "target"
- + File.separator
- + "test-classes"
- + File.separator
- + "object-example.pt";
-
- final List<IMeasurementSchema> schemaList = new ArrayList<>();
- schemaList.add(new MeasurementSchema("a", TSDataType.STRING));
- schemaList.add(new MeasurementSchema("b", TSDataType.STRING));
- schemaList.add(new MeasurementSchema("c", TSDataType.INT32));
- schemaList.add(new MeasurementSchema(illegal, TSDataType.OBJECT));
- final List<ColumnCategory> columnTypes =
- Arrays.asList(
- ColumnCategory.TAG,
- ColumnCategory.ATTRIBUTE,
- ColumnCategory.FIELD,
- ColumnCategory.FIELD);
- final Tablet tablet =
- new Tablet(
- illegal,
- IMeasurementSchema.getMeasurementNameList(schemaList),
- IMeasurementSchema.getDataTypeList(schemaList),
- columnTypes,
- 1);
- tablet.addTimestamp(0, System.currentTimeMillis());
- tablet.addValue(schemaList.get(0).getMeasurementName(), 0, "d1");
- tablet.addValue(schemaList.get(1).getMeasurementName(), 0, "a1");
- tablet.addValue(schemaList.get(2).getMeasurementName(), 0, 0);
- tablet.addValue(0, 3, true, 0,
Files.readAllBytes(Paths.get(testObject)));
-
- final String expectedTableError =
- String.format(
- "701: When there are object fields, the tableName %s shall not
be '.', '..' or contain './', '.\\'."
- + (SystemUtils.IS_OS_WINDOWS ? " " +
WindowsOSUtils.OS_SEGMENT_ERROR : ""),
- illegal.toLowerCase());
- final String expectedObjectError =
- String.format(
- "701: When there are object fields, the objectName %s shall not
be '.', '..' or contain './', '.\\'."
- + (SystemUtils.IS_OS_WINDOWS ? " " +
WindowsOSUtils.OS_SEGMENT_ERROR : ""),
- illegal.toLowerCase());
-
- try {
- session.executeNonQueryStatement("use db2");
- session.insert(tablet);
- } catch (final Exception e) {
- Assert.assertEquals(expectedTableError, e.getMessage());
- }
-
- statement.execute(String.format("create table \"%s\" ()", illegal));
-
- try {
- statement.execute(String.format("alter table \"%s\" add column a
object", illegal));
- fail();
- } catch (final SQLException e) {
- Assert.assertEquals(expectedTableError, e.getMessage());
- }
-
- // Test auto-create column
- try {
- session.executeNonQueryStatement("use db2");
- session.insert(tablet);
- } catch (final Exception e) {
- Assert.assertEquals(expectedTableError, e.getMessage());
- }
-
- try {
- statement.execute(String.format("create table test (\"%s\" object)",
illegal));
- fail();
- } catch (final SQLException e) {
- Assert.assertEquals(expectedObjectError, e.getMessage());
- }
-
- statement.execute("create table test (a tag, b attribute, c int32, d
object)");
-
- // Cannot auto-extend illegal column
- tablet.setTableName("test");
- try {
- session.executeNonQueryStatement("use db2");
- session.insert(tablet);
- } catch (final Exception e) {
- Assert.assertEquals(expectedObjectError, e.getMessage());
- }
-
- // It's OK if you don't write object
- statement.execute(String.format("insert into test (a, b, c) values
('%s', 1, 1)", illegal));
- try {
- statement.execute(
- String.format(
- "insert into test (a, b, c, d) values ('%s', 1, 1,
to_object(true, 0, X'aa'))",
- illegal));
- fail();
- } catch (final SQLException e) {
- Assert.assertEquals(
- String.format(
- "507: When there are object fields, the deviceId [test, %s]
shall not be '.', '..' or contain './', '.\\'."
- + (SystemUtils.IS_OS_WINDOWS ? " " +
WindowsOSUtils.OS_SEGMENT_ERROR : ""),
- illegal),
- e.getMessage());
- }
-
- try {
- statement.execute(String.format("alter table test add column \"%s\"
object", illegal));
- fail();
- } catch (final SQLException e) {
- Assert.assertEquals(expectedObjectError, e.getMessage());
- }
-
- statement.execute("drop database db2");
- }
- }
-
@Test
public void testTreeViewTable() throws Exception {
try (final Connection connection = EnvFactory.getEnv().getConnection();
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 7dd64481a0e..12aeb4eeaf2 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
@@ -31,7 +31,6 @@ import
org.apache.iotdb.commons.schema.table.column.TsTableColumnSchema;
import org.apache.iotdb.commons.schema.table.column.TsTableColumnSchemaUtil;
import org.apache.iotdb.commons.utils.CommonDateTimeUtils;
import org.apache.iotdb.commons.utils.WindowsOSUtils;
-import org.apache.iotdb.rpc.TSStatusCode;
import com.google.common.collect.ImmutableList;
import org.apache.tsfile.enums.TSDataType;
@@ -417,22 +416,7 @@ public class TsTable {
}
public void checkTableNameAndObjectNames4Object() throws MetadataException {
- if (!CommonDescriptor.getInstance().getConfig().isRestrictObjectLimit()) {
- return;
- }
- if (isInvalid4ObjectType(tableName)) {
- throw new MetadataException(
- getObjectStringError("tableName", tableName),
- TSStatusCode.SEMANTIC_ERROR.getStatusCode());
- }
- for (final TsTableColumnSchema schema : columnSchemaMap.values()) {
- if (schema.getDataType().equals(TSDataType.OBJECT)
- && isInvalid4ObjectType(schema.getColumnName())) {
- throw new MetadataException(
- getObjectStringError("objectName", schema.getColumnName()),
- TSStatusCode.SEMANTIC_ERROR.getStatusCode());
- }
- }
+ throw new MetadataException("The object type column is not supported.");
}
public static boolean isInvalid4ObjectType(final String path) {