Skip to content

Commit 3b54ac9

Browse files
committed
Use List for tables
1 parent 03bf458 commit 3b54ac9

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

gateway-ha/src/main/java/io/trino/gateway/ha/router/TrinoQueryProperties.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@
6969
import java.io.IOException;
7070
import java.net.URLDecoder;
7171
import java.util.ArrayList;
72-
import java.util.Arrays;
7372
import java.util.Enumeration;
7473
import java.util.List;
7574
import java.util.Map;
@@ -113,7 +112,7 @@ public TrinoQueryProperties(
113112
@JsonProperty("body") String body,
114113
@JsonProperty("queryType") String queryType,
115114
@JsonProperty("resourceGroupQueryType") String resourceGroupQueryType,
116-
@JsonProperty("tables") String[] tables,
115+
@JsonProperty("tables") List<String> tables,
117116
@JsonProperty("defaultCatalog") Optional<String> defaultCatalog,
118117
@JsonProperty("defaultSchema") Optional<String> defaultSchema,
119118
@JsonProperty("catalogs") Set<String> catalogs,
@@ -127,7 +126,8 @@ public TrinoQueryProperties(
127126
this.body = requireNonNullElse(body, "");
128127
this.queryType = requireNonNullElse(queryType, "");
129128
this.resourceGroupQueryType = resourceGroupQueryType;
130-
this.tables = Arrays.stream(requireNonNullElse(tables, new String[] {})).map(this::parseIdentifierStringToQualifiedName).collect(Collectors.toSet());
129+
List<String> defaultTables = ImmutableList.of();
130+
this.tables = requireNonNullElse(tables, defaultTables).stream().map(this::parseIdentifierStringToQualifiedName).collect(Collectors.toSet());
131131
this.defaultCatalog = requireNonNullElse(defaultCatalog, Optional.empty());
132132
this.defaultSchema = requireNonNullElse(defaultSchema, Optional.empty());
133133
this.catalogs = requireNonNullElse(catalogs, ImmutableSet.of());

gateway-ha/src/test/java/io/trino/gateway/ha/router/TestTrinoQueryProperties.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ void testJsonCreator()
3333
"SELECT c1 from c.s.t1",
3434
"SELECT",
3535
"SELECT",
36-
new String[] {"c.s.t1"},
36+
ImmutableList.of("c.s.t1"),
3737
Optional.empty(),
3838
Optional.empty(),
3939
ImmutableSet.of("c"),
@@ -73,7 +73,7 @@ void testJsonCreatorWithEmptyProperties()
7373
"SELECT c1 from c.s.t1",
7474
"SELECT",
7575
"SELECT",
76-
new String[] {},
76+
ImmutableList.of(),
7777
Optional.empty(),
7878
Optional.empty(),
7979
ImmutableSet.of(),

0 commit comments

Comments
 (0)