@Override
  public Statement visitCreateModel(IoTDBSqlParser.CreateModelContext ctx) {
    if (ctx.modelName == null) {
      String modelId = ctx.modelId.getText();
      String modelType = ctx.modelType.getText();
      CreateTrainingStatement createTrainingStatement =
          new CreateTrainingStatement(modelId, modelType);
      if (ctx.hparamPair() != null) {
        Map<String, String> parameterList = new HashMap<>();
        for (IoTDBSqlParser.HparamPairContext hparamPairContext : ctx.hparamPair()) {
          parameterList.put(
              hparamPairContext.hparamKey.getText(), hparamPairContext.hparamValue().getText());
        }
        createTrainingStatement.setParameters(parameterList);
      }

      if (ctx.existingModelId != null) {
        createTrainingStatement.setExistingModelId(ctx.existingModelId.getText());
      }

      if (ctx.trainingData() == null) {
        throw new UnsupportedOperationException("data should not be set for model training");
      }

      List<PartialPath> targetPath = new ArrayList<>();
      List<List<Long>> timeRanges = new ArrayList<>();
      for (IoTDBSqlParser.DataElementContext dataElementContext :
          ctx.trainingData().dataElement()) {
        if (dataElementContext.timeRange() != null) {
          long currentTime = CommonDateTimeUtils.currentTime();
          long startTime = parseTimeValue(dataElementContext.timeRange().timeValue(0), currentTime);
          long endTime = parseTimeValue(dataElementContext.timeRange().timeValue(1), currentTime);
          timeRanges.add(Arrays.asList(startTime, endTime));
        } else {
          timeRanges.add(Collections.emptyList());
        }
        targetPath.add(parsePrefixPath(dataElementContext.pathPatternElement().prefixPath()));
      }
      createTrainingStatement.setTargetTimeRanges(timeRanges);
      createTrainingStatement.setTargetPathPatterns(targetPath);
      return createTrainingStatement;
    }
    String modelName = ctx.modelName.getText();
    validateModelName(modelName);
    CreateModelStatement createModelStatement = new CreateModelStatement();
    createModelStatement.setModelName(parseIdentifier(modelName));
    createModelStatement.setUri(parseAndValidateURI(ctx.uriClause()));
    return createModelStatement;
  }
Check and set datatype, encoding, compressor.

@throws SemanticException if encoding or dataType meets error handling
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/parser/ASTVisitor.java