← Back to team overview

maria-developers team mailing list archive

Igor please "review" : 768b5f70b59: Fix Item_func::is_simplifed_cond_processor

 

Hello Igor,

Could you please checkout the below patch?  I've stumbled upon behavior
of Item_func::is_simplifed_cond_processor which looks bad but I'm not
sure if this way to fix it is correct.


revision-id: 9149fcb8d504d7c1b027024df63c8120a65a7751 (mariadb-10.4.22-82-g9149fcb8d50)
parent(s): b915f79e4e004fde4f6ac8f341afee980e11792b
author: Sergei Petrunia
committer: Sergei Petrunia
timestamp: 2022-01-27 22:58:11 +0300
message:

Fix Item_func::is_simplifed_cond_processor

The comment for that function says:

    TRUE if the function is knowingly TRUE or FALSE.

I don't get why one would need to check for "!val_int()" in this case.

---
 mysql-test/main/having_cond_pushdown.result | 6 ------
 sql/item_func.h                             | 2 +-
 2 files changed, 1 insertion(+), 7 deletions(-)

diff --git a/mysql-test/main/having_cond_pushdown.result b/mysql-test/main/having_cond_pushdown.result
index 9b124296e3d..aade383a71f 100644
--- a/mysql-test/main/having_cond_pushdown.result
+++ b/mysql-test/main/having_cond_pushdown.result
@@ -3194,7 +3194,6 @@ EXPLAIN
 {
   "query_block": {
     "select_id": 1,
-    "const_condition": "1",
     "table": {
       "table_name": "t1",
       "access_type": "ALL",
@@ -3536,7 +3535,6 @@ EXPLAIN
 {
   "query_block": {
     "select_id": 1,
-    "const_condition": "1 and 1",
     "table": {
       "table_name": "t1",
       "access_type": "ALL",
@@ -3663,7 +3661,6 @@ EXPLAIN
 {
   "query_block": {
     "select_id": 1,
-    "const_condition": "1",
     "table": {
       "table_name": "t1",
       "access_type": "ALL",
@@ -3791,7 +3788,6 @@ EXPLAIN
 {
   "query_block": {
     "select_id": 1,
-    "const_condition": "1",
     "filesort": {
       "sort_key": "t1.c",
       "temporary_table": {
@@ -3859,7 +3855,6 @@ EXPLAIN
 {
   "query_block": {
     "select_id": 1,
-    "const_condition": "1 and 1",
     "table": {
       "table_name": "t1",
       "access_type": "ALL",
@@ -3977,7 +3972,6 @@ EXPLAIN
 {
   "query_block": {
     "select_id": 1,
-    "const_condition": "1",
     "table": {
       "table_name": "t3",
       "access_type": "ALL",
diff --git a/sql/item_func.h b/sql/item_func.h
index b368e5872fe..2b02971d940 100644
--- a/sql/item_func.h
+++ b/sql/item_func.h
@@ -399,7 +399,7 @@ class Item_func :public Item_func_or_sum,
   With_sum_func_cache* get_with_sum_func_cache() { return this; }
   Item_func *get_item_func() { return this; }
   bool is_simplified_cond_processor(void *arg)
-  { return const_item() && !val_int(); }
+  { return const_item() /*&& !val_int();*/; }
 };
 
 
BR
 Sergei
-- 
Sergei Petrunia, Software Developer
MariaDB Corporation | Skype: sergefp | Blog: http://petrunia.net