diff --git a/fe/fe-core/src/main/java/org/apache/doris/qe/ConnectProcessor.java b/fe/fe-core/src/main/java/org/apache/doris/qe/ConnectProcessor.java index e237c9f74c3d13c..3bc7564fb9b102e 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/qe/ConnectProcessor.java +++ b/fe/fe-core/src/main/java/org/apache/doris/qe/ConnectProcessor.java @@ -550,6 +550,39 @@ private void handleFieldList() throws IOException { ctx.getState().setEof(); } + private void handleServerSidePreparedStmt(MysqlCommand command) { + // handle server prepared command + // reference https://dev.mysql.com/doc/dev/mysql-server/latest/page_protocol_command_phase_ps.html + switch (command) { + case COM_STMT_EXECUTE: + handleExecute(); + break; + case COM_STMT_CLOSE: + handleStmtClose(); + break; + case COM_STMT_RESET: + handleStmtReset(); + break; + case COM_STMT_PREPARE: + ctx.initTracer("trace"); + Span rootSpan = ctx.getTracer().spanBuilder("handleQuery").setNoParent().startSpan(); + try (Scope scope = rootSpan.makeCurrent()) { + handleQuery(command); + } catch (Exception e) { + rootSpan.recordException(e); + throw e; + } finally { + rootSpan.end(); + } + break; + default: + ctx.getState().setError(ErrorCode.ERR_UNKNOWN_COM_ERROR, + "Unsupported command(" + command + ")"); + LOG.warn("Unsupported command(" + command + ")"); + return; + } + } + private void dispatch() throws IOException { int code = packetBuf.get(); MysqlCommand command = MysqlCommand.fromCode(code); @@ -590,35 +623,8 @@ private void dispatch() throws IOException { break; default: if (ctx.getSessionVariable().enableServeSidePreparedStatement) { - // handle server prepared command - // reference https://dev.mysql.com/doc/dev/mysql-server/latest/page_protocol_command_phase_ps.html - switch (command) { - case COM_STMT_EXECUTE: - handleExecute(); - break; - case COM_STMT_CLOSE: - handleStmtClose(); - break; - case COM_STMT_RESET: - handleStmtReset(); - break; - case COM_STMT_PREPARE: - ctx.initTracer("trace"); - Span rootSpan = ctx.getTracer().spanBuilder("handleQuery").setNoParent().startSpan(); - try (Scope scope = rootSpan.makeCurrent()) { - handleQuery(command); - } catch (Exception e) { - rootSpan.recordException(e); - throw e; - } finally { - rootSpan.end(); - } - break; - default: - ctx.getState().setError(ErrorCode.ERR_UNKNOWN_COM_ERROR, "Unsupported command(" + command + ")"); - LOG.warn("Unsupported command(" + command + ")"); - break; - } + handleServerSidePreparedStmt(command); + break; } ctx.getState().setError(ErrorCode.ERR_UNKNOWN_COM_ERROR, "Unsupported command(" + command + ")"); LOG.warn("Unsupported command(" + command + ")");