Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions fe/fe-core/src/main/cup/sql_parser.cup
Original file line number Diff line number Diff line change
Expand Up @@ -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());
:}
;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@
*/
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;
}
Expand All @@ -35,7 +35,7 @@ public boolean isConnectionKill() {
return isConnectionKill;
}

public long getConnectionId() {
public int getConnectionId() {
return connectionId;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public void execute(BaseRequest request, BaseResponse response) {
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.");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,9 @@ protected Object connection(HttpServletRequest request, HttpServletResponse resp
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());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ public void unregisterConnection(ConnectContext ctx) {
}
}

public ConnectContext getContext(long connectionId) {
public ConnectContext getContext(int connectionId) {
return connectionMap.get(connectionId);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -728,7 +728,7 @@ public void cancel() {
// 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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@ public TShowVariableResult showVariables(TShowVariableRequest params) throws TEx
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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ public void testKill(@Mocked KillStmt killStmt, @Mocked SqlParser parser) throws
new Expectations(scheduler) {
{
// suicide
scheduler.getContext(1L);
scheduler.getContext(1);
result = ctx;
}
};
Expand Down Expand Up @@ -399,7 +399,7 @@ public void testKillOtherFail(@Mocked KillStmt killStmt, @Mocked SqlParser parse
new Expectations(scheduler) {
{
// suicide
scheduler.getContext(1L);
scheduler.getContext(1);
result = killCtx;
}
};
Expand All @@ -420,7 +420,7 @@ public void testKillOther(@Mocked KillStmt killStmt, @Mocked SqlParser parser, @

killStmt.getConnectionId();
minTimes = 0;
result = 1L;
result = 1;

killStmt.isConnectionKill();
minTimes = 0;
Expand Down Expand Up @@ -455,7 +455,7 @@ public void testKillOther(@Mocked KillStmt killStmt, @Mocked SqlParser parser, @
new Expectations(scheduler) {
{
// suicide
scheduler.getContext(1L);
scheduler.getContext(1);
result = killCtx;
}
};
Expand All @@ -475,7 +475,7 @@ public void testKillNoCtx(@Mocked KillStmt killStmt, @Mocked SqlParser parser) t

killStmt.getConnectionId();
minTimes = 0;
result = 1L;
result = 1;

killStmt.getRedirectStatus();
minTimes = 0;
Expand All @@ -490,7 +490,7 @@ public void testKillNoCtx(@Mocked KillStmt killStmt, @Mocked SqlParser parser) t

new Expectations(scheduler) {
{
scheduler.getContext(1L);
scheduler.getContext(1);
result = null;
}
};
Expand Down