Skip to content

Commit 893dcaf

Browse files
committed
Use List for tables
1 parent 5abcf95 commit 893dcaf

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
@@ -71,7 +71,6 @@
7171
import java.io.IOException;
7272
import java.net.URLDecoder;
7373
import java.util.ArrayList;
74-
import java.util.Arrays;
7574
import java.util.Enumeration;
7675
import java.util.List;
7776
import java.util.Map;
@@ -115,7 +114,7 @@ public TrinoQueryProperties(
115114
@JsonProperty("body") String body,
116115
@JsonProperty("queryType") String queryType,
117116
@JsonProperty("resourceGroupQueryType") String resourceGroupQueryType,
118-
@JsonProperty("tables") String[] tables,
117+
@JsonProperty("tables") List<String> tables,
119118
@JsonProperty("defaultCatalog") Optional<String> defaultCatalog,
120119
@JsonProperty("defaultSchema") Optional<String> defaultSchema,
121120
@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
@@ -32,7 +32,7 @@ void testJsonCreator()
3232
"SELECT c1 from c.s.t1",
3333
"SELECT",
3434
"SELECT",
35-
new String[] {"c.s.t1"},
35+
ImmutableList.of("c.s.t1"),
3636
Optional.empty(),
3737
Optional.empty(),
3838
ImmutableSet.of("c"),
@@ -66,7 +66,7 @@ void testJsonCreatorWithEmptyProperties()
6666
"SELECT c1 from c.s.t1",
6767
"SELECT",
6868
"SELECT",
69-
new String[] {},
69+
ImmutableList.of(),
7070
Optional.empty(),
7171
Optional.empty(),
7272
ImmutableSet.of(),

0 commit comments

Comments
 (0)