jt2594838 commented on code in PR #16720:
URL: https://github.com/apache/iotdb/pull/16720#discussion_r2517630282


##########
iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/table/TsTable.java:
##########
@@ -362,6 +386,33 @@ public void setProps(Map<String, String> props) {
     }
   }
 
+  public void checkTableNameAndObjectNames4Object() throws MetadataException {
+    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());
+      }
+    }

Review Comment:
   Column name shall not occur, only column value will



##########
iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/schema/table/AddTableColumnProcedure.java:
##########
@@ -123,7 +139,52 @@ protected void columnCheck(final ConfigNodeProcedureEnv 
env) {
   @Override
   protected void preRelease(final ConfigNodeProcedureEnv env) {
     super.preRelease(env);
-    setNextState(AddTableColumnState.ADD_COLUMN);
+  }
+
+  private void checkObject(
+      final ConfigNodeProcedureEnv env, final String database, final String 
tableName) {
+    final Map<TConsensusGroupId, TRegionReplicaSet> relatedRegionGroup =
+        
env.getConfigManager().getRelatedSchemaRegionGroup4TableModel(database);
+
+    if (!relatedRegionGroup.isEmpty()) {
+      new TableRegionTaskExecutor<>(
+              "check deviceId for object",
+              env,
+              relatedRegionGroup,
+              CnToDnAsyncRequestType.CHECK_DEVICE_ID_FOR_OBJECT,
+              ((dataNodeLocation, consensusGroupIdList) ->
+                  new TCheckDeviceIdForObjectReq(new 
ArrayList<>(consensusGroupIdList), tableName)),
+              ((tConsensusGroupId, tDataNodeLocations, failureMap) -> {
+                final String message = parseStatus(failureMap.values());
+                // Shall not be SUCCESS here
+                return Objects.nonNull(message)
+                    ? new IoTDBException(message, 
TSStatusCode.SEMANTIC_ERROR.getStatusCode())
+                    : null;
+              }))
+          .execute();
+    }
+  }

Review Comment:
   You can do this during schema validation of insertion. No need to do so in 
adding columns.
   If an existing device will not be inserted with object data, you do not have 
to fail the column addition.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to