From 4b412d4e09b1445288801567c84548561635641a Mon Sep 17 00:00:00 2001 From: benthompson15 Date: Mon, 21 Feb 2022 16:09:31 -0600 Subject: [PATCH] MCOL-4940: test case for ROUND fix (#2271) --- mysql-test/columnstore/bugfixes/mcol-4940.result | 11 +++++++++++ mysql-test/columnstore/bugfixes/mcol-4940.test | 14 ++++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 mysql-test/columnstore/bugfixes/mcol-4940.result create mode 100644 mysql-test/columnstore/bugfixes/mcol-4940.test diff --git a/mysql-test/columnstore/bugfixes/mcol-4940.result b/mysql-test/columnstore/bugfixes/mcol-4940.result new file mode 100644 index 000000000..0ca364b2b --- /dev/null +++ b/mysql-test/columnstore/bugfixes/mcol-4940.result @@ -0,0 +1,11 @@ +DROP DATABASE IF EXISTS mcol_4940; +CREATE DATABASE mcol_4940; +USE mcol_4940; +create table rounding_table ( a int, b double, c double) engine=columnstore; +insert into rounding_table values (26805, 1252, -9647); +insert into rounding_table values (26806, 573, -2804.5); +SELECT CASE a WHEN 26805 THEN ROUND(c/b, 2) WHEN 26806 THEN b END MCOL4940 FROM ( SELECT a, SUM(b) b, SUM(c) c FROM rounding_table GROUP BY a ) abc ; +MCOL4940 +573 +-7.71 +DROP DATABASE mcol_4940; diff --git a/mysql-test/columnstore/bugfixes/mcol-4940.test b/mysql-test/columnstore/bugfixes/mcol-4940.test new file mode 100644 index 000000000..4d5ceb23d --- /dev/null +++ b/mysql-test/columnstore/bugfixes/mcol-4940.test @@ -0,0 +1,14 @@ +--source ../include/have_columnstore.inc +--disable_warnings +DROP DATABASE IF EXISTS mcol_4940; +--enable_warnings +CREATE DATABASE mcol_4940; +USE mcol_4940; + +create table rounding_table ( a int, b double, c double) engine=columnstore; +insert into rounding_table values (26805, 1252, -9647); +insert into rounding_table values (26806, 573, -2804.5); + +SELECT CASE a WHEN 26805 THEN ROUND(c/b, 2) WHEN 26806 THEN b END MCOL4940 FROM ( SELECT a, SUM(b) b, SUM(c) c FROM rounding_table GROUP BY a ) abc ; + +DROP DATABASE mcol_4940;