Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions mysql-test/columnstore/bugfixes/mcol_4627.result
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
DROP DATABASE IF EXISTS mcol_4627;
CREATE DATABASE mcol_4627;
USE mcol_4627;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (i INT, d DECIMAL(10,1)) ENGINE=ColumnStore;
INSERT INTO t1 VALUES (0, 1.5);
UPDATE t1 SET i=d;
SELECT * FROM t1;
i d
2 1.5
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (i INT, d DECIMAL(10,1)) ENGINE=ColumnStore;
INSERT INTO t1 VALUES (0, 1.4);
UPDATE t1 SET i=d;
SELECT * FROM t1;
i d
1 1.4
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (i INT, d DECIMAL(10,1)) ENGINE=ColumnStore;
INSERT INTO t1 VALUES (0, -0.5);
UPDATE t1 SET i=d;
SELECT * FROM t1;
i d
-1 -0.5
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (i INT, d DECIMAL(10,1)) ENGINE=ColumnStore;
INSERT INTO t1 VALUES (0, -1.5);
UPDATE t1 SET i=d;
SELECT * FROM t1;
i d
-2 -1.5
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (i INT, d DECIMAL(10,1)) ENGINE=ColumnStore;
INSERT INTO t1 VALUES (7, NULL);
UPDATE t1 SET i=d;
SELECT * FROM t1;
i d
NULL NULL
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (i INT UNSIGNED, d DECIMAL(10,1)) ENGINE=ColumnStore;
INSERT INTO t1 VALUES (0, 0.5);
UPDATE t1 SET i=d;
SELECT * FROM t1;
i d
1 0.5
DROP DATABASE mcol_4627;
64 changes: 64 additions & 0 deletions mysql-test/columnstore/bugfixes/mcol_4627.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
-- source ../include/have_columnstore.inc
--disable_warnings
DROP DATABASE IF EXISTS mcol_4627;
--enable_warnings
CREATE DATABASE mcol_4627;
USE mcol_4627;

--disable_warnings
DROP TABLE IF EXISTS t1;
--enable_warnings
CREATE TABLE t1 (i INT, d DECIMAL(10,1)) ENGINE=ColumnStore;
INSERT INTO t1 VALUES (0, 1.5);
UPDATE t1 SET i=d;
--sorted_result
SELECT * FROM t1;
Comment thread
AestheticAkhmad marked this conversation as resolved.

--disable_warnings
DROP TABLE IF EXISTS t1;
--enable_warnings
CREATE TABLE t1 (i INT, d DECIMAL(10,1)) ENGINE=ColumnStore;
INSERT INTO t1 VALUES (0, 1.4);
UPDATE t1 SET i=d;
--sorted_result
SELECT * FROM t1;

--disable_warnings
DROP TABLE IF EXISTS t1;
--enable_warnings
CREATE TABLE t1 (i INT, d DECIMAL(10,1)) ENGINE=ColumnStore;
INSERT INTO t1 VALUES (0, -0.5);
UPDATE t1 SET i=d;
--sorted_result
SELECT * FROM t1;

--disable_warnings
DROP TABLE IF EXISTS t1;
--enable_warnings
CREATE TABLE t1 (i INT, d DECIMAL(10,1)) ENGINE=ColumnStore;
INSERT INTO t1 VALUES (0, -1.5);
UPDATE t1 SET i=d;
--sorted_result
SELECT * FROM t1;

--disable_warnings
DROP TABLE IF EXISTS t1;
--enable_warnings
CREATE TABLE t1 (i INT, d DECIMAL(10,1)) ENGINE=ColumnStore;
INSERT INTO t1 VALUES (7, NULL);
UPDATE t1 SET i=d;
--sorted_result
SELECT * FROM t1;

--disable_warnings
DROP TABLE IF EXISTS t1;
--enable_warnings
CREATE TABLE t1 (i INT UNSIGNED, d DECIMAL(10,1)) ENGINE=ColumnStore;
INSERT INTO t1 VALUES (0, 0.5);
UPDATE t1 SET i=d;
--sorted_result
SELECT * FROM t1;
Comment thread
AestheticAkhmad marked this conversation as resolved.

--disable_warnings
DROP DATABASE mcol_4627;
--enable_warnings
6 changes: 3 additions & 3 deletions mysql-test/columnstore/bugfixes/mcol_4628.result
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ INSERT INTO t1 VALUES (0, -0.5);
UPDATE t1 SET i=d;
SELECT * FROM t1;
i d
0 -0.5
-1 -0.5
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (i INT UNSIGNED, d DOUBLE) ENGINE=ColumnStore;
INSERT INTO t1 VALUES (0, 0.5);
Expand Down Expand Up @@ -58,8 +58,8 @@ INSERT INTO t1 VALUES (761);
INSERT INTO t1 VALUES (762);
SELECT * FROM t1 WHERE i > -762.5;
i
-762
-761
-762
761
762
DROP TABLE IF EXISTS t1;
Expand All @@ -70,8 +70,8 @@ INSERT INTO t1 VALUES (761);
INSERT INTO t1 VALUES (762);
SELECT * FROM t1 WHERE i > -762.2;
i
-762
-761
-762
761
762
DROP TABLE IF EXISTS t1;
Expand Down
9 changes: 9 additions & 0 deletions mysql-test/columnstore/bugfixes/mcol_4628.test
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (i INT, d DOUBLE) ENGINE=ColumnStore;
INSERT INTO t1 VALUES (0, 1.5);
UPDATE t1 SET i=d;
--sorted_result
SELECT * FROM t1;

--disable_warnings
Expand All @@ -19,6 +20,7 @@ DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (i INT, d DOUBLE) ENGINE=ColumnStore;
INSERT INTO t1 VALUES (0, 1.7);
UPDATE t1 SET i=d;
--sorted_result
SELECT * FROM t1;

--disable_warnings
Expand All @@ -27,6 +29,7 @@ DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (i INT, d DOUBLE) ENGINE=ColumnStore;
INSERT INTO t1 VALUES (0, 1.4);
UPDATE t1 SET i=d;
--sorted_result
SELECT * FROM t1;

--disable_warnings
Expand All @@ -35,6 +38,7 @@ DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (i INT, d DOUBLE) ENGINE=ColumnStore;
INSERT INTO t1 VALUES (0, -0.5);
UPDATE t1 SET i=d;
--sorted_result
SELECT * FROM t1;

--disable_warnings
Expand All @@ -43,6 +47,7 @@ DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (i INT UNSIGNED, d DOUBLE) ENGINE=ColumnStore;
INSERT INTO t1 VALUES (0, 0.5);
UPDATE t1 SET i=d;
--sorted_result
SELECT * FROM t1;

--disable_warnings
Expand All @@ -51,6 +56,7 @@ DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (i INT UNSIGNED, d DOUBLE) ENGINE=ColumnStore;
INSERT INTO t1 VALUES (0, 1.5);
UPDATE t1 SET i=d;
--sorted_result
SELECT * FROM t1;

--disable_warnings
Expand All @@ -59,6 +65,7 @@ DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (i INT UNSIGNED, d DOUBLE) ENGINE=ColumnStore;
INSERT INTO t1 VALUES (0, 1.4);
UPDATE t1 SET i=d;
--sorted_result
SELECT * FROM t1;

--disable_warnings
Expand All @@ -69,6 +76,7 @@ INSERT INTO t1 VALUES (-762);
INSERT INTO t1 VALUES (-761);
INSERT INTO t1 VALUES (761);
INSERT INTO t1 VALUES (762);
--sorted_result
SELECT * FROM t1 WHERE i > -762.5;

--disable_warnings
Expand All @@ -79,6 +87,7 @@ INSERT INTO t1 VALUES (-762);
INSERT INTO t1 VALUES (-761);
INSERT INTO t1 VALUES (761);
INSERT INTO t1 VALUES (762);
--sorted_result
SELECT * FROM t1 WHERE i > -762.2;

--disable_warnings
Expand Down
12 changes: 3 additions & 9 deletions utils/dataconvert/dataconvert.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -279,15 +279,9 @@ void number_int_value(const string& data, cscDataType typeCode,

intVal = dataconvert::string_to_ll<T>(intStr, pushwarning);

if (intVal == 0 && isNegative)
{
if (roundup == 1)
roundup = 0;
}
else
{
intVal += intVal >= 0 ? roundup : -roundup;
}
// Apply rounding direction from the original sign, including "-0.x".
// This keeps behavior consistent with InnoDB for boundary cases like -0.5 -> -1.
intVal += isNegative ? -roundup : roundup;

switch (typeCode)
{
Expand Down