[Chore](case) move some mv case from feut to p0 (#18475)

move some mv case from feut to p0
This commit is contained in:
Pxl
2023-04-11 11:48:55 +08:00
committed by GitHub
parent e562017801
commit da2d0bba74
10 changed files with 320 additions and 0 deletions

View File

@ -0,0 +1,16 @@
-- This file is automatically generated. You should know what you did if you want to edit this
-- !select_star --
2020-01-01 1 a 1 1 1
2020-01-01 1 a 1 1 1
2020-01-02 2 b 2 2 2
2020-01-03 3 c 3 3 3
-- !select_mv --
\N \N 8
1 \N 3
1 1 3
2 \N 3
2 2 3
3 \N 4
3 3 4

View File

@ -0,0 +1,12 @@
-- This file is automatically generated. You should know what you did if you want to edit this
-- !select_star --
2020-01-01 1 a 1 1 1
2020-01-01 1 a 1 1 1
2020-01-02 2 b 2 2 2
2020-01-03 3 c 3 3 3
-- !select_mv --
1 4
2 2
3 2

View File

@ -0,0 +1,9 @@
-- This file is automatically generated. You should know what you did if you want to edit this
-- !select_star --
2020-01-01 1 a 1 1 1
2020-01-01 1 a 1 1 1
2020-01-02 2 b 2 2 2
2020-01-03 3 c 3 3 3
-- !select_mv --

View File

@ -0,0 +1,9 @@
-- This file is automatically generated. You should know what you did if you want to edit this
-- !select_star --
2020-01-01 1 a 1 1 1
2020-01-01 1 a 1 1 1
2020-01-02 2 b 2 2 2
2020-01-03 3 c 3 3 3
-- !select_mv --

View File

@ -0,0 +1,9 @@
-- This file is automatically generated. You should know what you did if you want to edit this
-- !select_star --
2020-01-01 1 a 1 1 1
2020-01-01 1 a 1 1 1
2020-01-02 2 b 2 2 2
2020-01-03 3 c 3 3 3
-- !select_mv --

View File

@ -0,0 +1,53 @@
// 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.
import org.codehaus.groovy.runtime.IOGroovyMethods
suite ("testAggQueryOnAggMV10") {
sql """ DROP TABLE IF EXISTS emps; """
sql """
create table emps (
time_col date,
empid int,
name varchar,
deptno int,
salary int,
commission int)
partition by range (time_col) (partition p1 values less than MAXVALUE) distributed by hash(time_col) buckets 3 properties('replication_num' = '1');
"""
sql """insert into emps values("2020-01-01",1,"a",1,1,1);"""
sql """insert into emps values("2020-01-02",2,"b",2,2,2);"""
sql """insert into emps values("2020-01-03",3,"c",3,3,3);"""
createMV("create materialized view emps_mv as select deptno, commission, sum(salary) from emps group by deptno, commission;")
sql """insert into emps values("2020-01-01",1,"a",1,1,1);"""
explain {
sql("select * from emps order by empid;")
contains "(emps)"
}
qt_select_star "select * from emps order by empid;"
explain {
sql("select deptno, commission, sum(salary) + 1 from emps group by rollup (deptno, commission);")
contains "(emps_mv)"
}
qt_select_mv "select deptno, commission, sum(salary) + 1 from emps group by rollup (deptno, commission) order by 1,2;"
}

View File

@ -0,0 +1,53 @@
// 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.
import org.codehaus.groovy.runtime.IOGroovyMethods
suite ("testAggQueryOnAggMV11") {
sql """ DROP TABLE IF EXISTS emps; """
sql """
create table emps (
time_col date,
empid int,
name varchar,
deptno int,
salary int,
commission int)
partition by range (time_col) (partition p1 values less than MAXVALUE) distributed by hash(time_col) buckets 3 properties('replication_num' = '1');
"""
sql """insert into emps values("2020-01-01",1,"a",1,1,1);"""
sql """insert into emps values("2020-01-02",2,"b",2,2,2);"""
sql """insert into emps values("2020-01-03",3,"c",3,3,3);"""
createMV("create materialized view emps_mv as select deptno, count(salary) from emps group by deptno;")
sql """insert into emps values("2020-01-01",1,"a",1,1,1);"""
explain {
sql("select * from emps order by empid;")
contains "(emps)"
}
qt_select_star "select * from emps order by empid;"
explain {
sql("select deptno, count(salary) + count(1) from emps group by deptno;")
contains "(emps)"
}
qt_select_mv "select deptno, count(salary) + count(1) from emps group by deptno order by 1;"
}

View File

@ -0,0 +1,53 @@
// 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.
import org.codehaus.groovy.runtime.IOGroovyMethods
suite ("testAggQuqeryOnAggMV5") {
sql """ DROP TABLE IF EXISTS emps; """
sql """
create table emps (
time_col date,
empid int,
name varchar,
deptno int,
salary int,
commission int)
partition by range (time_col) (partition p1 values less than MAXVALUE) distributed by hash(time_col) buckets 3 properties('replication_num' = '1');
"""
sql """insert into emps values("2020-01-01",1,"a",1,1,1);"""
sql """insert into emps values("2020-01-02",2,"b",2,2,2);"""
sql """insert into emps values("2020-01-03",3,"c",3,3,3);"""
createMV("create materialized view emps_mv as select deptno, commission, sum(salary) from emps group by deptno, commission;")
sql """insert into emps values("2020-01-01",1,"a",1,1,1);"""
explain {
sql("select * from emps order by empid;")
contains "(emps)"
}
qt_select_star "select * from emps order by empid;"
explain {
sql("select * from (select deptno, sum(salary) as sum_salary from emps group by deptno) a where sum_salary>10;")
contains "(emps_mv)"
}
qt_select_mv "select * from (select deptno, sum(salary) as sum_salary from emps group by deptno) a where sum_salary>10 order by 1;"
}

View File

@ -0,0 +1,53 @@
// 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.
import org.codehaus.groovy.runtime.IOGroovyMethods
suite ("testAggQuqeryOnAggMV6") {
sql """ DROP TABLE IF EXISTS emps; """
sql """
create table emps (
time_col date,
empid int,
name varchar,
deptno int,
salary int,
commission int)
partition by range (time_col) (partition p1 values less than MAXVALUE) distributed by hash(time_col) buckets 3 properties('replication_num' = '1');
"""
sql """insert into emps values("2020-01-01",1,"a",1,1,1);"""
sql """insert into emps values("2020-01-02",2,"b",2,2,2);"""
sql """insert into emps values("2020-01-03",3,"c",3,3,3);"""
createMV("create materialized view emps_mv as select deptno, commission, sum(salary) from emps group by deptno, commission;")
sql """insert into emps values("2020-01-01",1,"a",1,1,1);"""
explain {
sql("select * from emps order by empid;")
contains "(emps)"
}
qt_select_star "select * from emps order by empid;"
explain {
sql("select * from (select deptno, sum(salary) as sum_salary from emps where deptno>=20 group by deptno) a where sum_salary>10;")
contains "(emps_mv)"
}
qt_select_mv "select * from (select deptno, sum(salary) as sum_salary from emps where deptno>=20 group by deptno) a where sum_salary>10 order by 1;"
}

View File

@ -0,0 +1,53 @@
// 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.
import org.codehaus.groovy.runtime.IOGroovyMethods
suite ("testAggQuqeryOnAggMV7") {
sql """ DROP TABLE IF EXISTS emps; """
sql """
create table emps (
time_col date,
empid int,
name varchar,
deptno int,
salary int,
commission int)
partition by range (time_col) (partition p1 values less than MAXVALUE) distributed by hash(time_col) buckets 3 properties('replication_num' = '1');
"""
sql """insert into emps values("2020-01-01",1,"a",1,1,1);"""
sql """insert into emps values("2020-01-02",2,"b",2,2,2);"""
sql """insert into emps values("2020-01-03",3,"c",3,3,3);"""
createMV("create materialized view emps_mv as select deptno, commission, sum(salary) from emps group by deptno, commission;")
sql """insert into emps values("2020-01-01",1,"a",1,1,1);"""
explain {
sql("select * from emps order by empid;")
contains "(emps)"
}
qt_select_star "select * from emps order by empid;"
explain {
sql("select deptno, sum(salary) from emps where deptno>=20 group by deptno;")
contains "(emps_mv)"
}
qt_select_mv "select deptno, sum(salary) from emps where deptno>=20 group by deptno order by 1;"
}