public void validate(List<Expression> sourceColumns) {
    boolean isAllRawSeriesQuery = checkIsAllRawSeriesQuery(sourceColumns);

    if (!isAllRawSeriesQuery) {
      if (isDeviceExistPlaceholder() || isMeasurementsExistPlaceholder()) {
        throw new SemanticException(FORBID_PLACEHOLDER_ERROR_MSG);
      }
    }

    if (isMeasurementsExistPlaceholder()) {
      for (IntoItem intoItem : intoItems) {
        if (intoItem.getIntoMeasurements().size() != 1) {
          throw new SemanticException(PLACEHOLDER_MISMATCH_ERROR_MSG);
        }
      }

      if (isDeviceExistPlaceholder()) {
        if (intoItems.size() != 1) {
          throw new SemanticException(PLACEHOLDER_MISMATCH_ERROR_MSG);
        }
      } else {
        if (intoItems.size() != 1 && intoItems.size() != sourceColumns.size()) {
          throw new SemanticException(PLACEHOLDER_MISMATCH_ERROR_MSG);
        }
      }
    } else {
      int intoPathsNum =
          intoItems.stream().mapToInt(item -> item.getIntoMeasurements().size()).sum();
      if (intoPathsNum != sourceColumns.size()) {
        throw new SemanticException(PATH_NUM_MISMATCH_ERROR_MSG);
      }
    }
  }
This class maintains information of {@code INTO} clause.
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/statement/component/IntoComponent.java