|
22 | 22 | import org.apache.iotdb.commons.conf.CommonDescriptor; |
23 | 23 | import org.apache.iotdb.commons.exception.MetadataException; |
24 | 24 | 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; |
28 | 25 | import org.apache.iotdb.commons.schema.table.column.TimeColumnSchema; |
29 | 26 | import org.apache.iotdb.commons.schema.table.column.TsTableColumnCategory; |
30 | 27 | import org.apache.iotdb.commons.schema.table.column.TsTableColumnSchema; |
@@ -237,33 +234,10 @@ public void renameColumnSchema(final String oldName, final String newName) { |
237 | 234 | () -> { |
238 | 235 | // Ensures idempotency |
239 | 236 | if (columnSchemaMap.containsKey(oldName)) { |
240 | | - final TsTableColumnSchema schema = columnSchemaMap.remove(oldName); |
| 237 | + final TsTableColumnSchema schema = columnSchemaMap.get(oldName); |
241 | 238 | final Map<String, String> oldProps = schema.getProps(); |
242 | 239 | 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); |
267 | 241 | } |
268 | 242 | }); |
269 | 243 | } |
|
0 commit comments