Skip to content

Commit dc6b9f6

Browse files
committed
Remove ArrayList and simplify code
1 parent e55f7be commit dc6b9f6

File tree

4 files changed

+11
-11
lines changed

4 files changed

+11
-11
lines changed

table/src/main/java/tech/ydb/table/Session.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,10 +91,10 @@ CompletableFuture<Result<DataQueryResult>> executeDataQuery(
9191
CompletableFuture<Result<ExplainDataQueryResult>> explainDataQuery(String query, ExplainDataQuerySettings settings);
9292

9393
/**
94-
* Get global table options settings
94+
* Get table option settings
9595
*
9696
* @param settings settings
97-
* @return global table options settings
97+
* @return fully described options settings
9898
*/
9999
CompletableFuture<Result<TableOptionDescription>> describeTableOptions(DescribeTableOptionsSettings settings);
100100

@@ -233,7 +233,7 @@ default CompletableFuture<Status> executeBulkUpsert(String tablePath, ListValue
233233
}
234234

235235
/**
236-
* Get table option settings
236+
* Get table option settings with default {@link DescribeTableOptionsSettings}
237237
*
238238
* @return fully described options settings
239239
*/

table/src/main/java/tech/ydb/table/description/TableOptionDescription.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package tech.ydb.table.description;
22

3-
import java.util.ArrayList;
43
import java.util.List;
54
import java.util.Map;
65

@@ -80,7 +79,7 @@ public List<TableProfileDescription> getTableProfileDescriptions() {
8079
return tableProfileDescriptions;
8180
}
8281

83-
public void setTableProfileDescriptions(ArrayList<TableProfileDescription> tableProfileDescriptions) {
82+
public void setTableProfileDescriptions(List<TableProfileDescription> tableProfileDescriptions) {
8483
this.tableProfileDescriptions = tableProfileDescriptions;
8584
}
8685

table/src/main/java/tech/ydb/table/impl/BaseSession.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -924,13 +924,14 @@ private static Result<TableOptionDescription> mapDescribeTableOptions(
924924

925925
TableOptionDescription.Builder builder = TableOptionDescription.newBuilder();
926926

927-
builder.setTableProfileDescriptions(new ArrayList<>());
927+
List<TableOptionDescription.TableProfileDescription> tableProfileDescriptions = new ArrayList<>();
928+
builder.setTableProfileDescriptions(tableProfileDescriptions);
928929
for (YdbTable.TableProfileDescription tableProfileDescription : describeResult.getTableProfilePresetsList()) {
929930
TableOptionDescription.TableProfileDescription.Builder descBuilder =
930931
getDescBuilder(tableProfileDescription);
931932

932933
TableOptionDescription.TableProfileDescription description = descBuilder.build();
933-
builder.getTableProfileDescriptions().add(description);
934+
tableProfileDescriptions.add(description);
934935
}
935936

936937
List<TableOptionDescription.StoragePolicyDescription> storagePolicyDescription = new ArrayList<>();

table/src/test/java/tech/ydb/table/integration/TableOptionTest.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public class TableOptionTest {
3838
private final SessionRetryContext ctx = SessionRetryContext.create(tableClient).build();
3939

4040
/**
41-
* Test checks that call to describe table options works with the default settings
41+
* The test checks that the call to describe table options works with the default settings.
4242
*/
4343
@Test
4444
public void tableOptionsTestShouldGetGlobalOptionsWithDefaultSettings() {
@@ -52,7 +52,7 @@ public void tableOptionsTestShouldGetGlobalOptionsWithDefaultSettings() {
5252
}
5353

5454
/**
55-
* Test checks that call to describe table options works with all set options
55+
* The test checks that the call to describe table options works with all set options
5656
*/
5757
@Test
5858
public void tableOptionsTestShouldGetGlobalOptions() {
@@ -72,8 +72,8 @@ public void tableOptionsTestShouldGetGlobalOptions() {
7272
}
7373

7474
/**
75-
* Test checks that call to describe table options fails when we set client timeout as low as possible
76-
* and request can't be completed in this time.
75+
* The test checks that the call to describe table options fails when we set the client timeout as low as possible.
76+
* and the request can't be completed in this time.
7777
* We should catch StatusCode == CLIENT_DEADLINE_EXPIRED
7878
*/
7979
@Test

0 commit comments

Comments
 (0)