[test](find_in_set) add find_in_set function test case (#20718)

This commit is contained in:
zy-kkk
2023-06-14 09:43:48 +08:00
committed by GitHub
parent 9b4b0d4bf9
commit affe36d32e
2 changed files with 52 additions and 0 deletions

View File

@ -0,0 +1,13 @@
-- This file is automatically generated. You should know what you did if you want to edit this
-- !sql --
1,2,3 d
-- !sql --
1 a
-- !sql --
\N c \N
1 a 1
1,2,3 d 0
2 b 0

View File

@ -0,0 +1,39 @@
// 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_find_in_set") {
def tbName = "test_find_in_set"
sql "DROP TABLE IF EXISTS ${tbName}"
sql """
CREATE TABLE IF NOT EXISTS ${tbName} (
timea varchar(30) NULL,
creatr varchar(30) NULL
)
DISTRIBUTED BY HASH(timea) BUCKETS 5 properties("replication_num" = "1");
"""
sql """
INSERT INTO ${tbName} VALUES ('1 ','a'),('2 ','b'), ('1,2,3','d'),(null,'c');
"""
// LIKE as predicate
qt_sql "select * from ${tbName} where find_in_set(\"1\", timea) > 0;"
qt_sql "select * from ${tbName} where find_in_set(\"1 \", timea) > 0;"
qt_sql "select *, find_in_set(\"1 \", timea) from ${tbName} order by 1;"
sql "DROP TABLE ${tbName};"
}