Copilot commented on code in PR #61050: URL: https://github.com/apache/doris/pull/61050#discussion_r2887428528
########## fe/fe-core/src/main/java/org/apache/doris/mysql/MysqlResultSetEndPacket.java: ########## @@ -0,0 +1,61 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +package org.apache.doris.mysql; + +import org.apache.doris.qe.QueryState; + +/** + * MySQL OK packet with 0xFE header, used as the end-of-result-set marker + * when CLIENT_DEPRECATE_EOF is set. + * + * When CLIENT_DEPRECATE_EOF capability is negotiated, the traditional EOF packet (0xFE, ≤5 bytes) + * is replaced by an OK packet that also uses 0xFE as its header byte but has a payload larger + * than 5 bytes. This is called a "ResultSet OK" packet in the MySQL protocol documentation. + * + * See: https://dev.mysql.com/doc/dev/mysql-server/latest/page_protocol_basic_ok_packet.html + */ +public class MysqlResultSetEndPacket extends MysqlPacket { + // 0xFE header to distinguish from regular OK (0x00) + private static final int RESULTSET_OK_INDICATOR = 0xFE; + private static final long AFFECTED_ROWS = 0; + private static final long LAST_INSERT_ID = 0; + + private int serverStatus = 0; + private int warningCount = 0; + + public MysqlResultSetEndPacket(QueryState state) { + this.serverStatus = state.serverStatus; Review Comment: `warningCount` is always serialized as 0 because it’s never initialized from `QueryState` (constructor only copies `serverStatus`). Either populate it from `state.getWarningRows()` (to match OK packet behavior) or remove the field entirely and document that warnings are always 0 for this packet, to avoid implying the value is meaningful. ```suggestion this.serverStatus = state.serverStatus; this.warningCount = state.getWarningRows(); ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
