forked from apache/doris
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[fix](agg)having clause should use column name first then alias (apac…
…he#14408) * [fix](agg)having clause should use column name first then alias * fix fe ut
- Loading branch information
1 parent
f6de03e
commit ae4f4b9
Showing
4 changed files
with
86 additions
and
6 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
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_group_having_alias.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 | ||
-- !sql -- | ||
202245 1 | ||
|
||
-- !sql -- | ||
202245 3 | ||
|
68 changes: 68 additions & 0 deletions
68
regression-test/suites/correctness_p0/test_group_having_alias.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,68 @@ | ||
// 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_group_having_alias") { | ||
sql """ | ||
DROP TABLE IF EXISTS `tb_holiday`; | ||
""" | ||
|
||
sql """ | ||
CREATE TABLE `tb_holiday` ( | ||
`date` bigint(20) NOT NULL , | ||
`holiday` tinyint(4) NOT NULL , | ||
`holiday_cn` varchar(9) NOT NULL | ||
) ENGINE=OLAP | ||
UNIQUE KEY(`date`) | ||
DISTRIBUTED BY HASH(`date`) BUCKETS 4 | ||
PROPERTIES ( | ||
"replication_allocation" = "tag.location.default: 1", | ||
"in_memory" = "false", | ||
"storage_format" = "V2", | ||
"disable_auto_compaction" = "false" | ||
); | ||
""" | ||
|
||
sql """ | ||
insert into tb_holiday values (20221111, 1, 1 ),(20221112, 1, 1 ),(20221113, 1, 1 ),(20221116, 2, 2 ),(20221117, 2, 2 ),(20221118, 2, 2 ); | ||
""" | ||
|
||
qt_sql """ | ||
SELECT | ||
date_format(date, '%x%v') AS `date`, | ||
count(date) AS `diff_days` | ||
FROM `tb_holiday` | ||
WHERE `date` between 20221111 AND 20221116 | ||
GROUP BY date | ||
HAVING date = 20221111 | ||
ORDER BY date; | ||
""" | ||
|
||
qt_sql """ | ||
SELECT | ||
date_format(date, '%x%v') AS `date2`, | ||
count(date) AS `diff_days` | ||
FROM `tb_holiday` | ||
WHERE `date` between 20221111 AND 20221116 | ||
GROUP BY date2 | ||
HAVING date2 = 202245 | ||
ORDER BY date2; | ||
""" | ||
|
||
sql """ | ||
DROP TABLE IF EXISTS `tb_holiday`; | ||
""" | ||
} |