From 21db64fa76179464955ae28df679f21661bf55ff Mon Sep 17 00:00:00 2001 From: Hangjie Mo Date: Sun, 17 Sep 2023 11:42:10 +0800 Subject: [PATCH] expression, tests: fix ci, add `TestCompareBuiltin` back (#47021) --- expression/integration_test/BUILD.bazel | 2 +- .../integration_test/integration_test.go | 205 ++++++++++++++++++ .../r/expression/builtin.result | Bin 106729 -> 96752 bytes .../integrationtest/t/expression/builtin.test | 111 ---------- 4 files changed, 206 insertions(+), 112 deletions(-) diff --git a/expression/integration_test/BUILD.bazel b/expression/integration_test/BUILD.bazel index 7c8c025321f50..4604db389da6e 100644 --- a/expression/integration_test/BUILD.bazel +++ b/expression/integration_test/BUILD.bazel @@ -8,7 +8,7 @@ go_test( "main_test.go", ], flaky = True, - shard_count = 41, + shard_count = 42, deps = [ "//config", "//domain", diff --git a/expression/integration_test/integration_test.go b/expression/integration_test/integration_test.go index 28a318701761a..8bcb0eda3f173 100644 --- a/expression/integration_test/integration_test.go +++ b/expression/integration_test/integration_test.go @@ -2497,6 +2497,211 @@ func TestCastJSONTimeDuration(t *testing.T) { )) } +func TestCompareBuiltin(t *testing.T) { + store := testkit.CreateMockStore(t) + + tk := testkit.NewTestKit(t, store) + tk.MustExec("use test") + + // compare as JSON + tk.MustExec("drop table if exists t") + tk.MustExec("CREATE TABLE t (pk int NOT NULL PRIMARY KEY AUTO_INCREMENT, i INT, j JSON);") + tk.MustExec(`INSERT INTO t(i, j) VALUES (0, NULL)`) + tk.MustExec(`INSERT INTO t(i, j) VALUES (1, '{"a": 2}')`) + tk.MustExec(`INSERT INTO t(i, j) VALUES (2, '[1,2]')`) + tk.MustExec(`INSERT INTO t(i, j) VALUES (3, '{"a":"b", "c":"d","ab":"abc", "bc": ["x", "y"]}')`) + tk.MustExec(`INSERT INTO t(i, j) VALUES (4, '["here", ["I", "am"], "!!!"]')`) + tk.MustExec(`INSERT INTO t(i, j) VALUES (5, '"scalar string"')`) + tk.MustExec(`INSERT INTO t(i, j) VALUES (6, 'true')`) + tk.MustExec(`INSERT INTO t(i, j) VALUES (7, 'false')`) + tk.MustExec(`INSERT INTO t(i, j) VALUES (8, 'null')`) + tk.MustExec(`INSERT INTO t(i, j) VALUES (9, '-1')`) + tk.MustExec(`INSERT INTO t(i, j) VALUES (10, CAST(CAST(1 AS UNSIGNED) AS JSON))`) + tk.MustExec(`INSERT INTO t(i, j) VALUES (11, '32767')`) + tk.MustExec(`INSERT INTO t(i, j) VALUES (12, '32768')`) + tk.MustExec(`INSERT INTO t(i, j) VALUES (13, '-32768')`) + tk.MustExec(`INSERT INTO t(i, j) VALUES (14, '-32769')`) + tk.MustExec(`INSERT INTO t(i, j) VALUES (15, '2147483647')`) + tk.MustExec(`INSERT INTO t(i, j) VALUES (16, '2147483648')`) + tk.MustExec(`INSERT INTO t(i, j) VALUES (17, '-2147483648')`) + tk.MustExec(`INSERT INTO t(i, j) VALUES (18, '-2147483649')`) + tk.MustExec(`INSERT INTO t(i, j) VALUES (19, '18446744073709551615')`) + tk.MustExec(`INSERT INTO t(i, j) VALUES (20, '18446744073709551616')`) + tk.MustExec(`INSERT INTO t(i, j) VALUES (21, '3.14')`) + tk.MustExec(`INSERT INTO t(i, j) VALUES (22, '{}')`) + tk.MustExec(`INSERT INTO t(i, j) VALUES (23, '[]')`) + tk.MustExec(`INSERT INTO t(i, j) VALUES (24, CAST(CAST('2015-01-15 23:24:25' AS DATETIME) AS JSON))`) + tk.MustExec(`INSERT INTO t(i, j) VALUES (25, CAST(CAST('23:24:25' AS TIME) AS JSON))`) + tk.MustExec(`INSERT INTO t(i, j) VALUES (26, CAST(CAST('2015-01-15' AS DATE) AS JSON))`) + tk.MustExec(`INSERT INTO t(i, j) VALUES (27, CAST(TIMESTAMP('2015-01-15 23:24:25') AS JSON))`) + tk.MustExec(`INSERT INTO t(i, j) VALUES (28, CAST('[]' AS CHAR CHARACTER SET 'ascii'))`) + + result := tk.MustQuery(`SELECT i, + (j = '"scalar string"') AS c1, + (j = 'scalar string') AS c2, + (j = CAST('"scalar string"' AS JSON)) AS c3, + (j = CAST(CAST(j AS CHAR CHARACTER SET 'utf8mb4') AS JSON)) AS c4, + (j = CAST(NULL AS JSON)) AS c5, + (j = NULL) AS c6, + (j <=> NULL) AS c7, + (j <=> CAST(NULL AS JSON)) AS c8, + (j IN (-1, 2, 32768, 3.14)) AS c9, + (j IN (CAST('[1, 2]' AS JSON), CAST('{}' AS JSON), CAST(3.14 AS JSON))) AS c10, + (j = (SELECT j FROM t WHERE j = CAST('null' AS JSON))) AS c11, + (j = (SELECT j FROM t WHERE j IS NULL)) AS c12, + (j = (SELECT j FROM t WHERE 1<>1)) AS c13, + (j = DATE('2015-01-15')) AS c14, + (j = TIME('23:24:25')) AS c15, + (j = TIMESTAMP('2015-01-15 23:24:25')) AS c16, + (j = CURRENT_TIMESTAMP) AS c17, + (JSON_EXTRACT(j, '$.a') = 2) AS c18 + FROM t + ORDER BY i;`) + result.Check(testkit.Rows("0 1 1 ", + "1 0 0 0 1 0 0 0 0 0 0 0 0 0 1", + "2 0 0 0 1 0 0 0 1 0 0 0 0 0 ", + "3 0 0 0 1 0 0 0 0 0 0 0 0 0 0", + "4 0 0 0 1 0 0 0 0 0 0 0 0 0 ", + "5 0 1 1 1 0 0 0 0 0 0 0 0 0 ", + "6 0 0 0 1 0 0 0 0 0 0 0 0 0 ", + "7 0 0 0 1 0 0 0 0 0 0 0 0 0 ", + "8 0 0 0 1 0 0 0 0 1 0 0 0 0 ", + "9 0 0 0 1 0 0 1 0 0 0 0 0 0 ", + "10 0 0 0 1 0 0 0 0 0 0 0 0 0 ", + "11 0 0 0 1 0 0 0 0 0 0 0 0 0 ", + "12 0 0 0 1 0 0 1 0 0 0 0 0 0 ", + "13 0 0 0 1 0 0 0 0 0 0 0 0 0 ", + "14 0 0 0 1 0 0 0 0 0 0 0 0 0 ", + "15 0 0 0 1 0 0 0 0 0 0 0 0 0 ", + "16 0 0 0 1 0 0 0 0 0 0 0 0 0 ", + "17 0 0 0 1 0 0 0 0 0 0 0 0 0 ", + "18 0 0 0 1 0 0 0 0 0 0 0 0 0 ", + "19 0 0 0 1 0 0 0 0 0 0 0 0 0 ", + "20 0 0 0 1 0 0 0 0 0 0 0 0 0 ", + "21 0 0 0 1 0 0 1 1 0 0 0 0 0 ", + "22 0 0 0 1 0 0 0 1 0 0 0 0 0 ", + "23 0 0 0 1 0 0 0 0 0 0 0 0 0 ", + "24 0 0 0 0 0 0 0 0 0 0 0 1 0 ", + "25 0 0 0 0 0 0 0 0 0 0 1 0 0 ", + "26 0 0 0 0 0 0 0 0 0 1 0 0 0 ", + "27 0 0 0 0 0 0 0 0 0 0 0 1 0 ", + "28 0 0 0 1 0 0 0 0 0 0 0 0 0 ")) + + // for coalesce + result = tk.MustQuery("select coalesce(NULL), coalesce(NULL, NULL), coalesce(NULL, NULL, NULL);") + result.Check(testkit.Rows(" ")) + tk.MustQuery(`select coalesce(cast(1 as json), cast(2 as json));`).Check(testkit.Rows(`1`)) + tk.MustQuery(`select coalesce(NULL, cast(2 as json));`).Check(testkit.Rows(`2`)) + tk.MustQuery(`select coalesce(cast(1 as json), NULL);`).Check(testkit.Rows(`1`)) + tk.MustQuery(`select coalesce(NULL, NULL);`).Check(testkit.Rows(``)) + + tk.MustExec("drop table if exists t2") + tk.MustExec("create table t2(a int, b double, c datetime, d time, e char(20), f bit(10))") + tk.MustExec(`insert into t2 values(1, 1.1, "2017-08-01 12:01:01", "12:01:01", "abcdef", 0b10101)`) + + result = tk.MustQuery("select coalesce(NULL, a), coalesce(NULL, b, a), coalesce(c, NULL, a, b), coalesce(d, NULL), coalesce(d, c), coalesce(NULL, NULL, e, 1), coalesce(f), coalesce(1, a, b, c, d, e, f) from t2") + // coalesce(col_bit) is not same with MySQL, because it's a bug of MySQL(https://bugs.mysql.com/bug.php?id=103289&thanks=4) + result.Check(testkit.Rows(fmt.Sprintf("1 1.1 2017-08-01 12:01:01 12:01:01 %s 12:01:01 abcdef \x00\x15 1", time.Now().In(tk.Session().GetSessionVars().Location()).Format(time.DateOnly)))) + + // nullif + result = tk.MustQuery(`SELECT NULLIF(NULL, 1), NULLIF(1, NULL), NULLIF(1, 1), NULLIF(NULL, NULL);`) + result.Check(testkit.Rows(" 1 ")) + + result = tk.MustQuery(`SELECT NULLIF(1, 1.0), NULLIF(1, "1.0");`) + result.Check(testkit.Rows(" ")) + + result = tk.MustQuery(`SELECT NULLIF("abc", 1);`) + result.Check(testkit.Rows("abc")) + + result = tk.MustQuery(`SELECT NULLIF(1+2, 1);`) + result.Check(testkit.Rows("3")) + + result = tk.MustQuery(`SELECT NULLIF(1, 1+2);`) + result.Check(testkit.Rows("1")) + + result = tk.MustQuery(`SELECT NULLIF(2+3, 1+2);`) + result.Check(testkit.Rows("5")) + + result = tk.MustQuery(`SELECT HEX(NULLIF("abc", 1));`) + result.Check(testkit.Rows("616263")) + + tk.MustExec("drop table if exists t;") + tk.MustExec("create table t(a date)") + result = tk.MustQuery("desc select a = a from t") + result.Check(testkit.Rows( + "Projection_3 10000.00 root eq(test.t.a, test.t.a)->Column#3", + "└─TableReader_5 10000.00 root data:TableFullScan_4", + " └─TableFullScan_4 10000.00 cop[tikv] table:t keep order:false, stats:pseudo", + )) + + // for interval + result = tk.MustQuery(`select interval(null, 1, 2), interval(1, 2, 3), interval(2, 1, 3)`) + result.Check(testkit.Rows("-1 0 1")) + result = tk.MustQuery(`select interval(3, 1, 2), interval(0, "b", "1", "2"), interval("a", "b", "1", "2")`) + result.Check(testkit.Rows("2 1 1")) + result = tk.MustQuery(`select interval(23, 1, 23, 23, 23, 30, 44, 200), interval(23, 1.7, 15.3, 23.1, 30, 44, 200), interval(9007199254740992, 9007199254740993)`) + result.Check(testkit.Rows("4 2 0")) + result = tk.MustQuery(`select interval(cast(9223372036854775808 as unsigned), cast(9223372036854775809 as unsigned)), interval(9223372036854775807, cast(9223372036854775808 as unsigned)), interval(-9223372036854775807, cast(9223372036854775808 as unsigned))`) + result.Check(testkit.Rows("0 0 0")) + result = tk.MustQuery(`select interval(cast(9223372036854775806 as unsigned), 9223372036854775807), interval(cast(9223372036854775806 as unsigned), -9223372036854775807), interval("9007199254740991", "9007199254740992")`) + result.Check(testkit.Rows("0 1 0")) + result = tk.MustQuery(`select interval(9007199254740992, "9007199254740993"), interval("9007199254740992", 9007199254740993), interval("9007199254740992", "9007199254740993")`) + result.Check(testkit.Rows("1 1 1")) + result = tk.MustQuery(`select INTERVAL(100, NULL, NULL, NULL, NULL, NULL, 100);`) + result.Check(testkit.Rows("6")) + result = tk.MustQuery(`SELECT INTERVAL(0,(1*5)/2) + INTERVAL(5,4,3);`) + result.Check(testkit.Rows("2")) + + // for greatest + result = tk.MustQuery(`select greatest(1, 2, 3), greatest("a", "b", "c"), greatest(1.1, 1.2, 1.3), greatest("123a", 1, 2)`) + result.Check(testkit.Rows("3 c 1.3 2")) + tk.MustQuery("show warnings").Check(testkit.Rows()) + result = tk.MustQuery(`select greatest(cast("2017-01-01" as datetime), "123", "234", cast("2018-01-01" as date)), greatest(cast("2017-01-01" as date), "123", null)`) + result.Check(testkit.Rows("234 ")) + tk.MustQuery("show warnings").Check(testkit.RowsWithSep("|", "Warning|1292|Incorrect time value: '123'", "Warning|1292|Incorrect time value: '234'", "Warning|1292|Incorrect time value: '123'")) + // for least + result = tk.MustQuery(`select least(1, 2, 3), least("a", "b", "c"), least(1.1, 1.2, 1.3), least("123a", 1, 2)`) + result.Check(testkit.Rows("1 a 1.1 1")) + tk.MustQuery("show warnings").Check(testkit.Rows()) + result = tk.MustQuery(`select least(cast("2017-01-01" as datetime), "123", "234", cast("2018-01-01" as date)), least(cast("2017-01-01" as date), "123", null)`) + result.Check(testkit.Rows("123 ")) + tk.MustQuery("show warnings").Check(testkit.RowsWithSep("|", "Warning|1292|Incorrect time value: '123'", "Warning|1292|Incorrect time value: '234'", "Warning|1292|Incorrect time value: '123'")) + tk.MustQuery(`select 1 < 17666000000000000000, 1 > 17666000000000000000, 1 = 17666000000000000000`).Check(testkit.Rows("1 0 0")) + + tk.MustExec("drop table if exists t") + + // insert value at utc timezone + tk.MustExec("set time_zone = '+00:00'") + tk.MustExec("create table t(a timestamp)") + tk.MustExec("insert into t value('1991-05-06 04:59:28')") + // check daylight saving time in Asia/Shanghai + tk.MustExec("set time_zone='Asia/Shanghai'") + tk.MustQuery("select * from t").Check(testkit.Rows("1991-05-06 13:59:28")) + // insert an nonexistent time + tk.MustExec("set time_zone = 'America/Los_Angeles'") + tk.MustExecToErr("insert into t value('2011-03-13 02:00:00')") + // reset timezone to a +8 offset + tk.MustExec("set time_zone = '+08:00'") + tk.MustQuery("select * from t").Check(testkit.Rows("1991-05-06 12:59:28")) + + tk.MustExec("drop table if exists t") + tk.MustExec("create table t(a bigint unsigned)") + tk.MustExec("insert into t value(17666000000000000000)") + tk.MustQuery("select * from t where a = 17666000000000000000").Check(testkit.Rows("17666000000000000000")) + + // test for compare row + result = tk.MustQuery(`select row(1,2,3)=row(1,2,3)`) + result.Check(testkit.Rows("1")) + result = tk.MustQuery(`select row(1,2,3)=row(1+3,2,3)`) + result.Check(testkit.Rows("0")) + result = tk.MustQuery(`select row(1,2,3)<>row(1,2,3)`) + result.Check(testkit.Rows("0")) + result = tk.MustQuery(`select row(1,2,3)<>row(1+3,2,3)`) + result.Check(testkit.Rows("1")) + result = tk.MustQuery(`select row(1+3,2,3)<>row(1+3,2,3)`) + result.Check(testkit.Rows("0")) +} + func TestRegexpPushdown(t *testing.T) { store := testkit.CreateMockStore(t) diff --git a/tests/integrationtest/r/expression/builtin.result b/tests/integrationtest/r/expression/builtin.result index a69697cc4d9c3a766fbe6493fb84bd4aca050b54..27aeeed6873d47d1eca1c547160c3f2e57308608 100644 GIT binary patch delta 21 dcmaEPknO`~)`l&Nb&-=3P6}@CXkbiK004O339|qI delta 8819 zcmb_h&2JmW6))39@veiwuI*R`l6t%;O43@&JG1-{Da$RZ(6Cy4I24`6Fbs9ITG^B- zQ6VX(ZP2WJDbQ0t)`+g{p{HC@phkL1n?r%#n*ShZPVK2J`VaKInf;huF14~zeUQ8F z{oZfhy!U2yX7=Czees{4O+ETU?t|NhzkEA)%H4lJx_cu+R@XXY_15w-x!GP?X|`{Z z@3(G~=B>`!#?tCyyS36GJUFmy*9M1o;4uD(V)9`PlIl_ zN5-%UHlx9TlhxlE;I^&aFcUZjz`cWBFC@G^A$xTImS_l@fTED(#pZgaaCoVmJL8h( zx~PndJW@=$$!gVFW&@aVM9yU*P2B~TkB7xva%er17SqOPxmKPttL3Bpb)o7hrYyu~ zdySbZJp&#S7~$jYpHCTu6cXv>-hK6rjFd3QB;d}v)vSmxp1fIF&IDra-p?FY3=^30%>l0i$fLYUcLj-xzL04PIKjEK_ZO0oXr>zLgk3aL98)0i#M8W{?T0QwAy67 z)ggIn=-SXW$Ho>n+EFG#Fpn?+00jpW|MPYlpoGy3h-Ge zf;)kmUg^ZNEA^Bclx24QdW8e$MKv6K)1qL8~h!H5l%%7A&=wUQqtFjDPLYYqo)2fJi!Oy}Dx$d^tR>+9_ z;6|(6f(P(|pG-cPkJ$%lk?iBWB54c6UA)z9!y;rOwDSR&K@8|d>zz&;YPqlj^T{`7EhxeT!hF!2 zdYuPAU2DGy#s1yfq&u&66`LwHQ*2YQ%Zgo5?5bkd6njpw>!32=AM_Le)Kt#d6fhJ( z6i^gkbWSzAk3YTO{pr)GuTq8j*DBnrp8MI9OBI9vQU%LOdhm;Jdmf{?gprFu58|EXH21HbunLSs z^2U40ji5HfZyIfos95{L>{%;9SWT*mqg^!JWB3^K7JDNad#=)eVKE*Lzy1PhQ6T~r zH1=G@0b_5xv4A%SK6EVTf6!R6KIFbjW#K^jma)PSA7hfo@0-Q-M4zq&~^&gU{UAy_dJ~wyx`PXuPL5F4Fev=FN^k{QW|oXPZt_AIoZoCY+saqYDKyxmpc_lq`PdUt^99f@UP0s{ z0R}aO=ZJYVlDQClTI5p)kOmymeWXMqzYR_xuZD~1Azv`<~Qvl6uxc} zEenL8MpS~+Kg*&KM<`JtObIldfxU}__3u?Pfx{y?&_$&FJ&ZYjJK{UcW?<_cLxvKy z5@2t%-r`*%j&2M_Op??B!dDGwZHpY#V?t}|%xqdXl>39Zqvu|ISU zw)(-01ZTC*;Gxwk;KmQ45Bp50sZfgdurrlKm~<3D#8PaPQ0SYw#YhyGswI5DhR=b} z1k;~z0FIHwnJd-cifOVZaLSw1N>2G?a{FUsk!vYjuzP|zWh_v5zJy-FSMYBFaT$)2 zn1KT_><&k|vvBf4E3+Ivi;+tQ*A1ga>vdLvqd^0{b&`<8BA($y)GxM$?jGesgiSP< z<^t^WV0Aba6YsZA&wJl__)1Rqe)DwN`}4soC#67mkJ*_QYC;8|nCjBE&iO{5d08&1 zaZWWVr39s{i7`$WRlZD1_qhK@^!V{7=T1slPbOM#E4gALIy=D zm0?7O4XIJIBL#2Atwp^%ZZps~7)WD%OZo$YBq1{6;|R5`TzoLDk`_lrf#Enz8pNWI zP(o=X@hzBbQb68P@z#~;v|V|;7lkF*p*Nc=Z@sCrsC9j!5t}L)Np2G z!}7~inD==5vKzAU#kMBaWE9q98g3cj3FnNuyAC*tBv?DlEW=lb#^sxgF3NohQLxU7 zqXIsc;KNMr??jtt^&{&4M9QN6^`Kwe4HY`4c&B@L@6qpGa(fQnONH4L_wnfK#78C4 z>SNbVda8 zvhkDto&)gwjA1kkBk!I5)foj9un64U_fCEEs$0mzln)~aUVBxEQEpV~4aQ$E#yA%8 z&0*KNvVPy%yLaE}=EJ@0<#6R}sS*)21ra=z5}q`7ok7>Ot}OS58_m6YFTzR35d8Y+ z+5#v8nPEdtAivit};-lp8-eY5DB j`l^J#zBG>U8&1{n#-)@kz~&LaN NULL) AS c7, - (j <=> CAST(NULL AS JSON)) AS c8, - (j IN (-1, 2, 32768, 3.14)) AS c9, - (j IN (CAST('[1, 2]' AS JSON), CAST('{}' AS JSON), CAST(3.14 AS JSON))) AS c10, - (j = (SELECT j FROM t WHERE j = CAST('null' AS JSON))) AS c11, - (j = (SELECT j FROM t WHERE j IS NULL)) AS c12, - (j = (SELECT j FROM t WHERE 1<>1)) AS c13, - (j = DATE('2015-01-15')) AS c14, - (j = TIME('23:24:25')) AS c15, - (j = TIMESTAMP('2015-01-15 23:24:25')) AS c16, - (j = CURRENT_TIMESTAMP) AS c17, - (JSON_EXTRACT(j, '$.a') = 2) AS c18 - FROM t - ORDER BY i; -select coalesce(NULL), coalesce(NULL, NULL), coalesce(NULL, NULL, NULL); -select coalesce(cast(1 as json), cast(2 as json)); -select coalesce(NULL, cast(2 as json)); -select coalesce(cast(1 as json), NULL); -select coalesce(NULL, NULL); -drop table if exists t2; -create table t2(a int, b double, c datetime, d time, e char(20), f bit(10)); -insert into t2 values(1, 1.1, "2017-08-01 12:01:01", "12:01:01", "abcdef", 0b10101); -select coalesce(NULL, a), coalesce(NULL, b, a), coalesce(c, NULL, a, b), coalesce(d, NULL), coalesce(d, c), coalesce(NULL, NULL, e, 1), coalesce(f), coalesce(1, a, b, c, d, e, f) from t2; -SELECT NULLIF(NULL, 1), NULLIF(1, NULL), NULLIF(1, 1), NULLIF(NULL, NULL); -SELECT NULLIF(1, 1.0), NULLIF(1, "1.0"); -SELECT NULLIF("abc", 1); -SELECT NULLIF(1+2, 1); -SELECT NULLIF(1, 1+2); -SELECT NULLIF(2+3, 1+2); -SELECT HEX(NULLIF("abc", 1)); -drop table if exists t; -create table t(a date); -desc select a = a from t; -select interval(null, 1, 2), interval(1, 2, 3), interval(2, 1, 3); -select interval(3, 1, 2), interval(0, "b", "1", "2"), interval("a", "b", "1", "2"); -select interval(23, 1, 23, 23, 23, 30, 44, 200), interval(23, 1.7, 15.3, 23.1, 30, 44, 200), interval(9007199254740992, 9007199254740993); -select interval(cast(9223372036854775808 as unsigned), cast(9223372036854775809 as unsigned)), interval(9223372036854775807, cast(9223372036854775808 as unsigned)), interval(-9223372036854775807, cast(9223372036854775808 as unsigned)); -select interval(cast(9223372036854775806 as unsigned), 9223372036854775807), interval(cast(9223372036854775806 as unsigned), -9223372036854775807), interval("9007199254740991", "9007199254740992"); -select interval(9007199254740992, "9007199254740993"), interval("9007199254740992", 9007199254740993), interval("9007199254740992", "9007199254740993"); -select INTERVAL(100, NULL, NULL, NULL, NULL, NULL, 100); -SELECT INTERVAL(0,(1*5)/2) + INTERVAL(5,4,3); -select greatest(1, 2, 3), greatest("a", "b", "c"), greatest(1.1, 1.2, 1.3), greatest("123a", 1, 2); -show warnings; -select greatest(cast("2017-01-01" as datetime), "123", "234", cast("2018-01-01" as date)), greatest(cast("2017-01-01" as date), "123", null); -show warnings; -select least(1, 2, 3), least("a", "b", "c"), least(1.1, 1.2, 1.3), least("123a", 1, 2); -show warnings; -select least(cast("2017-01-01" as datetime), "123", "234", cast("2018-01-01" as date)), least(cast("2017-01-01" as date), "123", null); -show warnings; -select 1 < 17666000000000000000, 1 > 17666000000000000000, 1 = 17666000000000000000; -drop table if exists t; -set time_zone = '+00:00'; -create table t(a timestamp); -insert into t value('1991-05-06 04:59:28'); -set time_zone='Asia/Shanghai'; -select * from t; -set time_zone = 'America/Los_Angeles'; --- error 1292 -insert into t value('2011-03-13 02:00:00'); -set time_zone = '+08:00'; -select * from t; -drop table if exists t; -create table t(a bigint unsigned); -insert into t value(17666000000000000000); -select * from t where a = 17666000000000000000; -select row(1,2,3)=row(1,2,3); -select row(1,2,3)=row(1+3,2,3); -select row(1,2,3)<>row(1,2,3); -select row(1,2,3)<>row(1+3,2,3); -select row(1+3,2,3)<>row(1+3,2,3); -set time_zone=default - # TestNullifWithIsNull # issue 23157: make sure if Nullif expr is correct combined with IsNull expr. drop table if exists t;