Gabriel39 commented on code in PR #70176: URL: https://github.com/apache/doris/pull/70176#discussion_r4638232465
########## fe/fe-connector/fe-connector-adbc/src/main/java/org/apache/doris/connector/adbc/AdbcDriverInfo.java: ########## @@ -0,0 +1,76 @@ +// 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.connector.adbc; + +import org.apache.doris.connector.spi.DorisConnectorException; + +import org.apache.arrow.adbc.core.AdbcConnection; +import org.apache.arrow.adbc.core.AdbcException; +import org.apache.arrow.adbc.core.AdbcInfoCode; +import org.apache.arrow.adbc.core.AdbcStatusCode; +import org.apache.arrow.vector.VectorSchemaRoot; +import org.apache.arrow.vector.ipc.ArrowReader; + +import java.util.Locale; + +/** Verifies the native Flight driver's server-info isolation before it can mutate vendor state. */ +final class AdbcDriverInfo { + // Private local GetInfo capability, advertised by the bundled ADBC source patch; never sent to a server. + private static final int CONNECTION_SCOPED_VENDOR_INFO = 0x444f0001; + + private AdbcDriverInfo() { + } + + static void requireIsolatedVendorInfo(AdbcConnection connection) throws Exception { + Object name; + try { + name = readInfo(connection, AdbcInfoCode.DRIVER_NAME.getValue()); + } catch (AdbcException e) { + if (e.getStatus() != AdbcStatusCode.NOT_IMPLEMENTED && e.getStatus() != AdbcStatusCode.NOT_FOUND) { + throw e; + } + return; Review Comment: Fixed in f1c61a20a4d. An unavailable DRIVER_NAME (NOT_IMPLEMENTED/NOT_FOUND), an empty result, or a blank name no longer establishes a non-Flight identity. Flight and unidentified drivers must advertise the private connection-scoped isolation capability before VENDOR_NAME is requested; absent, false or unsupported capabilities stop discovery with zero vendor requests. Identified non-Flight drivers retain the generic path. Other identity errors propagate and remain retryable. The updated guard suite covers these cases and successful isolated unnamed drivers. Ten checks fail on the previous guard; all 14 guard cases and all 230 ADBC tests, including native SQLite, now pass. Maven Checkstyle and the connector import gate also pass. This update changes the FE guard and its test fixtures only. -- 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]
