Files
doris/regression-test/suites/query_p0/sql_functions/test_predicate.groovy
Xinyi Zou b096062680 [feature-wip](arrow-flight)(step6) Support regression test (#27847)
Design Documentation Linked to #25514

Regression test add a new group: arrow_flight_sql,

./run-regression-test.sh -g arrow_flight_sql to run regression-test, can use jdbc:arrow-flight-sql to run all Suites whose group contains arrow_flight_sql.
./run-regression-test.sh -g p0,arrow_flight_sql to run regression-test, can use jdbc:arrow-flight-sql to run all Suites whose group contains arrow_flight_sql, and use jdbc:mysql to run other Suites whose group contains p0 but does not contain arrow_flight_sql.
Requires attention, the formats of jdbc:arrow-flight-sql and jdbc:mysql and mysql client query results are different, for example:

Datatime field type: jdbc:mysql returns 2010-01-02T05:09:06, mysql client returns 2010-01-02 05:09:06, jdbc:arrow-flight-sql also returns 2010-01-02 05:09 :06.
Array and Map field types: jdbc:mysql returns ["ab", "efg", null], {"f1": 1, "f2": "a"}, jdbc:arrow-flight-sql returns ["ab ","efg",null], {"f1":1,"f2":"a"}, which is missing spaces.
Float field type: jdbc:mysql and mysql client returns 6.333, jdbc:arrow-flight-sql returns 6.333000183105469, in query_p0/subquery/test_subquery.groovy.
If the query result is empty, jdbc:arrow-flight-sql returns empty and jdbc:mysql returns \N.
use database; and query should be divided into two SQL executions as much as possible. otherwise the results may not be as expected. For example: USE information_schema; select cast ("0.0101031417" as datetime) The result is 2000-01-01 03:14:1 (constant fold), select cast ("0.0101031417" as datetime) The result is null (no constant fold),
In addition, doris jdbc:arrow-flight-sql still has unfinished parts, such as:

Unsupported data type: Decimal256. INVALID_ARGUMENT: [INTERNAL_ERROR]Fail to convert block data to arrow data, error: [E3] write_column_to_arrow with type Decimal256
Unsupported null value of map key. INVALID_ARGUMENT: [INTERNAL_ERROR]Fail to convert block data to arrow data, error: [E33] Can not write null value of map key to arrow.
Unsupported data type: ARRAY<MAP<TEXT,TEXT>>
jdbc:arrow-flight-sql not support connecting to specify DB name, such asjdbc:arrow-flight-sql://127.0.0.1:9090/{db_name}", In order to be compatible with regression-test, use db_nameis added before all SQLs whenjdbc:arrow-flight-sql` runs regression test.
select timediff("2010-01-01 01:00:00", "2010-01-02 01:00:00");, error java.lang.NumberFormatException: For input string: "-24:00:00"
2023-12-04 19:23:56 +08:00

58 lines
2.6 KiB
Groovy

// 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_predicate", "arrow_flight_sql") {
sql """drop table if exists t1;"""
sql """
create table t1 (
k1 int null,
k2 int null,
k3 int null,
k4 int null
)
duplicate key (k1)
distributed BY hash(k1) buckets 3
properties("replication_num" = "1");
"""
sql """ insert into t1 values(1,2,3,null); """
qt_null_or_null "select * from t1 where abs(k1)=null or abs(k1)=null;"
qt_true_or_null "select * from t1 where abs(k1)=1 or abs(k1)=null;"
qt_null_or_true "select * from t1 where abs(k1)=null or abs(k1)=1;"
qt_false_or_null "select * from t1 where abs(k1)!=1 or abs(k1)=null;"
qt_null_or_false "select * from t1 where abs(k1)=null or abs(k1)!=1;"
qt_false_or_true "select * from t1 where abs(k1)!=1 or abs(k1)=1;"
qt_true_or_false "select * from t1 where abs(k1)=1 or abs(k1)!=1;"
qt_null_and_null "select * from t1 where abs(k1)=null and abs(k1)=null;"
qt_true_and_null "select * from t1 where abs(k1)=1 and abs(k1)=null;"
qt_null_and_true "select * from t1 where abs(k1)=null and abs(k1)=1;"
qt_false_and_null "select * from t1 where abs(k1)!=1 and abs(k1)=null;"
qt_null_and_false "select * from t1 where abs(k1)!=null and abs(k1)=1;"
qt_false_and_true "select * from t1 where abs(k1)!=1 and abs(k1)=1;"
qt_true_and_false "select * from t1 where abs(k1)=1 and abs(k1)!=1;"
qt_not_false "select * from t1 where not (abs(k1)!=1);"
qt_not_null "select * from t1 where not (abs(k1)!=1 or null);"
qt_false_is_null "select * from t1 where (abs(k1)!=1) is null;"
qt_null_is_null "select * from t1 where (abs(k1)!=1 or null) is null;"
qt_false_eq_false "select * from t1 where (abs(k1)!=1)=false;"
qt_null_eq_false "select * from t1 where (abs(k1)!=1 or null)=false;"
}