Skip to content

Commit 1426f84

Browse files
committed
Fix
1 parent 2825605 commit 1426f84

File tree

5 files changed

+15
-14
lines changed

5 files changed

+15
-14
lines changed

core/src/main/java/com/scalar/db/storage/dynamo/SelectStatementHandler.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -326,8 +326,9 @@ private boolean setConditions(
326326

327327
private Key getKeyWithoutLastValue(Key originalKey) {
328328
Key.Builder keyBuilder = Key.newBuilder();
329-
for (int i = 0; i < originalKey.getColumns().size() - 1; i++) {
330-
keyBuilder.add(originalKey.getColumns().get(i));
329+
List<Column<?>> columns = originalKey.getColumns();
330+
for (int i = 0; i < columns.size() - 1; i++) {
331+
keyBuilder.add(columns.get(i));
331332
}
332333
return keyBuilder.build();
333334
}

core/src/test/java/com/scalar/db/common/ResultImplTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -539,7 +539,7 @@ public void getPartitionKey_RequiredValuesGiven_ShouldReturnPartitionKey() {
539539

540540
// Assert
541541
assertThat(key.isPresent()).isTrue();
542-
assertThat(key.get().getColumns().size()).isEqualTo(1);
542+
assertThat(key.get().size()).isEqualTo(1);
543543
assertThat(key.get().getColumns().get(0)).isEqualTo(TextColumn.of(ANY_NAME_1, ANY_TEXT_1));
544544
}
545545

@@ -570,7 +570,7 @@ public void getClusteringKey_RequiredValuesGiven_ShouldReturnClusteringKey() {
570570

571571
// Assert
572572
assertThat(key.isPresent()).isTrue();
573-
assertThat(key.get().getColumns().size()).isEqualTo(1);
573+
assertThat(key.get().size()).isEqualTo(1);
574574
assertThat(key.get().getColumns().get(0)).isEqualTo(TextColumn.of(ANY_NAME_2, ANY_TEXT_2));
575575
}
576576

core/src/test/java/com/scalar/db/transaction/consensuscommit/FilteredResultTest.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -94,12 +94,12 @@ public void withoutProjections_ShouldFilterOutTransactionMetaColumns() {
9494

9595
// Act Assert
9696
assertThat(filteredResult.getPartitionKey()).isPresent();
97-
assertThat(filteredResult.getPartitionKey().get().getColumns().size()).isEqualTo(1);
97+
assertThat(filteredResult.getPartitionKey().get().size()).isEqualTo(1);
9898
assertThat(filteredResult.getPartitionKey().get().getColumns().get(0))
9999
.isEqualTo(ACCOUNT_ID_VALUE);
100100

101101
assertThat(filteredResult.getClusteringKey()).isPresent();
102-
assertThat(filteredResult.getClusteringKey().get().getColumns().size()).isEqualTo(1);
102+
assertThat(filteredResult.getClusteringKey().get().size()).isEqualTo(1);
103103
assertThat(filteredResult.getClusteringKey().get().getColumns().get(0))
104104
.isEqualTo(ACCOUNT_TYPE_VALUE);
105105

@@ -164,7 +164,7 @@ public void withoutProjectionsAndIncludeMetadataEnabled_ShouldContainAllColumns(
164164

165165
// Act Assert
166166
assertThat(filteredResult.getPartitionKey()).isPresent();
167-
assertThat(filteredResult.getPartitionKey().get().getColumns().size()).isEqualTo(1);
167+
assertThat(filteredResult.getPartitionKey().get().size()).isEqualTo(1);
168168
assertThat(filteredResult.getPartitionKey().get().getColumns().get(0))
169169
.isEqualTo(ACCOUNT_ID_VALUE);
170170

@@ -316,7 +316,7 @@ public void withProjections_ShouldFilterOutUnprojectedColumnsAndTransactionMetaC
316316

317317
// Act Assert
318318
assertThat(filteredResult.getPartitionKey()).isPresent();
319-
assertThat(filteredResult.getPartitionKey().get().getColumns().size()).isEqualTo(1);
319+
assertThat(filteredResult.getPartitionKey().get().size()).isEqualTo(1);
320320
assertThat(filteredResult.getPartitionKey().get().getColumns().get(0))
321321
.isEqualTo(ACCOUNT_ID_VALUE);
322322

@@ -384,7 +384,7 @@ public void withProjectionsAndIncludeMetadataEnabled_ShouldNotIncludeNonProjecte
384384

385385
// Act Assert
386386
assertThat(filteredResult.getPartitionKey()).isPresent();
387-
assertThat(filteredResult.getPartitionKey().get().getColumns().size()).isEqualTo(1);
387+
assertThat(filteredResult.getPartitionKey().get().size()).isEqualTo(1);
388388
assertThat(filteredResult.getPartitionKey().get().getColumns().get(0))
389389
.isEqualTo(ACCOUNT_ID_VALUE);
390390

@@ -462,7 +462,7 @@ public void withProjectionsAndIncludeMetadataEnabled_ShouldNotIncludeNonProjecte
462462

463463
// Act Assert
464464
assertThat(filteredResult.getPartitionKey()).isPresent();
465-
assertThat(filteredResult.getPartitionKey().get().getColumns().size()).isEqualTo(1);
465+
assertThat(filteredResult.getPartitionKey().get().size()).isEqualTo(1);
466466
assertThat(filteredResult.getPartitionKey().get().getColumns().get(0))
467467
.isEqualTo(ACCOUNT_ID_VALUE);
468468

@@ -524,7 +524,7 @@ public void withProjectionsAndIncludeMetadataEnabled_ShouldNotIncludeNonProjecte
524524
.isInstanceOf(IllegalStateException.class);
525525

526526
assertThat(filteredResult.getClusteringKey()).isPresent();
527-
assertThat(filteredResult.getClusteringKey().get().getColumns().size()).isEqualTo(1);
527+
assertThat(filteredResult.getClusteringKey().get().size()).isEqualTo(1);
528528
assertThat(filteredResult.getClusteringKey().get().getColumns().get(0))
529529
.isEqualTo(ACCOUNT_TYPE_VALUE);
530530

core/src/test/java/com/scalar/db/util/ScalarDbUtilsTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -554,7 +554,7 @@ public void getPartitionKey_ShouldReturnPartitionKey() {
554554
Key actual = ScalarDbUtils.getPartitionKey(result, tableMetadata);
555555

556556
// Assert
557-
assertThat(actual.getColumns().size()).isEqualTo(2);
557+
assertThat(actual.size()).isEqualTo(2);
558558
assertThat(actual.getColumns().get(0)).isInstanceOf(TextColumn.class);
559559
assertThat(actual.getColumns().get(0).getName()).isEqualTo("c1");
560560
assertThat(actual.getColumns().get(0).getTextValue()).isEqualTo("v1");
@@ -594,7 +594,7 @@ public void getClusteringKey_ShouldReturnClusteringKey() {
594594

595595
// Assert
596596
assertThat(actual).isPresent();
597-
assertThat(actual.get().getColumns().size()).isEqualTo(2);
597+
assertThat(actual.get().size()).isEqualTo(2);
598598
assertThat(actual.get().getColumns().get(0)).isInstanceOf(IntColumn.class);
599599
assertThat(actual.get().getColumns().get(0).getName()).isEqualTo("c3");
600600
assertThat(actual.get().getColumns().get(0).getIntValue()).isEqualTo(3);

data-loader/core/src/main/java/com/scalar/db/dataloader/core/dataexport/validation/ExportOptionsValidator.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ private static void validatePartitionKey(LinkedHashSet<String> partitionKeyNames
5959
}
6060

6161
// Make sure that all partition key columns are provided
62-
if (partitionKeyNames.size() != key.getColumns().size()) {
62+
if (partitionKeyNames.size() != key.size()) {
6363
throw new ExportOptionsValidationException(
6464
DataLoaderError.INCOMPLETE_PARTITION_KEY.buildMessage(partitionKeyNames));
6565
}

0 commit comments

Comments
 (0)