@@ -61,14 +61,15 @@ public void check(Get get) throws ExecutionException {
6161 String name = get .getPartitionKey ().getColumns ().get (0 ).getName ();
6262 if (!metadata .getSecondaryIndexNames ().contains (name )) {
6363 throw new IllegalArgumentException (
64- CoreError .OPERATION_CHECK_ERROR_INDEX_NON_INDEXED_COLUMN_SPECIFIED .buildMessage (get ));
64+ CoreError .OPERATION_CHECK_ERROR_INDEX_NON_INDEXED_COLUMN_SPECIFIED .buildMessage (
65+ get , metadata ));
6566 }
6667
6768 if (!new ColumnChecker (metadata , true , false , false , false )
6869 .check (get .getPartitionKey ().getColumns ().get (0 ))) {
6970 throw new IllegalArgumentException (
7071 CoreError .OPERATION_CHECK_ERROR_INDEX_INDEX_KEY_NOT_PROPERLY_SPECIFIED .buildMessage (
71- get ));
72+ get , metadata ));
7273 }
7374
7475 // The following check is not needed when we use GetWithIndex. But we need to keep it for
@@ -105,14 +106,15 @@ public void check(Scan scan) throws ExecutionException {
105106 String name = scan .getPartitionKey ().getColumns ().get (0 ).getName ();
106107 if (!metadata .getSecondaryIndexNames ().contains (name )) {
107108 throw new IllegalArgumentException (
108- CoreError .OPERATION_CHECK_ERROR_INDEX_NON_INDEXED_COLUMN_SPECIFIED .buildMessage (scan ));
109+ CoreError .OPERATION_CHECK_ERROR_INDEX_NON_INDEXED_COLUMN_SPECIFIED .buildMessage (
110+ scan , metadata ));
109111 }
110112
111113 if (!new ColumnChecker (metadata , true , false , false , false )
112114 .check (scan .getPartitionKey ().getColumns ().get (0 ))) {
113115 throw new IllegalArgumentException (
114116 CoreError .OPERATION_CHECK_ERROR_INDEX_INDEX_KEY_NOT_PROPERLY_SPECIFIED .buildMessage (
115- scan ));
117+ scan , metadata ));
116118 }
117119
118120 // The following checks are not needed when we use ScanWithIndex. But we need to keep them for
@@ -172,7 +174,8 @@ private void checkProjections(Selection selection, TableMetadata metadata) {
172174 for (String projection : selection .getProjections ()) {
173175 if (!metadata .getColumnNames ().contains (projection )) {
174176 throw new IllegalArgumentException (
175- CoreError .OPERATION_CHECK_ERROR_PROJECTION .buildMessage (projection , selection ));
177+ CoreError .OPERATION_CHECK_ERROR_PROJECTION .buildMessage (
178+ projection , selection , metadata ));
176179 }
177180 }
178181 }
@@ -187,7 +190,8 @@ private void checkClusteringKeys(Scan scan, TableMetadata metadata) {
187190 Key startClusteringKey = scan .getStartClusteringKey ().get ();
188191 Key endClusteringKey = scan .getEndClusteringKey ().get ();
189192 Supplier <String > message =
190- () -> CoreError .OPERATION_CHECK_ERROR_CLUSTERING_KEY_BOUNDARY .buildMessage (scan );
193+ () ->
194+ CoreError .OPERATION_CHECK_ERROR_CLUSTERING_KEY_BOUNDARY .buildMessage (scan , metadata );
191195
192196 if (startClusteringKey .size () != endClusteringKey .size ()) {
193197 throw new IllegalArgumentException (message .get ());
@@ -209,7 +213,8 @@ private void checkStartClusteringKey(Scan scan, TableMetadata metadata) {
209213 ckey -> {
210214 if (!checkKey (ckey , metadata .getClusteringKeyNames (), true , metadata )) {
211215 throw new IllegalArgumentException (
212- CoreError .OPERATION_CHECK_ERROR_START_CLUSTERING_KEY .buildMessage (scan ));
216+ CoreError .OPERATION_CHECK_ERROR_START_CLUSTERING_KEY .buildMessage (
217+ scan , metadata ));
213218 }
214219 });
215220 }
@@ -220,7 +225,8 @@ private void checkEndClusteringKey(Scan scan, TableMetadata metadata) {
220225 ckey -> {
221226 if (!checkKey (ckey , metadata .getClusteringKeyNames (), true , metadata )) {
222227 throw new IllegalArgumentException (
223- CoreError .OPERATION_CHECK_ERROR_END_CLUSTERING_KEY .buildMessage (scan ));
228+ CoreError .OPERATION_CHECK_ERROR_END_CLUSTERING_KEY .buildMessage (
229+ scan , metadata ));
224230 }
225231 });
226232 }
@@ -232,7 +238,9 @@ private void checkOrderings(Scan scan, TableMetadata metadata) {
232238 }
233239
234240 Supplier <String > message =
235- () -> CoreError .OPERATION_CHECK_ERROR_ORDERING_NOT_PROPERLY_SPECIFIED .buildMessage (scan );
241+ () ->
242+ CoreError .OPERATION_CHECK_ERROR_ORDERING_NOT_PROPERLY_SPECIFIED .buildMessage (
243+ scan , metadata );
236244
237245 if (orderings .size () > metadata .getClusteringKeyNames ().size ()) {
238246 throw new IllegalArgumentException (message .get ());
@@ -263,7 +271,7 @@ protected void checkOrderingsForScanAll(ScanAll scanAll, TableMetadata metadata)
263271 if (!metadata .getColumnNames ().contains (ordering .getColumnName ())) {
264272 throw new IllegalArgumentException (
265273 CoreError .OPERATION_CHECK_ERROR_ORDERING_COLUMN_NOT_FOUND .buildMessage (
266- ordering , scanAll ));
274+ ordering , scanAll , metadata ));
267275 }
268276 }
269277 }
@@ -284,7 +292,7 @@ protected void checkConjunctions(Selection selection, TableMetadata metadata) {
284292 }
285293 if (!isValid ) {
286294 throw new IllegalArgumentException (
287- CoreError .OPERATION_CHECK_ERROR_CONDITION .buildMessage (selection ));
295+ CoreError .OPERATION_CHECK_ERROR_CONDITION .buildMessage (selection , metadata ));
288296 }
289297 }
290298 }
@@ -317,7 +325,7 @@ private void checkColumnsInPut(Put put, TableMetadata metadata) {
317325 for (Column <?> column : put .getColumns ().values ()) {
318326 if (!new ColumnChecker (metadata , false , false , false , true ).check (column )) {
319327 throw new IllegalArgumentException (
320- CoreError .OPERATION_CHECK_ERROR_INVALID_COLUMN .buildMessage (column , put ));
328+ CoreError .OPERATION_CHECK_ERROR_INVALID_COLUMN .buildMessage (column , put , metadata ));
321329 }
322330 }
323331 }
@@ -330,7 +338,7 @@ private void checkCondition(Mutation mutation, TableMetadata metadata) {
330338 c -> {
331339 if (!new ConditionChecker (metadata ).check (mutation .getCondition ().get (), isPut )) {
332340 throw new IllegalArgumentException (
333- CoreError .OPERATION_CHECK_ERROR_CONDITION .buildMessage (mutation ));
341+ CoreError .OPERATION_CHECK_ERROR_CONDITION .buildMessage (mutation , metadata ));
334342 }
335343 });
336344 }
@@ -378,17 +386,17 @@ private boolean isOutOfAtomicityUnit(
378386 if (!mutation1 .getClusteringKey ().equals (mutation2 .getClusteringKey ())) {
379387 return true ; // Different clustering keys
380388 }
381- // Fall through
389+ // Fall through
382390 case PARTITION :
383391 if (!mutation1 .getPartitionKey ().equals (mutation2 .getPartitionKey ())) {
384392 return true ; // Different partition keys
385393 }
386- // Fall through
394+ // Fall through
387395 case TABLE :
388396 if (!mutation1 .forTable ().equals (mutation2 .forTable ())) {
389397 return true ; // Different tables
390398 }
391- // Fall through
399+ // Fall through
392400 case NAMESPACE :
393401 if (!mutation1 .forNamespace ().equals (mutation2 .forNamespace ())) {
394402 return true ; // Different namespaces
@@ -447,13 +455,13 @@ private void checkPrimaryKey(Operation operation, TableMetadata metadata) {
447455 private void checkPartitionKey (Operation operation , TableMetadata metadata ) {
448456 if (!checkKey (operation .getPartitionKey (), metadata .getPartitionKeyNames (), false , metadata )) {
449457 throw new IllegalArgumentException (
450- CoreError .OPERATION_CHECK_ERROR_PARTITION_KEY .buildMessage (operation ));
458+ CoreError .OPERATION_CHECK_ERROR_PARTITION_KEY .buildMessage (operation , metadata ));
451459 }
452460 }
453461
454462 private void checkClusteringKey (Operation operation , TableMetadata metadata ) {
455463 Supplier <String > message =
456- () -> CoreError .OPERATION_CHECK_ERROR_CLUSTERING_KEY .buildMessage (operation );
464+ () -> CoreError .OPERATION_CHECK_ERROR_CLUSTERING_KEY .buildMessage (operation , metadata );
457465
458466 if (!metadata .getClusteringKeyNames ().isEmpty () && !operation .getClusteringKey ().isPresent ()) {
459467 throw new IllegalArgumentException (message .get ());
0 commit comments