Skip to content

Commit 581daa2

Browse files
maswinmosabua
authored andcommitted
Fix query history search based on RoutedTo field
1 parent 30c57ab commit 581daa2

File tree

5 files changed

+8
-8
lines changed

5 files changed

+8
-8
lines changed

gateway-ha/src/main/java/io/trino/gateway/ha/domain/request/QueryHistoryRequest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,15 @@
2222
* @param page page index
2323
* @param size page size
2424
* @param user Query histories of specified user. ADMIN role is optional, other roles are mandatory.
25-
* @param backendUrl Optional, you can query the history based on the backendUrl.
25+
* @param externalUrl Optional, you can query the history based on the externalUrl.
2626
* @param queryId Optional, you can query the query history based on the queryId of Trino.
2727
*/
2828
@JsonIgnoreProperties(ignoreUnknown = true)
2929
public record QueryHistoryRequest(
3030
@JsonProperty("page") Integer page,
3131
@JsonProperty("size") Integer size,
3232
@JsonProperty("user") String user,
33-
@JsonProperty("backendUrl") String backendUrl,
33+
@JsonProperty("externalUrl") String externalUrl,
3434
@JsonProperty("queryId") String queryId,
3535
@JsonProperty("source") String source)
3636
{

gateway-ha/src/main/java/io/trino/gateway/ha/resource/GatewayWebAppResource.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ public Response findQueryHistory(QueryHistoryRequest query, @Context SecurityCon
139139
query.page(),
140140
query.size(),
141141
securityContext.getUserPrincipal().getName(),
142-
query.backendUrl(),
142+
query.externalUrl(),
143143
query.queryId(),
144144
query.source()));
145145
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,8 @@ public TableData<QueryDetail> findQueryHistory(QueryHistoryRequest query)
122122
if (!Strings.isNullOrEmpty(query.user())) {
123123
condition += " and user_name = '" + query.user() + "'";
124124
}
125-
if (!Strings.isNullOrEmpty(query.backendUrl())) {
126-
condition += " and backend_url = '" + query.backendUrl() + "'";
125+
if (!Strings.isNullOrEmpty(query.externalUrl())) {
126+
condition += " and external_url = '" + query.externalUrl() + "'";
127127
}
128128
if (!Strings.isNullOrEmpty(query.queryId())) {
129129
condition += " and query_id = '" + query.queryId() + "'";

gateway-ha/src/test/java/io/trino/gateway/ha/TestObjectSerializable.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,9 +123,9 @@ void testQueryHistoryRequest()
123123
throws JsonProcessingException
124124
{
125125
assertThat(objectMapper.writeValueAsString(new QueryHistoryRequest(null, null, "user1", "url1", "query_id", "source")))
126-
.contains(ImmutableList.of("\"page\":1", "\"size\":10", "user", "backendUrl", "queryId", "source"));
126+
.contains(ImmutableList.of("\"page\":1", "\"size\":10", "user", "externalUrl", "queryId", "source"));
127127
assertThat(objectMapper.writeValueAsString(new QueryHistoryRequest(5, 6, "user1", "url1", "query_id", "source")))
128-
.contains(ImmutableList.of("\"page\":5", "\"size\":6", "user", "backendUrl", "queryId", "source"));
128+
.contains(ImmutableList.of("\"page\":5", "\"size\":6", "user", "externalUrl", "queryId", "source"));
129129
}
130130

131131
@Test

webapp/src/components/history.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ export function History() {
105105
<Form labelPosition="left"
106106
render={() => (
107107
<>
108-
<Form.Select field="backendUrl" label='RoutedTo' style={{ width: 200 }} showClear placeholder={Locale.History.RoutedToTip}>
108+
<Form.Select field="externalUrl" label='RoutedTo' style={{ width: 200 }} showClear placeholder={Locale.History.RoutedToTip}>
109109
{backendData?.map(b => (
110110
<Form.Select.Option key={b.externalUrl} value={b.externalUrl}>
111111
<Tag color={'blue'} style={{ marginRight: '5px' }}>{backendMapping[b.externalUrl]}</Tag>

0 commit comments

Comments
 (0)