Skip to content

Commit

Permalink
response to CR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
LuckyPickleZZ committed Apr 25, 2024
1 parent ce6eced commit 1ab297d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -121,11 +121,11 @@ public SuccessResponse<SqlAsyncExecuteResp> asyncSqlExecute(@PathVariable String
return Responses.success(consoleService.execute(SidUtils.getSessionId(sessionId), req));
}

@RequestMapping(value = {"/sessions/{sessionId}/sqls/asyncExecuteV2"}, method = RequestMethod.POST)
@RequestMapping(value = {"/sessions/{sessionId}/sqls/streamExecute"}, method = RequestMethod.POST)
@StatefulRoute(stateName = StateName.DB_SESSION, stateIdExpression = "#sessionId")
public SuccessResponse<SqlAsyncExecuteResp> asyncSqlExecuteV2(@PathVariable String sessionId,
public SuccessResponse<SqlAsyncExecuteResp> streamExecute(@PathVariable String sessionId,
@RequestBody SqlAsyncExecuteReq req) throws Exception {
return Responses.success(consoleService.executeV2(SidUtils.getSessionId(sessionId), req, true));
return Responses.success(consoleService.streamExecute(SidUtils.getSessionId(sessionId), req, true));
}

/**
Expand All @@ -142,11 +142,11 @@ public SuccessResponse<List<SqlExecuteResult>> getAsyncSqlExecute(@PathVariable
return Responses.success(consoleService.getAsyncResult(SidUtils.getSessionId(sessionId), requestId, null));
}

@RequestMapping(value = "/sessions/{sessionId}/sqls/getResultV2", method = RequestMethod.GET)
@RequestMapping(value = "/sessions/{sessionId}/sqls/getMoreResults", method = RequestMethod.GET)
@StatefulRoute(stateName = StateName.DB_SESSION, stateIdExpression = "#sessionId")
public SuccessResponse<AsyncExecuteResultResp> getAsyncSqlExecuteV2(@PathVariable String sessionId,
public SuccessResponse<AsyncExecuteResultResp> getMoreResults(@PathVariable String sessionId,
@RequestParam String requestId) {
return Responses.success(consoleService.getAsyncResultV2(SidUtils.getSessionId(sessionId), requestId));
return Responses.success(consoleService.getMoreResults(SidUtils.getSessionId(sessionId), requestId));
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ public SqlAsyncExecuteResp execute(@NotNull String sessionId,
return response;
}

public SqlAsyncExecuteResp executeV2(@NotNull String sessionId,
public SqlAsyncExecuteResp streamExecute(@NotNull String sessionId,
@NotNull @Valid SqlAsyncExecuteReq request, boolean needSqlRuleCheck) throws Exception {
ConnectionSession connectionSession = sessionService.nullSafeGet(sessionId, true);

Expand Down Expand Up @@ -435,14 +435,14 @@ public List<SqlExecuteResult> getAsyncResult(@NotNull String sessionId, String r
}
}

public AsyncExecuteResultResp getAsyncResultV2(@NotNull String sessionId, String requestId) {
public AsyncExecuteResultResp getMoreResults(@NotNull String sessionId, String requestId) {
PreConditions.validArgumentState(Objects.nonNull(requestId), ErrorCodes.SqlRegulationRuleBlocked, null, null);
ConnectionSession connectionSession = sessionService.nullSafeGet(sessionId);
AsyncExecuteContext context =
(AsyncExecuteContext) ConnectionSessionUtil.getExecuteContext(connectionSession, requestId);
boolean shouldRemoveContext = context.isFinished();
try {
List<JdbcGeneralResult> resultList = context.getFinishedSqlExecutionResults();
List<JdbcGeneralResult> resultList = context.getMoreSqlExecutionResults();
List<SqlExecuteResult> results = resultList.stream().map(jdbcGeneralResult -> {
SqlExecuteResult result = generateResult(connectionSession, jdbcGeneralResult, context.getContextMap());
try (TraceStage stage = result.getSqlTuple().getSqlWatch().start(SqlExecuteStages.SQL_AFTER_CHECK)) {
Expand Down

0 comments on commit 1ab297d

Please sign in to comment.