Skip to content

Commit

Permalink
fix: Update code
Browse files Browse the repository at this point in the history
  • Loading branch information
larshelge committed Dec 16, 2024
1 parent 604469b commit 791ec72
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ public void swapTable(AnalyticsTableUpdateParams params, AnalyticsTable table) {

List<Table> swapPartitions = new UniqueArrayList<>();
table.getTablePartitions().stream()
.forEach(p -> swapPartitions.add(swapTable(p, p.getMainName())));
.forEach(partition -> swapPartitions.add(swapTable(partition, partition.getMainName())));

if (!skipMasterTable) {
swapTable(table, table.getMainName());
Expand Down Expand Up @@ -296,7 +296,7 @@ private Table swapTable(Table stagingTable, String mainTableName) {
executeSilently(sqlBuilder.dropTableIfExistsCascade(mainTableName));
executeSilently(sqlBuilder.renameTable(stagingTable, mainTableName));
}
return stagingTable.swapFromStaging();
return stagingTable.fromStaging();
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ void testSwapTable() {

when(jdbcTemplate.queryForList(any())).thenReturn(List.of(Map.of("table_name", "analytic")));

Table swappedPartition = table.getTablePartitions().get(0).swapFromStaging();
Table swappedPartition = table.getTablePartitions().get(0).fromStaging();
subject.swapTable(params, table);
assertEquals("analytics_2023_temp", table.getTablePartitions().get(0).getName());
assertEquals("analytics_2023", swappedPartition.getName());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ public boolean hasPartitions() {
return isNotEmpty(partitions);
}

public Table swapFromStaging() {
public Table fromStaging() {
return new Table(
fromStaging(this.getName()),
this.getColumns(),
Expand Down

0 comments on commit 791ec72

Please sign in to comment.