Skip to content

Commit

Permalink
tests: func_math, correct crc32 for mariadb
Browse files Browse the repository at this point in the history
Differences:

MariaDB doesn't support a JSON type therefore the crc32 on those values
are different.

JSON extract syntax is different.

loaddata_utf8 has 3 duplicate lines removed compared to MySQL version.
  • Loading branch information
grooverdan authored and Sergey Vojtovich committed Apr 26, 2018
1 parent 1a011e5 commit 7f89d9c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 12 deletions.
16 changes: 6 additions & 10 deletions mysql-test/main/func_math.result
Original file line number Diff line number Diff line change
Expand Up @@ -1216,13 +1216,12 @@ DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (a JSON);
INSERT INTO t1 VALUES ('{"name" : "goodyear"}'),
('{"name" : "verygood-year"}');
SELECT a->>'$.name', CRC32(a) FROM t1;
a->>'$.name' CRC32(a)
goodyear 3664432072
verygood-year 922278888
SELECT CRC32(a->>'$.name') FROM t1 WHERE a->>'$.name' = 'goodyear';
CRC32(a->>'$.name')
3441724142
SELECT a, CRC32(a) FROM t1;
a CRC32(a)
{"name" : "goodyear"} 3258555818
{"name" : "verygood-year"} 3616384779
SELECT CRC32(json_query(a, '$.name')) FROM t1 WHERE json_query(a, '$.name') = 'goodyear';
CRC32(json_query(a, '$.name'))
SELECT CRC32(REPLACE(JSON_EXTRACT(a, "$.name"),'\"',''))
FROM t1 WHERE JSON_EXTRACT(a, "$.name") = 'goodyear';
CRC32(REPLACE(JSON_EXTRACT(a, "$.name"),'\"',''))
Expand Down Expand Up @@ -1284,8 +1283,5 @@ HEX(a) CRC32(a)
E4B880E4BA8CE4B889 1785250883
E59B9BE4BA94E585AD 2914501801
E4B883E585ABE4B99D 2374586519
E4B880E4BA8CE4B889 1785250883
E59B9BE4BA94E585AD 2914501801
E4B883E585ABE4B99D0A 1546750244
DROP TABLE t1;
SET NAMES default;
4 changes: 2 additions & 2 deletions mysql-test/main/func_math.test
Original file line number Diff line number Diff line change
Expand Up @@ -836,8 +836,8 @@ DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (a JSON);
INSERT INTO t1 VALUES ('{"name" : "goodyear"}'),
('{"name" : "verygood-year"}');
SELECT a->>'$.name', CRC32(a) FROM t1;
SELECT CRC32(a->>'$.name') FROM t1 WHERE a->>'$.name' = 'goodyear';
SELECT a, CRC32(a) FROM t1;
SELECT CRC32(json_query(a, '$.name')) FROM t1 WHERE json_query(a, '$.name') = 'goodyear';
SELECT CRC32(REPLACE(JSON_EXTRACT(a, "$.name"),'\"',''))
FROM t1 WHERE JSON_EXTRACT(a, "$.name") = 'goodyear';
DROP TABLE t1;
Expand Down

0 comments on commit 7f89d9c

Please sign in to comment.