1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-08-29 03:22:01 +03:00
Files
mariadb-columnstore-engine/mysql-test/columnstore/devregression/t/mcs7245_regression_bug2977.test
Daniel Lee 4c9d6e39ac Dlee mtr restructure (#2494)
* Restructured test suites and added autopilot and extended suites

* Updated autopilot with correct branch - develop

* Moved setup test case to a 'setup' directory, for consistency

* Fixed a path issue

* Updated some tests cases to keep up with development

Co-authored-by: root <root@rocky8.localdomain>
2022-08-09 21:20:56 +03:00

68 lines
2.3 KiB
Plaintext

# -------------------------------------------------------------- #
# Test case migrated from regression test suite: bug2977.sql
#
# Author: Daniel Lee, daniel.lee@mariadb.com
# -------------------------------------------------------------- #
#
--source ../include/have_columnstore.inc
#
USE tpch1;
#
drop table if exists `shipamounts`;
drop table if exists `ship1`;
drop table if exists `ship2`;
CREATE TABLE `shipamounts` (
`OrderNum` varchar(50) DEFAULT NULL,
`OrderLine` int(11) DEFAULT NULL,
`ShippingAmount` decimal(10,2) DEFAULT NULL,
`ShippingDiscountAmount` decimal(10,2) DEFAULT NULL,
`ShippingOrderAmount` decimal(10,2) DEFAULT NULL,
`ShippingDiscountOrderAmount` decimal(10,2) DEFAULT NULL
) engine=columnstore DEFAULT CHARSET=latin1;
CREATE TABLE `ship1` (
`OrderNum` varchar(50) DEFAULT NULL,
`OrderLine` int(11) DEFAULT NULL,
`ShippingAmount` decimal(10,2) DEFAULT NULL,
`ShippingOrderAmount` decimal(10,2) DEFAULT NULL,
`ShippingDiscountAmount` decimal(10,2) DEFAULT NULL,
`ShippingDiscountOrderAmount` decimal(10,2) DEFAULT NULL
) engine=columnstore DEFAULT CHARSET=latin1;
CREATE TABLE `ship2` (
`OrderNum` varchar(50) DEFAULT NULL,
`OrderLine` int(11) DEFAULT NULL,
`ShippingAmount` decimal(10,2) DEFAULT NULL,
`ShippingOrderAmount` decimal(10,2) DEFAULT NULL,
`ShippingDiscountAmount` decimal(10,2) DEFAULT NULL,
`ShippingDiscountOrderAmount` decimal(10,2) DEFAULT NULL
) engine=columnstore DEFAULT CHARSET=latin1;
insert into shipamounts values (2357203684, 352338, 0, 0, 0, 0);
insert into ship1 values (2357203684, 352338, 0, 0, 0, 0);
insert into ship2 values (2357203684, 352338, 0, 0, 0, 0);
SELECT s.OrderNum,
s.OrderLine,
s.ShippingAmount,
s.ShippingOrderAmount,
total.ShippingTotalAmount,
s.ShippingDiscountAmount,
s.ShippingDiscountOrderAmount,
total.ShippingDiscountTotalAmount,
IF( s.OrderLine = MIN(t.OrderLine), 1, 0 )
FROM shipAmounts AS s
LEFT OUTER JOIN ship1 AS t ON s.OrderNum = t.OrderNum
LEFT OUTER JOIN
(SELECT OrderNum, SUM(ShippingAmount) AS ShippingTotalAmount,
SUM(ShippingDiscountAmount) AS ShippingDiscountTotalAmount
FROM ship2
GROUP BY OrderNum) AS total ON s.OrderNum = total.OrderNum
GROUP BY s.OrderNum,s.OrderLine,3,4,5,6,7,8;
drop table if exists shipamounts;
drop table if exists ship1;
drop table if exists ship2;
#