From 8d4a7325a9874a890285d0e72776f4dedb8e816d Mon Sep 17 00:00:00 2001 From: caoliang-web <71004656+caoliang-web@users.noreply.github.com> Date: Sun, 9 Apr 2023 18:15:37 +0800 Subject: [PATCH] [regression](join)Add subquery join case to regression test #17865 --- .../query_p0/join/test_left_join_with.out | 4 ++ .../query_p0/join/test_left_join_with.groovy | 50 +++++++++++++++++++ 2 files changed, 54 insertions(+) create mode 100644 regression-test/data/query_p0/join/test_left_join_with.out create mode 100644 regression-test/suites/query_p0/join/test_left_join_with.groovy diff --git a/regression-test/data/query_p0/join/test_left_join_with.out b/regression-test/data/query_p0/join/test_left_join_with.out new file mode 100644 index 00000000000000..a2c44d41b54336 --- /dev/null +++ b/regression-test/data/query_p0/join/test_left_join_with.out @@ -0,0 +1,4 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !select -- +1 a 10 + diff --git a/regression-test/suites/query_p0/join/test_left_join_with.groovy b/regression-test/suites/query_p0/join/test_left_join_with.groovy new file mode 100644 index 00000000000000..5b3019773f283b --- /dev/null +++ b/regression-test/suites/query_p0/join/test_left_join_with.groovy @@ -0,0 +1,50 @@ +// 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_left_join_with", "query") { + + def tbName = "test_insert" + + sql """ + CREATE TABLE IF NOT EXISTS ${tbName} ( + `id` varchar(11) NULL COMMENT '唯一标识', + `name` varchar(10) NULL COMMENT '采集时间', + `age` int(11) NULL + ) ENGINE=OLAP + UNIQUE KEY(`id`) + COMMENT 'test' + DISTRIBUTED BY HASH(`id`) BUCKETS 10 + PROPERTIES ( + "replication_allocation" = "tag.location.default: 1", + "in_memory" = "false", + "storage_format" = "V2", + "light_schema_change" = "true", + "disable_auto_compaction" = "false" + ); + """ + + sql """insert into ${tbName} values (1,'a',10),(2,'b',20),(3,'c',30);""" + + qt_select """ + with t1 as (select 1 id) + select a.id,a.name,a.age + from ${tbName} a + join (select id from ${tbName} where id = (select * from t1)) b on a.id = b.id + ; + """ + +}