This is an automated email from the ASF dual-hosted git repository.
morningman pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-doris.git
The following commit(s) were added to refs/heads/master by this push:
new 9df5b2d [fix](variables) Fix bug that execute showVariablesStmt with
where expression return empty resultset (#8094)
9df5b2d is described below
commit 9df5b2dfdca1a0014e7780d0f353262db47dcf49
Author: caiconghui <[email protected]>
AuthorDate: Sat Feb 19 11:58:17 2022 +0800
[fix](variables) Fix bug that execute showVariablesStmt with where
expression return empty resultset (#8094)
This Bug is introduced by PR #7936 , which change key type of connectionMap
from Long to Integer,
which cause connectionMap could not find connectContext by connectionId
---
fe/fe-core/src/main/cup/sql_parser.cup | 6 +++---
.../src/main/java/org/apache/doris/analysis/KillStmt.java | 6 +++---
.../java/org/apache/doris/http/rest/ConnectionAction.java | 2 +-
.../java/org/apache/doris/httpv2/rest/ConnectionAction.java | 4 ++--
.../src/main/java/org/apache/doris/qe/ConnectScheduler.java | 2 +-
.../src/main/java/org/apache/doris/qe/StmtExecutor.java | 2 +-
.../java/org/apache/doris/service/FrontendServiceImpl.java | 2 +-
.../src/test/java/org/apache/doris/qe/StmtExecutorTest.java | 12 ++++++------
8 files changed, 18 insertions(+), 18 deletions(-)
diff --git a/fe/fe-core/src/main/cup/sql_parser.cup
b/fe/fe-core/src/main/cup/sql_parser.cup
index 14b0f11..5a9953c 100644
--- a/fe/fe-core/src/main/cup/sql_parser.cup
+++ b/fe/fe-core/src/main/cup/sql_parser.cup
@@ -3506,15 +3506,15 @@ restore_stmt ::=
kill_stmt ::=
KW_KILL INTEGER_LITERAL:value
{:
- RESULT = new KillStmt(true, value.longValue());
+ RESULT = new KillStmt(true, value.intValue());
:}
| KW_KILL KW_CONNECTION INTEGER_LITERAL:value
{:
- RESULT = new KillStmt(true, value.longValue());
+ RESULT = new KillStmt(true, value.intValue());
:}
| KW_KILL KW_QUERY INTEGER_LITERAL:value
{:
- RESULT = new KillStmt(false, value.longValue());
+ RESULT = new KillStmt(false, value.intValue());
:}
;
diff --git a/fe/fe-core/src/main/java/org/apache/doris/analysis/KillStmt.java
b/fe/fe-core/src/main/java/org/apache/doris/analysis/KillStmt.java
index 541c3a4..98120f3 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/analysis/KillStmt.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/KillStmt.java
@@ -24,9 +24,9 @@ package org.apache.doris.analysis;
*/
public class KillStmt extends StatementBase {
private final boolean isConnectionKill;
- private final long connectionId;
+ private final int connectionId;
- public KillStmt(boolean isConnectionKill, long connectionId) {
+ public KillStmt(boolean isConnectionKill, int connectionId) {
this.isConnectionKill = isConnectionKill;
this.connectionId = connectionId;
}
@@ -35,7 +35,7 @@ public class KillStmt extends StatementBase {
return isConnectionKill;
}
- public long getConnectionId() {
+ public int getConnectionId() {
return connectionId;
}
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/http/rest/ConnectionAction.java
b/fe/fe-core/src/main/java/org/apache/doris/http/rest/ConnectionAction.java
index b0caaff..3ac8f28 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/http/rest/ConnectionAction.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/http/rest/ConnectionAction.java
@@ -47,7 +47,7 @@ public class ConnectionAction extends RestBaseAction {
sendResult(request, response, HttpResponseStatus.BAD_REQUEST);
return;
}
- long connectionId = Long.valueOf(connStr.trim());
+ int connectionId = Integer.valueOf(connStr.trim());
ConnectContext context =
ExecuteEnv.getInstance().getScheduler().getContext(connectionId);
if (context == null || context.queryId() == null) {
response.getContent().append("connection id " + connectionId + "
not found.");
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/httpv2/rest/ConnectionAction.java
b/fe/fe-core/src/main/java/org/apache/doris/httpv2/rest/ConnectionAction.java
index f04ca74..e601e82 100644
---
a/fe/fe-core/src/main/java/org/apache/doris/httpv2/rest/ConnectionAction.java
+++
b/fe/fe-core/src/main/java/org/apache/doris/httpv2/rest/ConnectionAction.java
@@ -65,9 +65,9 @@ public class ConnectionAction extends RestBaseController {
return ResponseEntityBuilder.badRequest("Missing connection_id");
}
- long connectionId = -1;
+ int connectionId = -1;
try {
- connectionId = Long.valueOf(connStr.trim());
+ connectionId = Integer.valueOf(connStr.trim());
} catch (NumberFormatException e) {
return ResponseEntityBuilder.badRequest("Invalid connection id: "
+ e.getMessage());
}
diff --git a/fe/fe-core/src/main/java/org/apache/doris/qe/ConnectScheduler.java
b/fe/fe-core/src/main/java/org/apache/doris/qe/ConnectScheduler.java
index ecb6048..babad8a 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/qe/ConnectScheduler.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/qe/ConnectScheduler.java
@@ -128,7 +128,7 @@ public class ConnectScheduler {
}
}
- public ConnectContext getContext(long connectionId) {
+ public ConnectContext getContext(int connectionId) {
return connectionMap.get(connectionId);
}
diff --git a/fe/fe-core/src/main/java/org/apache/doris/qe/StmtExecutor.java
b/fe/fe-core/src/main/java/org/apache/doris/qe/StmtExecutor.java
index 5b4be01..d5947ca 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/qe/StmtExecutor.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/qe/StmtExecutor.java
@@ -728,7 +728,7 @@ public class StmtExecutor implements ProfileWriter {
// Handle kill statement.
private void handleKill() throws DdlException {
KillStmt killStmt = (KillStmt) parsedStmt;
- long id = killStmt.getConnectionId();
+ int id = killStmt.getConnectionId();
ConnectContext killCtx = context.getConnectScheduler().getContext(id);
if (killCtx == null) {
ErrorReport.reportDdlException(ErrorCode.ERR_NO_SUCH_THREAD, id);
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/service/FrontendServiceImpl.java
b/fe/fe-core/src/main/java/org/apache/doris/service/FrontendServiceImpl.java
index 94ca3bd..6628e97 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/service/FrontendServiceImpl.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/service/FrontendServiceImpl.java
@@ -426,7 +426,7 @@ public class FrontendServiceImpl implements
FrontendService.Iface {
Map<String, String> map = Maps.newHashMap();
result.setVariables(map);
// Find connect
- ConnectContext ctx =
exeEnv.getScheduler().getContext(params.getThreadId());
+ ConnectContext ctx = exeEnv.getScheduler().getContext((int)
params.getThreadId());
if (ctx == null) {
return result;
}
diff --git a/fe/fe-core/src/test/java/org/apache/doris/qe/StmtExecutorTest.java
b/fe/fe-core/src/test/java/org/apache/doris/qe/StmtExecutorTest.java
index 64a041b..0ab38a3 100644
--- a/fe/fe-core/src/test/java/org/apache/doris/qe/StmtExecutorTest.java
+++ b/fe/fe-core/src/test/java/org/apache/doris/qe/StmtExecutorTest.java
@@ -342,7 +342,7 @@ public class StmtExecutorTest {
new Expectations(scheduler) {
{
// suicide
- scheduler.getContext(1L);
+ scheduler.getContext(1);
result = ctx;
}
};
@@ -399,7 +399,7 @@ public class StmtExecutorTest {
new Expectations(scheduler) {
{
// suicide
- scheduler.getContext(1L);
+ scheduler.getContext(1);
result = killCtx;
}
};
@@ -420,7 +420,7 @@ public class StmtExecutorTest {
killStmt.getConnectionId();
minTimes = 0;
- result = 1L;
+ result = 1;
killStmt.isConnectionKill();
minTimes = 0;
@@ -455,7 +455,7 @@ public class StmtExecutorTest {
new Expectations(scheduler) {
{
// suicide
- scheduler.getContext(1L);
+ scheduler.getContext(1);
result = killCtx;
}
};
@@ -475,7 +475,7 @@ public class StmtExecutorTest {
killStmt.getConnectionId();
minTimes = 0;
- result = 1L;
+ result = 1;
killStmt.getRedirectStatus();
minTimes = 0;
@@ -490,7 +490,7 @@ public class StmtExecutorTest {
new Expectations(scheduler) {
{
- scheduler.getContext(1L);
+ scheduler.getContext(1);
result = null;
}
};
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]