diff --git a/regression-test/data/query_p0/join/test_left_join1.out b/regression-test/data/query_p0/join/test_left_join1.out new file mode 100644 index 0000000000..7f19a1333e --- /dev/null +++ b/regression-test/data/query_p0/join/test_left_join1.out @@ -0,0 +1,7 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !select -- +1 123 1 123 \N \N +2 124 2 124 2 124 +3 125 3 125 3 125 +4 126 4 126 4 126 + diff --git a/regression-test/suites/query_p0/join/ddl/test_left_join1.sql b/regression-test/suites/query_p0/join/ddl/test_left_join1.sql new file mode 100644 index 0000000000..1ecda88e6d --- /dev/null +++ b/regression-test/suites/query_p0/join/ddl/test_left_join1.sql @@ -0,0 +1,12 @@ +CREATE TABLE `test_left_join1` ( + `f_key` bigint(10) NOT NULL DEFAULT "0" COMMENT "key", + `f_value` bigint(10) REPLACE_IF_NOT_NULL NULL COMMENT "value" +) ENGINE=OLAP +AGGREGATE KEY(`f_key`) +COMMENT "向量引擎bug展示" +DISTRIBUTED BY HASH(`f_key`) BUCKETS 2 +PROPERTIES ( + "replication_allocation" = "tag.location.default: 1", + "in_memory" = "false", + "storage_format" = "V2" +); diff --git a/regression-test/suites/query_p0/join/test_left_join1.groovy b/regression-test/suites/query_p0/join/test_left_join1.groovy new file mode 100644 index 0000000000..d4cbeeee65 --- /dev/null +++ b/regression-test/suites/query_p0/join/test_left_join1.groovy @@ -0,0 +1,42 @@ +// 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_join1", "query,p0") { + + def tableName = "test_left_join1" + sql """drop table if exists ${tableName}""" + sql new File("""${context.file.parent}/ddl/test_left_join1.sql""").text + + sql """insert into ${tableName} values (1, 123),(2, 124),(3, 125),(4, 126);""" + + qt_select """ SELECT + * + FROM + ( SELECT f_key, f_value FROM ${tableName} ) a + LEFT JOIN ( SELECT f_key, f_value FROM ${tableName} ) b ON a.f_key = b.f_key + LEFT JOIN ( + SELECT + * + FROM + ${tableName} + WHERE + f_key IN ( SELECT f_key FROM ${tableName} WHERE f_key IN ( SELECT f_key FROM ${tableName} WHERE f_value > 123 ) ) + ) c ON a.f_key = c.f_key + ORDER BY + a.f_key; + """ +}