-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
de13cf0
commit 7664d41
Showing
3 changed files
with
103 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
regression-test/data/correctness_p0/test_outer_join_with_null_value.out
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
-- This file is automatically generated. You should know what you did if you want to edit this | ||
-- !select1 -- | ||
2 | ||
|
||
-- !select2 -- | ||
2 | ||
|
91 changes: 91 additions & 0 deletions
91
regression-test/suites/correctness_p0/test_outer_join_with_null_value.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
// 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_outer_join_with_null_value") { | ||
sql """ | ||
drop table if exists outer_table_a; | ||
""" | ||
|
||
sql """ | ||
drop table if exists outer_table_b; | ||
""" | ||
|
||
sql """ | ||
create table outer_table_a | ||
( | ||
PROJECT_ID VARCHAR(32) not null, | ||
SO_NO VARCHAR(32) not null, | ||
ORG_ID VARCHAR(32) not null | ||
)ENGINE = OLAP | ||
DUPLICATE KEY(PROJECT_ID) | ||
DISTRIBUTED BY HASH(PROJECT_ID) BUCKETS 30 | ||
PROPERTIES ( | ||
"replication_allocation" = "tag.location.default: 1" | ||
); | ||
""" | ||
|
||
sql """ | ||
create table outer_table_b | ||
( | ||
PROJECT_ID VARCHAR(32) not null, | ||
SO_NO VARCHAR(32), | ||
ORG_ID VARCHAR(32) not null | ||
)ENGINE = OLAP | ||
DUPLICATE KEY(PROJECT_ID) | ||
DISTRIBUTED BY HASH(PROJECT_ID) BUCKETS 30 | ||
PROPERTIES ( | ||
"replication_allocation" = "tag.location.default: 1" | ||
); | ||
""" | ||
|
||
sql """ | ||
insert into outer_table_a values('1','1','1'); | ||
""" | ||
|
||
sql """ | ||
insert into outer_table_b values('1','1','1'),('1',null,'1'); | ||
""" | ||
|
||
qt_select1 """ | ||
select | ||
count(*) | ||
FROM | ||
outer_table_b WSA | ||
LEFT JOIN outer_table_a WBWD ON WBWD.ORG_ID = WSA.ORG_ID | ||
AND WBWD.PROJECT_ID = WSA.PROJECT_ID | ||
AND WBWD.SO_NO = WSA.SO_NO; | ||
""" | ||
|
||
qt_select2 """ | ||
select | ||
count(*) | ||
FROM | ||
outer_table_b WSA | ||
LEFT JOIN outer_table_a WBWD ON WBWD.ORG_ID = WSA.ORG_ID | ||
AND WBWD.PROJECT_ID = WSA.PROJECT_ID | ||
AND WBWD.SO_NO = WSA.SO_NO | ||
AND WBWD.SO_NO >= WSA.SO_NO; | ||
""" | ||
|
||
sql """ | ||
drop table if exists outer_table_a; | ||
""" | ||
|
||
sql """ | ||
drop table if exists outer_table_b; | ||
""" | ||
} |