From 70c99e439829b68b31458dd68582f93de2e21a1f Mon Sep 17 00:00:00 2001 From: Caideyipi <87789683+Caideyipi@users.noreply.github.com> Date: Fri, 29 Nov 2024 20:24:15 +0800 Subject: [PATCH] complete --- .../schemaregion/SchemaExecutionVisitor.java | 19 ++++++++++--------- .../impl/SchemaRegionMemoryImpl.java | 14 ++++++++++---- 2 files changed, 20 insertions(+), 13 deletions(-) diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/consensus/statemachine/schemaregion/SchemaExecutionVisitor.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/consensus/statemachine/schemaregion/SchemaExecutionVisitor.java index a6caba0a3f24..b3d6b8f8d04a 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/consensus/statemachine/schemaregion/SchemaExecutionVisitor.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/consensus/statemachine/schemaregion/SchemaExecutionVisitor.java @@ -95,10 +95,11 @@ public class SchemaExecutionVisitor extends PlanVisitor private static final Logger logger = LoggerFactory.getLogger(SchemaExecutionVisitor.class); @Override - public TSStatus visitCreateTimeSeries(CreateTimeSeriesNode node, ISchemaRegion schemaRegion) { + public TSStatus visitCreateTimeSeries( + final CreateTimeSeriesNode node, final ISchemaRegion schemaRegion) { try { schemaRegion.createTimeSeries(node, -1); - } catch (MetadataException e) { + } catch (final MetadataException e) { logger.error("{}: MetaData error: ", IoTDBConstant.GLOBAL_DB_NAME, e); return RpcUtils.getStatus(e.getErrorCode(), e.getMessage()); } @@ -107,10 +108,10 @@ public TSStatus visitCreateTimeSeries(CreateTimeSeriesNode node, ISchemaRegion s @Override public TSStatus visitCreateAlignedTimeSeries( - CreateAlignedTimeSeriesNode node, ISchemaRegion schemaRegion) { + final CreateAlignedTimeSeriesNode node, final ISchemaRegion schemaRegion) { try { schemaRegion.createAlignedTimeSeries(node); - } catch (MetadataException e) { + } catch (final MetadataException e) { logger.error("{}: MetaData error: ", IoTDBConstant.GLOBAL_DB_NAME, e); return RpcUtils.getStatus(e.getErrorCode(), e.getMessage()); } @@ -119,13 +120,13 @@ public TSStatus visitCreateAlignedTimeSeries( @Override public TSStatus visitCreateMultiTimeSeries( - CreateMultiTimeSeriesNode node, ISchemaRegion schemaRegion) { - Map measurementGroupMap = node.getMeasurementGroupMap(); - List failingStatus = new ArrayList<>(); + final CreateMultiTimeSeriesNode node, final ISchemaRegion schemaRegion) { + final Map measurementGroupMap = node.getMeasurementGroupMap(); + final List failingStatus = new ArrayList<>(); PartialPath devicePath; MeasurementGroup measurementGroup; int size; - for (Map.Entry entry : measurementGroupMap.entrySet()) { + for (final Map.Entry entry : measurementGroupMap.entrySet()) { devicePath = entry.getKey(); measurementGroup = entry.getValue(); size = measurementGroup.getMeasurements().size(); @@ -148,7 +149,7 @@ public TSStatus visitCreateMultiTimeSeries( } private ICreateTimeSeriesPlan transformToCreateTimeSeriesPlan( - PartialPath devicePath, MeasurementGroup measurementGroup, int index) { + final PartialPath devicePath, final MeasurementGroup measurementGroup, final int index) { return SchemaRegionWritePlanFactory.getCreateTimeSeriesPlan( devicePath.concatAsMeasurementPath(measurementGroup.getMeasurements().get(index)), measurementGroup.getDataTypes().get(index), diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/impl/SchemaRegionMemoryImpl.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/impl/SchemaRegionMemoryImpl.java index 2b49792fbc34..5ae3e025ac38 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/impl/SchemaRegionMemoryImpl.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/impl/SchemaRegionMemoryImpl.java @@ -49,6 +49,8 @@ import org.apache.iotdb.db.queryengine.execution.relational.ColumnTransformerBuilder; import org.apache.iotdb.db.queryengine.plan.analyze.TypeProvider; import org.apache.iotdb.db.queryengine.plan.planner.LocalExecutionPlanner; +import org.apache.iotdb.db.queryengine.plan.planner.plan.node.metadata.write.CreateAlignedTimeSeriesNode; +import org.apache.iotdb.db.queryengine.plan.planner.plan.node.metadata.write.CreateTimeSeriesNode; import org.apache.iotdb.db.queryengine.plan.planner.plan.parameter.InputLocation; import org.apache.iotdb.db.queryengine.plan.relational.metadata.Metadata; import org.apache.iotdb.db.queryengine.plan.relational.metadata.fetcher.cache.TableDeviceSchemaCache; @@ -677,8 +679,10 @@ public void createTimeSeries(final ICreateTimeSeriesPlan plan, long offset) plan.getCompressor(), plan.getProps(), plan.getAlias(), - (plan instanceof CreateTimeSeriesPlanImpl - && ((CreateTimeSeriesPlanImpl) plan).isWithMerge())); + plan instanceof CreateTimeSeriesPlanImpl + && ((CreateTimeSeriesPlanImpl) plan).isWithMerge() + || plan instanceof CreateTimeSeriesNode + && ((CreateTimeSeriesNode) plan).isGeneratedByPipe()); // Should merge if (Objects.isNull(leafMNode)) { @@ -760,8 +764,10 @@ public void createAlignedTimeSeries(final ICreateAlignedTimeSeriesPlan plan) encodings, compressors, aliasList, - (plan instanceof CreateAlignedTimeSeriesPlanImpl - && ((CreateAlignedTimeSeriesPlanImpl) plan).isWithMerge()), + plan instanceof CreateAlignedTimeSeriesPlanImpl + && ((CreateAlignedTimeSeriesPlanImpl) plan).isWithMerge() + || plan instanceof CreateAlignedTimeSeriesNode + && ((CreateAlignedTimeSeriesNode) plan).isGeneratedByPipe(), existingMeasurementIndexes); // update statistics and schemaDataTypeNumMap