From 23d03a1b1e486da353f20964a1b91068bec209c0 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Mon, 27 Jun 2016 15:41:51 +0200 Subject: parse negative numbers into one item use Item->neg to convert generate negative Item_num's instead of Item_func_neg(Item_num). Based on the following commit: Author: Monty Date: Mon May 30 22:44:00 2016 +0300 Make negative number their own token The negation (-) operator will call Item->neg() one underlying numeric constants and remove itself (like the NOT() function does today for other NOT functions. This simplifies things - -1 is not anymore an expression but a basic_const_item - improves optimizer - DEFAULT -1 doesn't need special handling anymore - When we add DEFAULT expressions, -1 will be treated exactly like 1 - printing of items doesn't anymore put braces around all negative numbers Other things fixed: - Fixed that longlong converted to decimal's has a more appropriate size - Fixed that "-0.0" read into a decimal is interpreted as 0.0 --- mysql-test/r/func_op.result | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'mysql-test/r/func_op.result') diff --git a/mysql-test/r/func_op.result b/mysql-test/r/func_op.result index ce755e86b4c..0d738570035 100644 --- a/mysql-test/r/func_op.result +++ b/mysql-test/r/func_op.result @@ -5,7 +5,7 @@ explain extended select 1+1,1-1,1+1*2,8/5,8%5,mod(8,5),mod(8,5)|0,-(1+1)*-2; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: -Note 1003 select (1 + 1) AS `1+1`,(1 - 1) AS `1-1`,(1 + (1 * 2)) AS `1+1*2`,(8 / 5) AS `8/5`,(8 % 5) AS `8%5`,(8 % 5) AS `mod(8,5)`,((8 % 5) | 0) AS `mod(8,5)|0`,(-((1 + 1)) * -(2)) AS `-(1+1)*-2` +Note 1003 select (1 + 1) AS `1+1`,(1 - 1) AS `1-1`,(1 + (1 * 2)) AS `1+1*2`,(8 / 5) AS `8/5`,(8 % 5) AS `8%5`,(8 % 5) AS `mod(8,5)`,((8 % 5) | 0) AS `mod(8,5)|0`,(-((1 + 1)) * -2) AS `-(1+1)*-2` select 1 | (1+1),5 & 3,bit_count(7) ; 1 | (1+1) 5 & 3 bit_count(7) 3 1 3 -- cgit v1.2.1