Skip to content

Conversation

@zerolbsony
Copy link
Contributor

@zerolbsony zerolbsony commented Jul 24, 2025

CHN doc:
https://timechor.feishu.cn/docx/AugedrYLqoybsbxzgEZc2eTinTg?from=from_copylink

IoTDB> alter timeseries root.db.battery.b0.current SET DATA TYPE DOUBLE;
Msg: The statement is executed successfully.
IoTDB> show timeseries root.db.battery.b0.current;
+--------------------------+-----+--------+--------+--------+-----------+----+----------+--------+------------------+--------+
| Timeseries|Alias|Database|DataType|Encoding|Compression|Tags|Attributes|Deadband|DeadbandParameters|ViewType|
+--------------------------+-----+--------+--------+--------+-----------+----+----------+--------+------------------+--------+
|root.db.battery.b0.current| null| root.db| DOUBLE| GORILLA| LZ4|null| null| null| null| BASE|
+--------------------------+-----+--------+--------+--------+-----------+----+----------+--------+------------------+--------+
Total line number = 1
It costs 0.043s
IoTDB> alter timeseries root.db.battery.b0.current SET DATA TYPE STRING;
Msg: The statement is executed successfully.
IoTDB> show timeseries root.db.battery.b0.current;
+--------------------------+-----+--------+--------+--------+-----------+----+----------+--------+------------------+--------+
| Timeseries|Alias|Database|DataType|Encoding|Compression|Tags|Attributes|Deadband|DeadbandParameters|ViewType|
+--------------------------+-----+--------+--------+--------+-----------+----+----------+--------+------------------+--------+
|root.db.battery.b0.current| null| root.db| STRING| GORILLA| LZ4|null| null| null| null| BASE|
+--------------------------+-----+--------+--------+--------+-----------+----+----------+--------+------------------+--------+
Total line number = 1
It costs 0.009s

# Conflicts:
#	iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/ConfigPhysicalPlanType.java
#	pom.xml
# Conflicts:
#	integration-test/src/main/java/org/apache/iotdb/it/env/cluster/config/MppDataNodeConfig.java
#	integration-test/src/main/java/org/apache/iotdb/it/env/remote/config/RemoteDataNodeConfig.java
#	integration-test/src/main/java/org/apache/iotdb/itbase/env/DataNodeConfig.java
#	iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/ProcedureManager.java
#	iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/table/column/TsTableColumnSchema.java
#	pom.xml
# Conflicts:
#	iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/sql/ast/AstVisitor.java
# Conflicts:
#	iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/memtable/AlignedWritableMemChunk.java
# Conflicts:
#	iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/execution/config/TableConfigTaskVisitor.java
# Conflicts:
#	integration-test/src/test/java/org/apache/iotdb/relational/it/db/it/IoTDBSetSystemStatusTableIT.java
(cherry picked from commit ea9f726)
# Conflicts:
#	iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/modification/ModificationFile.java
# Conflicts:
#	iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/plan/node/write/RelationalInsertRowNode.java
#	iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/plan/node/write/RelationalInsertTabletNode.java
#	iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/memtable/AbstractMemTable.java
#	iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/memtable/AlignedWritableMemChunk.java
#	iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/memtable/AlignedWritableMemChunkGroup.java
#	iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/read/reader/chunk/MemAlignedPageReader.java
#	iotdb-core/datanode/src/main/java/org/apache/iotdb/db/utils/datastructure/AlignedTVList.java
# Conflicts:
#	iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/schema/ClusterSchemaManager.java
#	iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/persistence/schema/ClusterSchemaInfo.java
#	iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/plan/node/write/RelationalInsertTabletNode.java
#	iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/memtable/AlignedWritableMemChunkGroup.java
#	iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/memtable/WritableMemChunkGroup.java
# Conflicts:
#	integration-test/src/test/java/org/apache/iotdb/relational/it/session/IoTDBSessionRelationalIT.java
#	iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/pipe/receiver/protocol/IoTDBConfigNodeReceiver.java
#	iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/execution/config/executor/ClusterConfigTaskExecutor.java
#	iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/compaction/execute/performer/impl/FastCompactionPerformer.java
#	iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/compaction/execute/performer/impl/ReadChunkCompactionPerformer.java
#	iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/compaction/execute/utils/executor/fast/FastNonAlignedSeriesCompactionExecutor.java
#	iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/memtable/IWritableMemChunkGroup.java
#	iotdb-core/datanode/src/main/java/org/apache/iotdb/db/utils/CommonUtils.java
#	pom.xml
Fix the problem that valueChunkMetadata get wrong datatype so that can't generate valid statistics object in the switch code block cause by newChunkMetadata set the property value of TsDataType
# Conflicts:
#	iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/ConfigPhysicalPlanVisitor.java
…ccumulator query among tree and table model.
@zerolbsony zerolbsony changed the title Alter column datatype with ANSI SQL statement Alter column and timeseries datatype with ANSI SQL statement Jan 3, 2026
Caideyipi and others added 5 commits January 4, 2026 10:51
…a type cause by AlterTimeSeriesDataTypeProcedure won't run.
Repair all accumulator query logics about TEXT、STRING、BLOB on IoTDBAlterColumnTypeIT;
Remove unuseful and incorrect code
Comment on lines 2474 to 2481
// if (newType == TSDataType.STRING
// || newType == TSDataType.TEXT
// || newType == TSDataType.BLOB) {
// expectedValue[1] = 999;
// } else if (newType == TSDataType.BOOLEAN) {
// expectedValue = new int[] {19700102, 19721021, 19700102, 19721021};
// }
if (newType != TSDataType.BOOLEAN) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove

"select first(s1),last(s1) from construct_and_alter_column_type");
RowRecord rec = dataSet.next();
while (rec != null) {
System.out.println(rec.getFields().toString());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove

Comment on lines +3249 to +3256
import org.apache.iotdb.confignode.rpc.thrift.TCreateFunctionReq;
import org.apache.iotdb.confignode.rpc.thrift.TCreatePipePluginReq;
import org.apache.iotdb.confignode.rpc.thrift.TCreatePipeReq;
import org.apache.iotdb.confignode.rpc.thrift.TCreateTableViewReq;
import org.apache.iotdb.confignode.rpc.thrift.TCreateTopicReq;
import org.apache.iotdb.confignode.rpc.thrift.TCreateTriggerReq;
import org.apache.iotdb.confignode.rpc.thrift.TDataNodeRemoveReq;
import org.apache.iotdb.confignode.rpc.thrift.TDataNodeRemoveResp;
import org.apache.iotdb.confignode.rpc.thrift.TDatabaseSchema;
import org.apache.iotdb.confignode.rpc.thrift.TDeactivateSchemaTemplateReq;
import org.apache.iotdb.confignode.rpc.thrift.TDeleteDatabasesReq;
import org.apache.iotdb.confignode.rpc.thrift.TDeleteLogicalViewReq;
import org.apache.iotdb.confignode.rpc.thrift.TDeleteTableDeviceReq;
import org.apache.iotdb.confignode.rpc.thrift.TDeleteTableDeviceResp;
import org.apache.iotdb.confignode.rpc.thrift.TDeleteTimeSeriesReq;
import org.apache.iotdb.confignode.rpc.thrift.TDescTableResp;
import org.apache.iotdb.confignode.rpc.thrift.TDropCQReq;
import org.apache.iotdb.confignode.rpc.thrift.TDropFunctionReq;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should throw an exception

} else {
// not support
throw new InterruptedException("AlterTimeSeriesTask is not support");
throw new InterruptedException("Not support current statement");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

UnsupportedOperationException

Comment on lines +47 to +50
throw new InterruptedException(
String.format(
"Data type cannot be null executing the statement that alter timeseries %s set data type",
alterTimeSeriesStatement.getPath().getFullPath()));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IllegalArgumentException

Comment on lines 687 to 696
private TSDataType parseDataTypeAttribute(IoTDBSqlParser.AttributeValueContext ctx) {
TSDataType dataType = null;
if (ctx != null) {
String dataTypeString = parseAttributeValue(ctx);
try {
dataType = TSDataType.valueOf(dataTypeString);
if (TSDataType.UNKNOWN.equals(dataType) || TSDataType.VECTOR.equals(dataType)) {
throw new SemanticException(String.format("Unsupported datatype: %s", dataTypeString));
}
} catch (Exception e) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unnecessary to catch and rethrow the same exception.

Comment on lines +297 to +301
if (dataTypeColumnClassMap.get(originalDataType) == null
|| dataTypeColumnClassMap.get(dataType) == null) {
return false;
}
return dataTypeColumnClassMap.get(originalDataType) == dataTypeColumnClassMap.get(dataType);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Objects.equals(dataTypeColumnClassMap.get(originalDataType), dataTypeColumnClassMap.get(dataType))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants