Skip to content

Commit 322ba9b

Browse files
committed
fix
1 parent f24e17f commit 322ba9b

1 file changed

Lines changed: 2 additions & 28 deletions

File tree

  • iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/table

iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/table/TsTable.java

Lines changed: 2 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,6 @@
2222
import org.apache.iotdb.commons.conf.CommonDescriptor;
2323
import org.apache.iotdb.commons.exception.MetadataException;
2424
import org.apache.iotdb.commons.exception.runtime.SchemaExecutionException;
25-
import org.apache.iotdb.commons.schema.table.column.AttributeColumnSchema;
26-
import org.apache.iotdb.commons.schema.table.column.FieldColumnSchema;
27-
import org.apache.iotdb.commons.schema.table.column.TagColumnSchema;
2825
import org.apache.iotdb.commons.schema.table.column.TimeColumnSchema;
2926
import org.apache.iotdb.commons.schema.table.column.TsTableColumnCategory;
3027
import org.apache.iotdb.commons.schema.table.column.TsTableColumnSchema;
@@ -237,33 +234,10 @@ public void renameColumnSchema(final String oldName, final String newName) {
237234
() -> {
238235
// Ensures idempotency
239236
if (columnSchemaMap.containsKey(oldName)) {
240-
final TsTableColumnSchema schema = columnSchemaMap.remove(oldName);
237+
final TsTableColumnSchema schema = columnSchemaMap.get(oldName);
241238
final Map<String, String> oldProps = schema.getProps();
242239
oldProps.computeIfAbsent(TreeViewSchema.ORIGINAL_NAME, k -> schema.getColumnName());
243-
switch (schema.getColumnCategory()) {
244-
case TAG:
245-
columnSchemaMap.put(
246-
newName, new TagColumnSchema(newName, schema.getDataType(), oldProps));
247-
break;
248-
case FIELD:
249-
columnSchemaMap.put(
250-
newName,
251-
new FieldColumnSchema(
252-
newName,
253-
schema.getDataType(),
254-
((FieldColumnSchema) schema).getEncoding(),
255-
((FieldColumnSchema) schema).getCompressor(),
256-
oldProps));
257-
break;
258-
case ATTRIBUTE:
259-
columnSchemaMap.put(
260-
newName, new AttributeColumnSchema(newName, schema.getDataType(), oldProps));
261-
break;
262-
case TIME:
263-
default:
264-
// Do nothing
265-
columnSchemaMap.put(oldName, schema);
266-
}
240+
schema.setColumnName(newName);
267241
}
268242
});
269243
}

0 commit comments

Comments
 (0)