From 2f298de1c473478158a87ce1ecf5263a7134bc5d Mon Sep 17 00:00:00 2001 From: Julong-Li <584147810@qq.com> Date: Tue, 21 Nov 2023 20:08:15 +0800 Subject: [PATCH] =?UTF-8?q?5.0.0=E5=9B=9E=E5=90=88issue=E4=BF=AE=E6=94=B9:?= =?UTF-8?q?=E5=85=81=E8=AE=B8=E8=BF=9E=E7=BB=AD=E7=9A=84=E6=93=8D=E4=BD=9C?= =?UTF-8?q?=E7=AC=A6=E5=87=BA=E7=8E=B0=E4=BB=A5=E5=85=BC=E5=AE=B9mysql?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../expected/operator_associativity.out | 107 ++++++++++++++++++ contrib/dolphin/parallel_schedule_dolphin | 2 +- contrib/dolphin/plugin_parser/gram.y | 3 +- .../dolphin/sql/operator_associativity.sql | 29 +++++ 4 files changed, 139 insertions(+), 2 deletions(-) create mode 100644 contrib/dolphin/expected/operator_associativity.out create mode 100644 contrib/dolphin/sql/operator_associativity.sql diff --git a/contrib/dolphin/expected/operator_associativity.out b/contrib/dolphin/expected/operator_associativity.out new file mode 100644 index 000000000..413cdb43c --- /dev/null +++ b/contrib/dolphin/expected/operator_associativity.out @@ -0,0 +1,107 @@ +create table test_op_associativity(a int); +insert into test_op_associativity values (12); +insert into test_op_associativity values (12); +set dolphin.sql_mode = ''; +select * from test_op_associativity where (length(a) > 1 || length(a) >1); + a +---- + 12 + 12 +(2 rows) + +set dolphin.sql_mode = 'pipes_as_concat'; +select * from test_op_associativity where (length(a) > 1 || length(a) >1); + a +--- +(0 rows) + +select 1 < 2 < 3; + ?column? +---------- + t +(1 row) + +select 2 < 1 < 3; + ?column? +---------- + t +(1 row) + +select 2 < (1 < 3); + ?column? +---------- + f +(1 row) + +select 3 > 2 > 1; + ?column? +---------- + f +(1 row) + +select -2 > -3 > 0; + ?column? +---------- + t +(1 row) + +select -2 > (-3 > 0); + ?column? +---------- + f +(1 row) + +select 1 <= 2 <= 2; + ?column? +---------- + t +(1 row) + +select 2 <= 1 <= 2; + ?column? +---------- + t +(1 row) + +select 2 <= (1 <= 2); + ?column? +---------- + f +(1 row) + +select 3 >= 2 >= 1; + ?column? +---------- + t +(1 row) + +select -2 >= -3 >= 0; + ?column? +---------- + t +(1 row) + +select -2 >= (-3 >= 0); + ?column? +---------- + f +(1 row) + +select 1 != 1 != 1; + ?column? +---------- + t +(1 row) + +select 1 != 0 != 1; + ?column? +---------- + f +(1 row) + +select 2 != 1 != 0; + ?column? +---------- + t +(1 row) + diff --git a/contrib/dolphin/parallel_schedule_dolphin b/contrib/dolphin/parallel_schedule_dolphin index 5e4b7dd3d..11be232b3 100644 --- a/contrib/dolphin/parallel_schedule_dolphin +++ b/contrib/dolphin/parallel_schedule_dolphin @@ -140,7 +140,7 @@ test: test_uuid_short test_sleep distinct dual_test fulltext_index test_text2boo test: operator_compatibility_test/numeric_operator_test_normal operator_compatibility_test/numeric_operator_test_min operator_compatibility_test/numeric_operator_test_max operator_compatibility_test/time_operator_test operator_compatibility_test/string_operator_test operator_compatibility_test/multi_type_operator_test -test: test_show_status pad_char_to_full_length timestamp_test test_mediumtext ai sqlmode_strict +test: test_show_status pad_char_to_full_length timestamp_test test_mediumtext ai sqlmode_strict operator_associativity # lock tables test: lock_tables lock_tables_1 diff --git a/contrib/dolphin/plugin_parser/gram.y b/contrib/dolphin/plugin_parser/gram.y index 7927cfbbf..dd804498e 100644 --- a/contrib/dolphin/plugin_parser/gram.y +++ b/contrib/dolphin/plugin_parser/gram.y @@ -1291,7 +1291,8 @@ static inline void ChangeBpcharCastType(TypeName* typname); %left AND %right NOT %right '=' CmpNullOp COLON_EQUALS -%nonassoc '<' '>' CmpOp BINARY +%left '<' '>' CmpOp +%nonassoc BINARY %nonassoc LIKE ILIKE SIMILAR SOUNDS NOT_LIKE NOT_ILIKE NOT_SIMILAR %nonassoc ESCAPE %nonassoc OVERLAPS diff --git a/contrib/dolphin/sql/operator_associativity.sql b/contrib/dolphin/sql/operator_associativity.sql new file mode 100644 index 000000000..a055636b1 --- /dev/null +++ b/contrib/dolphin/sql/operator_associativity.sql @@ -0,0 +1,29 @@ +create table test_op_associativity(a int); +insert into test_op_associativity values (12); +insert into test_op_associativity values (12); + +set dolphin.sql_mode = ''; +select * from test_op_associativity where (length(a) > 1 || length(a) >1); + +set dolphin.sql_mode = 'pipes_as_concat'; +select * from test_op_associativity where (length(a) > 1 || length(a) >1); + +select 1 < 2 < 3; +select 2 < 1 < 3; +select 2 < (1 < 3); + +select 3 > 2 > 1; +select -2 > -3 > 0; +select -2 > (-3 > 0); + +select 1 <= 2 <= 2; +select 2 <= 1 <= 2; +select 2 <= (1 <= 2); + +select 3 >= 2 >= 1; +select -2 >= -3 >= 0; +select -2 >= (-3 >= 0); + +select 1 != 1 != 1; +select 1 != 0 != 1; +select 2 != 1 != 0; -- Gitee