Your Dataset will still have the same length and store all samples, if they were loaded in its __init__ method. The sampler makes sure, that the DataLoader just loads the data samples from the provided indices.
You could alternatively wrap your Dataset in a Subset, which will also change the length of the dataset.