public static TableSpec make()

in spark-job/src/main/java/org/apache/cassandra/diff/TableSpec.java [71:89]


    public static TableSpec make(KeyspaceTablePair keyspaceTablePair, DiffCluster diffCluster) {
        final Cluster cluster = diffCluster.cluster;

        final String cqlizedKeyspace = cqlizedString(keyspaceTablePair.keyspace);
        final String cqlizedTable = cqlizedString(keyspaceTablePair.table);

        KeyspaceMetadata ksMetadata = cluster.getMetadata().getKeyspace(cqlizedKeyspace);
        if (ksMetadata == null) {
            throw new IllegalArgumentException(String.format("Keyspace %s not found in %s cluster", keyspaceTablePair.keyspace, diffCluster.clusterId));
        }

        TableMetadata tableMetadata = ksMetadata.getTable(cqlizedTable);
        List<ColumnMetadata> clusteringColumns = tableMetadata.getClusteringColumns();
        List<ColumnMetadata> regularColumns = tableMetadata.getColumns()
                                                           .stream()
                                                           .filter(c -> !(clusteringColumns.contains(c)))
                                                           .collect(Collectors.toList());
        return new TableSpec(KeyspaceTablePair.from(tableMetadata), clusteringColumns, regularColumns);
    }