private static CFMetaData newCFMetaData(String ksname, String cfname) {
   CFMetaData metadata =
       CFMetaData.Builder.create(ksname, cfname)
           .addPartitionKey("key", UTF8Type.instance)
           .addClusteringColumn("col", UTF8Type.instance)
           .addRegularColumn("value", UTF8Type.instance)
           .withPartitioner(Murmur3Partitioner.instance)
           .build();
   metadata.caching(CachingParams.CACHE_NOTHING);
   return metadata;
 }
  /**
   * Construct table schema from info stored in SSTable's Stats.db
   *
   * @param desc SSTable's descriptor
   * @return Restored CFMetaData
   * @throws IOException when Stats.db cannot be read
   */
  public static CFMetaData metadataFromSSTable(Descriptor desc) throws IOException {
    if (!desc.version.storeRows()) throw new IOException("pre-3.0 SSTable is not supported.");

    EnumSet<MetadataType> types =
        EnumSet.of(MetadataType.VALIDATION, MetadataType.STATS, MetadataType.HEADER);
    Map<MetadataType, MetadataComponent> sstableMetadata =
        desc.getMetadataSerializer().deserialize(desc, types);
    ValidationMetadata validationMetadata =
        (ValidationMetadata) sstableMetadata.get(MetadataType.VALIDATION);
    SerializationHeader.Component header =
        (SerializationHeader.Component) sstableMetadata.get(MetadataType.HEADER);

    IPartitioner partitioner =
        SecondaryIndexManager.isIndexColumnFamily(desc.cfname)
            ? new LocalPartitioner(header.getKeyType())
            : FBUtilities.newPartitioner(validationMetadata.partitioner);

    CFMetaData.Builder builder =
        CFMetaData.Builder.create("keyspace", "table").withPartitioner(partitioner);
    header
        .getStaticColumns()
        .entrySet()
        .stream()
        .forEach(
            entry -> {
              ColumnIdentifier ident =
                  ColumnIdentifier.getInterned(UTF8Type.instance.getString(entry.getKey()), true);
              builder.addStaticColumn(ident, entry.getValue());
            });
    header
        .getRegularColumns()
        .entrySet()
        .stream()
        .forEach(
            entry -> {
              ColumnIdentifier ident =
                  ColumnIdentifier.getInterned(UTF8Type.instance.getString(entry.getKey()), true);
              builder.addRegularColumn(ident, entry.getValue());
            });
    builder.addPartitionKey("PartitionKey", header.getKeyType());
    for (int i = 0; i < header.getClusteringTypes().size(); i++) {
      builder.addClusteringColumn(
          "clustering" + (i > 0 ? i : ""), header.getClusteringTypes().get(i));
    }
    return builder.build();
  }