in cassandra-bridge/src/main/java/org/apache/cassandra/spark/data/CqlTable.java [71:110]
public CqlTable(@NotNull String keyspace,
@NotNull String table,
@NotNull String createStatement,
@NotNull ReplicationFactor replicationFactor,
@NotNull List<CqlField> fields,
@NotNull Set<CqlField.CqlUdt> udts,
int indexCount)
{
this.keyspace = keyspace;
this.table = table;
this.createStatement = createStatement;
this.replicationFactor = replicationFactor;
this.fields = fields.stream().sorted().collect(Collectors.toList());
this.fieldsMap = this.fields.stream().collect(Collectors.toMap(CqlField::name, Function.identity()));
this.partitionKeys = this.fields.stream().filter(CqlField::isPartitionKey).sorted().collect(Collectors.toList());
this.clusteringKeys = this.fields.stream().filter(CqlField::isClusteringColumn).sorted().collect(Collectors.toList());
this.staticColumns = this.fields.stream().filter(CqlField::isStaticColumn).sorted().collect(Collectors.toList());
this.valueColumns = this.fields.stream().filter(CqlField::isValueColumn).sorted().collect(Collectors.toList());
this.udts = Collections.unmodifiableSet(udts);
this.indexCount = indexCount;
// We use a linked hashmap to guarantee ordering of a 'SELECT * FROM ...'
this.columns = new LinkedHashMap<>();
for (CqlField column : partitionKeys)
{
columns.put(column.name(), column);
}
for (CqlField column : clusteringKeys)
{
columns.put(column.name(), column);
}
for (CqlField column : staticColumns)
{
columns.put(column.name(), column);
}
for (CqlField column : valueColumns)
{
columns.put(column.name(), column);
}
}