@Override
    public long historyRetention() {
        if (!(materialized.storeSupplier() instanceof VersionedBytesStoreSupplier)) {
            throw new IllegalStateException(
                    "historyRetention is not supported when not a versioned store");
        }
        return ((VersionedBytesStoreSupplier) materialized.storeSupplier()).historyRetentionMs();
    }
Materializes a key-value store as either a {@link TimestampedKeyValueStoreBuilder} or a
{@link VersionedKeyValueStoreBuilder} depending on whether the store is versioned or not.
streams/src/main/java/org/apache/kafka/streams/kstream/internals/KeyValueStoreMaterializer.java