diff --git a/fe/fe-core/src/main/java/org/apache/doris/service/arrowflight/DorisFlightSqlProducer.java b/fe/fe-core/src/main/java/org/apache/doris/service/arrowflight/DorisFlightSqlProducer.java index af6d85c954e4a1b..16195469af915f9 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/service/arrowflight/DorisFlightSqlProducer.java +++ b/fe/fe-core/src/main/java/org/apache/doris/service/arrowflight/DorisFlightSqlProducer.java @@ -90,7 +90,7 @@ /** * Implementation of Arrow Flight SQL service - * + *

* All methods must catch all possible Exceptions, print and throw CallStatus, * otherwise error message will be discarded. */ @@ -224,8 +224,13 @@ private FlightInfo executeQueryStatement(String peerIdentity, ConnectContext con } } else { // Now only query stmt will pull results from BE. - final ByteString handle = ByteString.copyFromUtf8( - DebugUtil.printId(connectContext.queryId()) + ":" + query); + final ByteString handle; + if (connectContext.getSessionVariable().enableParallelResultSink()) { + handle = ByteString.copyFromUtf8(DebugUtil.printId(connectContext.queryId()) + ":" + query); + } else { + // only one instance + handle = ByteString.copyFromUtf8(DebugUtil.printId(connectContext.getFinstId()) + ":" + query); + } Schema schema = flightSQLConnectProcessor.fetchArrowFlightSchema(5000); if (schema == null) { throw CallStatus.INTERNAL.withDescription("fetch arrow flight schema is null").toRuntimeException(); diff --git a/regression-test/conf/regression-conf.groovy b/regression-test/conf/regression-conf.groovy index 08b51ce46aab7f3..b5cb2ce92eb1d21 100644 --- a/regression-test/conf/regression-conf.groovy +++ b/regression-test/conf/regression-conf.groovy @@ -198,7 +198,7 @@ s3Region = "ap-hongkong" //arrow flight sql test config extArrowFlightSqlHost = "127.0.0.1" -extArrowFlightSqlPort = 9090 +extArrowFlightSqlPort = 8080 extArrowFlightSqlUser = "root" extArrowFlightSqlPassword= "" diff --git a/regression-test/data/arrow_flight_sql_p0/test_select.out b/regression-test/data/arrow_flight_sql_p0/test_select.out new file mode 100644 index 000000000000000..d643597bbafcb5e --- /dev/null +++ b/regression-test/data/arrow_flight_sql_p0/test_select.out @@ -0,0 +1,4 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !arrow_flight_sql -- +777 4 + diff --git a/regression-test/pipeline/p0/conf/fe.conf b/regression-test/pipeline/p0/conf/fe.conf index 80fd1d84af68e0c..0b313cb4c5b6871 100644 --- a/regression-test/pipeline/p0/conf/fe.conf +++ b/regression-test/pipeline/p0/conf/fe.conf @@ -34,7 +34,7 @@ JAVA_OPTS="-Djavax.security.auth.useSubjectCredsOnly=false -Xss4m -Xmx4096m -XX: JAVA_OPTS_FOR_JDK_9="-Djavax.security.auth.useSubjectCredsOnly=false -Xss4m -Xmx4096m -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=$DORIS_HOME/log/fe.jmap -XX:+UseG1GC -XX:MaxGCPauseMillis=200 -XX:+PrintGCDateStamps -XX:+PrintGCDetails -Xloggc:$DORIS_HOME/log/fe.gc.log.$CUR_DATE -Dlog4j2.formatMsgNoLookups=true" # For jdk 17+, this JAVA_OPTS will be used as default JVM options -JAVA_OPTS_FOR_JDK_17="-Djavax.security.auth.useSubjectCredsOnly=false -Xmx8192m -Xms8192m -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=$DORIS_HOME/log/ -Xlog:gc*:$DORIS_HOME/log/fe.gc.log.$CUR_DATE:time" +JAVA_OPTS_FOR_JDK_17="-Djavax.security.auth.useSubjectCredsOnly=false -Xmx8192m -Xms8192m -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=$DORIS_HOME/log/ -Xlog:gc*:$DORIS_HOME/log/fe.gc.log.$CUR_DATE:time --add-opens=java.base/java.nio=ALL-UNNAMED --add-opens java.base/jdk.internal.ref=ALL-UNNAMED" ## ## the lowercase properties are read by main program. @@ -43,7 +43,7 @@ JAVA_OPTS_FOR_JDK_17="-Djavax.security.auth.useSubjectCredsOnly=false -Xmx8192m # INFO, WARN, ERROR, FATAL sys_log_level = INFO -arrow_flight_sql_port = 8080 +arrow_flight_sql_port = 8081 # store metadata, must be created before start FE. # Default value is ${DORIS_HOME}/doris-meta diff --git a/regression-test/pipeline/p0/conf/regression-conf.groovy b/regression-test/pipeline/p0/conf/regression-conf.groovy index 98b8520194a4fa3..97541c9ccf15739 100644 --- a/regression-test/pipeline/p0/conf/regression-conf.groovy +++ b/regression-test/pipeline/p0/conf/regression-conf.groovy @@ -136,6 +136,12 @@ s3Endpoint = "cos.ap-hongkong.myqcloud.com" s3BucketName = "doris-build-hk-1308700295" s3Region = "ap-hongkong" +//arrow flight sql test config +extArrowFlightSqlHost = "127.0.0.1" +extArrowFlightSqlPort = 8081 +extArrowFlightSqlUser = "root" +extArrowFlightSqlPassword= "" + max_failure_num=50 externalEnvIp="127.0.0.1" diff --git a/regression-test/suites/arrow_flight_sql_p0/test_select.groovy b/regression-test/suites/arrow_flight_sql_p0/test_select.groovy new file mode 100644 index 000000000000000..55b3c301e244f4a --- /dev/null +++ b/regression-test/suites/arrow_flight_sql_p0/test_select.groovy @@ -0,0 +1,31 @@ +// 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. + +suite("test_select", "arrow_flight_sql") { + def tableName = "test_select" + sql "DROP TABLE IF EXISTS ${tableName}" + sql """ + create table ${tableName} (id int, name varchar(20)) DUPLICATE key(`id`) distributed by hash (`id`) buckets 4 + properties ("replication_num"="1"); + """ + sql """INSERT INTO ${tableName} VALUES(111, "plsql111")""" + sql """INSERT INTO ${tableName} VALUES(222, "plsql222")""" + sql """INSERT INTO ${tableName} VALUES(333, "plsql333")""" + sql """INSERT INTO ${tableName} VALUES(111, "plsql333")""" + + qt_arrow_flight_sql "select sum(id) as a, count(1) as b from ${tableName}" +}