github-actions[bot] commented on code in PR #68667: URL: https://github.com/apache/doris/pull/68667#discussion_r4144510033
########## regression-test/suites/arrow_flight_sql_p0/test_flight_native_variant.groovy: ########## @@ -0,0 +1,128 @@ +// 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. + +import org.apache.arrow.driver.jdbc.shaded.org.apache.arrow.flight.CallOptions +import org.apache.arrow.driver.jdbc.shaded.org.apache.arrow.flight.FlightClient +import org.apache.arrow.driver.jdbc.shaded.org.apache.arrow.flight.Location +import org.apache.arrow.driver.jdbc.shaded.org.apache.arrow.flight.sql.FlightSqlClient +import org.apache.arrow.driver.jdbc.shaded.org.apache.arrow.memory.RootAllocator + +import java.util.concurrent.TimeUnit + +suite("test_flight_native_variant", "arrow_flight_sql") { + def frontend = jdbc_sql_return_maparray("SHOW FRONTENDS").find { + it.IsMaster.toString().equalsIgnoreCase("true") && it.Alive.toString().equalsIgnoreCase("true") + } + assertNotNull(frontend) + assertTrue(frontend.ArrowFlightSqlPort.toString().toInteger() > 0) + def database = jdbc_sql("SELECT DATABASE()")[0][0] + // Match ingestion to the configured Variant representation; legacy expression roots + // cannot be cast to a table Variant with a different subcolumn limit. + def variantV2Function = getFeConfig("enable_variant_v2").toBoolean() ? "parse_to_variant" : "" + def table = "${database}.flight_native_variant_input" + def allocator = new RootAllocator(Long.MAX_VALUE) + def feClient = FlightClient.builder(allocator, + Location.forGrpcInsecure(frontend.Host.toString(), frontend.ArrowFlightSqlPort.toString().toInteger())).build() + def client = new FlightSqlClient(feClient) + def auth + def read = { String query, Closure inspect -> + int count = 0 + client.execute(query, auth).endpoints.each { endpoint -> + FlightClient.builder(allocator, endpoint.locations[0]).build().withCloseable { beClient -> + beClient.getStream(endpoint.ticket, auth, CallOptions.timeout(30, TimeUnit.SECONDS)).withCloseable { stream -> + while (stream.next()) { + inspect(stream.root) + count += stream.root.rowCount + } + } + } + } + count + } + def executeSetting = { String query -> read(query, { root -> }) } + try { + auth = feClient.authenticateBasicToken(context.config.otherConfigs.get("extArrowFlightSqlUser"), + context.config.otherConfigs.get("extArrowFlightSqlPassword")).get() + executeSetting("SET enable_sql_cache=false") + jdbc_sql("DROP TABLE IF EXISTS ${table}") + jdbc_sql("""CREATE TABLE ${table} (id INT, v VARIANT) + DUPLICATE KEY(id) DISTRIBUTED BY HASH(id) BUCKETS 3 + PROPERTIES("replication_num"="1")""") + jdbc_sql("""INSERT INTO ${table} VALUES + (1, ${variantV2Function}('42')), (2, ${variantV2Function}('"text"')), + (3, ${variantV2Function}('{"a":[1,null,"x"]}')), (4, NULL)""") + [false, true].each { parallel -> Review Comment: [P2] Require a multi-endpoint native run before treating this as parallel coverage. With three buckets and one replica, all data can be on one BE; `read` accepts any number of endpoints, so the `parallel=true` branch passes without checking native schemas from different result BEs. Use the existing parallel-partitions fixture pattern to establish multiple result backends, assert more than one endpoint when available, and compare their native schemas. -- 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]
