@@ -50,7 +50,7 @@ public int compare(ColumnMetadata c1, ColumnMetadata c2) {
5050 private final KeyspaceMetadata keyspace ;
5151 private final String name ;
5252 private final List <ColumnMetadata > partitionKey ;
53- private final List <ColumnMetadata > clusteringKey ;
53+ private final List <ColumnMetadata > clusteringColumns ;
5454 private final Map <String , ColumnMetadata > columns ;
5555 private final Options options ;
5656 private final List <Order > clusteringOrder ;
@@ -74,14 +74,14 @@ public boolean apply(Order o) {
7474 private TableMetadata (KeyspaceMetadata keyspace ,
7575 String name ,
7676 List <ColumnMetadata > partitionKey ,
77- List <ColumnMetadata > clusteringKey ,
77+ List <ColumnMetadata > clusteringColumns ,
7878 LinkedHashMap <String , ColumnMetadata > columns ,
7979 Options options ,
8080 List <Order > clusteringOrder ) {
8181 this .keyspace = keyspace ;
8282 this .name = name ;
8383 this .partitionKey = partitionKey ;
84- this .clusteringKey = clusteringKey ;
84+ this .clusteringColumns = clusteringColumns ;
8585 this .columns = columns ;
8686 this .options = options ;
8787 this .clusteringOrder = clusteringOrder ;
@@ -99,12 +99,12 @@ static TableMetadata build(KeyspaceMetadata ksm, Row row, Map<String, ColumnMeta
9999 boolean isCompact = isDense || !comparator .isComposite ;
100100
101101 List <ColumnMetadata > partitionKey = nullInitializedList (keyValidator .types .size ());
102- List <ColumnMetadata > clusteringKey = nullInitializedList (clusteringSize );
102+ List <ColumnMetadata > clusteringColumns = nullInitializedList (clusteringSize );
103103 List <Order > clusteringOrder = nullInitializedList (clusteringSize );
104104 // We use a linked hashmap because we will keep this in the order of a 'SELECT * FROM ...'.
105105 LinkedHashMap <String , ColumnMetadata > columns = new LinkedHashMap <String , ColumnMetadata >();
106106
107- TableMetadata tm = new TableMetadata (ksm , name , partitionKey , clusteringKey , columns , new Options (row , isCompact ), clusteringOrder );
107+ TableMetadata tm = new TableMetadata (ksm , name , partitionKey , clusteringColumns , columns , new Options (row , isCompact ), clusteringOrder );
108108
109109 // We use this temporary set just so non PK columns are added in lexicographical order, which is the one of a
110110 // 'SELECT * FROM ...'
@@ -116,16 +116,16 @@ static TableMetadata build(KeyspaceMetadata ksm, Row row, Map<String, ColumnMeta
116116 case PARTITION_KEY :
117117 partitionKey .set (rawCol .componentIndex , col );
118118 break ;
119- case CLUSTERING_KEY :
120- clusteringKey .set (rawCol .componentIndex , col );
119+ case CLUSTERING_COLUMN :
120+ clusteringColumns .set (rawCol .componentIndex , col );
121121 clusteringOrder .set (rawCol .componentIndex , rawCol .isReversed ? Order .DESC : Order .ASC );
122122 break ;
123123 }
124124 }
125125
126126 for (ColumnMetadata c : partitionKey )
127127 columns .put (c .getName (), c );
128- for (ColumnMetadata c : clusteringKey )
128+ for (ColumnMetadata c : clusteringColumns )
129129 columns .put (c .getName (), c );
130130 for (ColumnMetadata c : otherColumns )
131131 columns .put (c .getName (), c );
@@ -137,7 +137,7 @@ static TableMetadata build(KeyspaceMetadata ksm, Row row, Map<String, ColumnMeta
137137 private static int findClusteringSize (Collection <ColumnMetadata .Raw > cols ) {
138138 int maxId = -1 ;
139139 for (ColumnMetadata .Raw col : cols )
140- if (col .kind == ColumnMetadata .Raw .Kind .CLUSTERING_KEY )
140+ if (col .kind == ColumnMetadata .Raw .Kind .CLUSTERING_COLUMN )
141141 maxId = Math .max (maxId , col .componentIndex );
142142 return maxId + 1 ;
143143 }
@@ -184,7 +184,7 @@ public ColumnMetadata getColumn(String name) {
184184 * The order of the columns in the list is consistent with
185185 * the order of the columns returned by a {@code SELECT * FROM thisTable}:
186186 * the first column is the partition key, next are the clustering
187- * keys in their defined order, and then the rest of the
187+ * columns in their defined order, and then the rest of the
188188 * columns follow in alphabetic order.
189189 *
190190 * @return a list containing the metadata for the columns of this table.
@@ -203,9 +203,9 @@ public List<ColumnMetadata> getColumns() {
203203 * @return the list of columns composing the primary key for this table.
204204 */
205205 public List <ColumnMetadata > getPrimaryKey () {
206- List <ColumnMetadata > pk = new ArrayList <ColumnMetadata >(partitionKey .size () + clusteringKey .size ());
206+ List <ColumnMetadata > pk = new ArrayList <ColumnMetadata >(partitionKey .size () + clusteringColumns .size ());
207207 pk .addAll (partitionKey );
208- pk .addAll (clusteringKey );
208+ pk .addAll (clusteringColumns );
209209 return pk ;
210210 }
211211
@@ -222,26 +222,26 @@ public List<ColumnMetadata> getPartitionKey() {
222222 }
223223
224224 /**
225- * Returns the list of columns composing the clustering key for this table.
225+ * Returns the list of clustering columns for this table.
226226 *
227- * @return the list of columns composing the clustering key for this table.
228- * If the clustering key is empty , an empty list is returned.
227+ * @return the list of clustering columns for this table.
228+ * If there is no clustering columns , an empty list is returned.
229229 */
230- public List <ColumnMetadata > getClusteringKey () {
231- return Collections .unmodifiableList (clusteringKey );
230+ public List <ColumnMetadata > getClusteringColumns () {
231+ return Collections .unmodifiableList (clusteringColumns );
232232 }
233233
234234 /**
235235 * Returns the clustering order for this table.
236236 * <p>
237- * The returned contains the cluster order of each clustering key . The
237+ * The returned contains the clustering order of each clustering column . The
238238 * {@code i}th element of the result correspond to the order (ascending or
239- * descending) of the {@code i}th clustering key (see
240- * {@link #getClusteringKey }). Note that a table defined without any
239+ * descending) of the {@code i}th clustering column (see
240+ * {@link #getClusteringColumns }). Note that a table defined without any
241241 * particular clustering order is equivalent to one for which all the
242242 * clustering key are in ascending order.
243243 *
244- * @return a list with the clustering order for each clustering key .
244+ * @return a list with the clustering order for each clustering column .
245245 */
246246 public List <Order > getClusteringOrder () {
247247 return clusteringOrder ;
@@ -346,7 +346,7 @@ private String asCQLQuery(boolean formatted) {
346346 }
347347 sb .append (")" );
348348 }
349- for (ColumnMetadata cm : clusteringKey )
349+ for (ColumnMetadata cm : clusteringColumns )
350350 sb .append (", " ).append (escapeId (cm .getName ()));
351351 sb .append (")" );
352352 newLine (sb , formatted );
@@ -373,12 +373,11 @@ private String asCQLQuery(boolean formatted) {
373373 return sb .toString ();
374374 }
375375
376- private StringBuilder appendClusteringOrder (StringBuilder sb )
377- {
376+ private StringBuilder appendClusteringOrder (StringBuilder sb ) {
378377 sb .append ("CLUSTERING ORDER BY (" );
379- for (int i = 0 ; i < clusteringKey .size (); i ++) {
378+ for (int i = 0 ; i < clusteringColumns .size (); i ++) {
380379 if (i > 0 ) sb .append (", " );
381- sb .append (clusteringKey .get (i ).getName ()).append (" " ).append (clusteringOrder .get (i ));
380+ sb .append (clusteringColumns .get (i ).getName ()).append (" " ).append (clusteringOrder .get (i ));
382381 }
383382 return sb .append (")" );
384383 }
0 commit comments