Skip to content

Commit eca9d59

Browse files
committed
[fix](arrow-flight) Fix DDL via Flight SQL crashing with getMysqlChannel RuntimeException
Problem: DDL statements (CREATE DATABASE, CREATE TABLE, etc.) executed via Arrow Flight SQL crash with RuntimeException: 'getMysqlChannel not in mysql connection'. This is a regression in 4.0.5 caused by commit 1a8590e which added context.getMysqlChannel().clientDeprecatedEOF() calls in sendFields() without checking connectType. Root cause: FlightSqlConnectContext.getMysqlChannel() throws RuntimeException because Flight SQL does not use MySQL channels. The CLIENT_DEPRECATE_EOF fix (apache#61050/apache#61062) added getMysqlChannel() calls to code paths shared with Flight SQL DDL execution: - sendFields() at line 1728 - sendMetaData() at line 1614 - sendStmtPrepareOK() at line 1647 Fix: Replace Preconditions.checkState(connectType == MYSQL) with early return for non-MySQL connections. This follows the existing pattern used in handleQueryStmt() (line 1259) and InsertIntoTableCommand (line 383). Fixes apache#62017
1 parent 5ff9558 commit eca9d59

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

‎fe/fe-core/src/main/java/org/apache/doris/qe/StmtExecutor.java‎

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1611,7 +1611,9 @@ private void sendMetaData(ResultSetMetaData metaData) throws IOException {
16111611
}
16121612

16131613
private void sendMetaData(ResultSetMetaData metaData, List<FieldInfo> fieldInfos) throws IOException {
1614-
Preconditions.checkState(context.getConnectType() == ConnectType.MYSQL);
1614+
if (context.getConnectType() != ConnectType.MYSQL) {
1615+
return;
1616+
}
16151617
// sends how many columns
16161618
serializer.reset();
16171619
serializer.writeVInt(metaData.getColumnCount());
@@ -1644,7 +1646,9 @@ private List<PrimitiveType> exprToStringType(List<Expr> exprs) {
16441646
}
16451647

16461648
public void sendStmtPrepareOK(int stmtId, List<String> labels, List<Slot> output) throws IOException {
1647-
Preconditions.checkState(context.getConnectType() == ConnectType.MYSQL);
1649+
if (context.getConnectType() != ConnectType.MYSQL) {
1650+
return;
1651+
}
16481652
// https://dev.mysql.com/doc/dev/mysql-server/latest/page_protocol_com_stmt_prepare.html#sect_protocol_com_stmt_prepare_response
16491653
serializer.reset();
16501654
// 0x00 OK
@@ -1725,7 +1729,9 @@ private void sendFields(List<String> colNames, List<Type> types) throws IOExcept
17251729

17261730
private void sendFields(List<String> colNames, List<FieldInfo> fieldInfos, List<Type> types) throws
17271731
IOException {
1728-
Preconditions.checkState(context.getConnectType() == ConnectType.MYSQL);
1732+
if (context.getConnectType() != ConnectType.MYSQL) {
1733+
return;
1734+
}
17291735
// sends how many columns
17301736
serializer.reset();
17311737
serializer.writeVInt(colNames.size());

0 commit comments

Comments
 (0)