Skip to content

Commit 897118c

Browse files
JeongDaeKimebyhr
authored andcommitted
Support Execute Immediate statement in TrinoQueryProperties
1 parent 1762e02 commit 897118c

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
import io.trino.sql.tree.DropSchema;
4040
import io.trino.sql.tree.DropTable;
4141
import io.trino.sql.tree.Execute;
42+
import io.trino.sql.tree.ExecuteImmediate;
4243
import io.trino.sql.tree.Identifier;
4344
import io.trino.sql.tree.Node;
4445
import io.trino.sql.tree.NodeLocation;
@@ -186,6 +187,10 @@ private void processRequestBody(HttpServletRequest request, RequestAnalyzerConfi
186187
body = preparedStatements.get(statementName);
187188
statement = parser.createStatement(body);
188189
}
190+
else if (statement instanceof ExecuteImmediate executeImmediate) {
191+
body = executeImmediate.getStatement().getValue();
192+
statement = parser.createStatement(body);
193+
}
189194

190195
queryType = statement.getClass().getSimpleName();
191196
resourceGroupQueryType = StatementUtils.getQueryType(statement).toString();

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,11 @@ private Stream<Arguments> provideTableExtractionQueries()
379379
Arguments.of("SELECT * FROM TABLE(kat.system.funk(arg => 'expr'))",
380380
ImmutableSet.of("kat"),
381381
ImmutableSet.of("system"),
382-
ImmutableSet.of(QualifiedName.of("kat", "system", "funk"))));
382+
ImmutableSet.of(QualifiedName.of("kat", "system", "funk"))),
383+
Arguments.of("EXECUTE IMMEDIATE 'SELECT * FROM cat.schem.tbl'",
384+
ImmutableSet.of("cat"),
385+
ImmutableSet.of("schem"),
386+
ImmutableSet.of(QualifiedName.of("cat", "schem", "tbl"))));
383387
}
384388

385389
@ParameterizedTest

0 commit comments

Comments
 (0)