-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Bug](insert)fix insert wrong data on mv when stmt have multiple valu…
…es (#27297) fix insert wrong data on mv when stmt have multiple values
- Loading branch information
1 parent
3643900
commit ff1cbe0
Showing
3 changed files
with
84 additions
and
23 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
9 changes: 9 additions & 0 deletions
9
regression-test/data/mv_p0/test_insert_multi/test_insert_multi.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,9 @@ | ||
-- This file is automatically generated. You should know what you did if you want to edit this | ||
-- !select_star -- | ||
1 1 1 2020-02-02 1 | ||
1 2 2 2020-02-02 1 | ||
|
||
-- !select_mv -- | ||
1 1 | ||
2 1 | ||
|
39 changes: 39 additions & 0 deletions
39
regression-test/suites/mv_p0/test_insert_multi/test_insert_multi.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,39 @@ | ||
// 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 ("test_insert_multi") { | ||
|
||
sql """ DROP TABLE IF EXISTS sales_records; """ | ||
|
||
sql """ | ||
create table sales_records(record_id int, seller_id int, store_id int, sale_date date, sale_amt bigint) distributed by hash(record_id) properties("replication_num" = "1"); | ||
""" | ||
|
||
createMV ("create materialized view store_amt as select store_id, sum(sale_amt) from sales_records group by store_id;") | ||
|
||
sql """insert into sales_records values(1,1,1,"2020-02-02",1),(1,2,2,"2020-02-02",1);""" | ||
|
||
qt_select_star "select * from sales_records order by 1,2;" | ||
|
||
explain { | ||
sql(" SELECT store_id, sum(sale_amt) FROM sales_records GROUP BY store_id order by 1;") | ||
contains "(store_amt)" | ||
} | ||
qt_select_mv " SELECT store_id, sum(sale_amt) FROM sales_records GROUP BY store_id order by 1;" | ||
} |