[MDEV-6309] incorrect result of EXISTS subquery with InnoDB & FTS Created: 2014-06-05 Updated: 2022-09-12 Resolved: 2022-09-12 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | OTHER |
| Affects Version/s: | 10.0.11 |
| Fix Version/s: | N/A |
| Type: | Bug | Priority: | Major |
| Reporter: | Oleksandr Byelkin | Assignee: | Oleksandr Byelkin |
| Resolution: | Won't Fix | Votes: | 1 |
| Labels: | upstream | ||
| Sprint: | 10.0.20, 10.0.24, 10.0.25, 10.0.26 |
| Description |
|
innodb_fts: fulltext.rsult
(pay attention to the comment) test suite:
|
| Comments |
| Comment by Oleksandr Byelkin [ 2014-06-08 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
With in2exists it returns corrrect result. Incorrect result was written in the test before. | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Oleksandr Byelkin [ 2016-02-10 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Result of the query depends on engine implementation of FULLTEXT. InnoDB return 1, MyISAM return 0 with exists_to_in=on the subquery is materialized so in fact it is MyISAM and so result is 0 (as for MyISAM) | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Oleksandr Byelkin [ 2016-02-10 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Original test suite is correct
- | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Oleksandr Byelkin [ 2016-02-11 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
It looks like MATCH itself works more or less OK (at least calculate non zero val_real()) | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Oleksandr Byelkin [ 2016-02-15 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
oops I was wrong. MyISAM result is OK but innoDB is wrong | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Oleksandr Byelkin [ 2016-02-15 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
So the problem is that in case of not patch myisam return 0, but innodb: | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Oleksandr Byelkin [ 2016-02-15 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
So problem is on innodb side. in binary mode it should return clear zero on mismatch. Innodb create different parser for binary more but how it work is not clear. | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Oleksandr Byelkin [ 2016-02-16 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
New test suite. Bug repeatable on MySQL 5.7 (set optimizer switch should be removed, but without it 5.7 acts as MariaDB, because 5.7 has no exists2in).
| ||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Oleksandr Byelkin [ 2016-06-20 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Conclusion: 1. if change Scargill -> scargill (or make all upper case) both engine report exact match so boolean match work correctly in this case | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Oleksandr Byelkin [ 2017-01-03 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
The problem as I can see it in incorrect reaction of innodb in boolean mode (should return 1/0 but not something other). (of course there is a probability that I am wrong) | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Marko Mäkelä [ 2017-01-09 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
I am not very familiar with the InnoDB fulltext search implementation.
The float data type aka fts_rank_t should have no problem representing the values 0 and 1 accurately. should have no problem representing the values 0 and 1 accurately. I did not check if or how the numbers would get mangled further on they way towards the server layer. | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Marko Mäkelä [ 2017-01-09 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
In http://dev.mysql.com/doc/internals/en/full-text-search.html, I cannot see any justification for the calculation
which could be written shorter as
I guess we should not only make InnoDB aware of FT_BOOL, but also make all calculations match those of MyISAM. And in the long term, remove all the duplicated code. | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Sergei Golubchik [ 2017-01-10 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
It doesn't look like InnoDB FTS issue. Set a breakpoint on Item_func_match::val_int — you'll see that both InnoDB and MyISAM return 1. But why Item_func_match::val_int is called twice for MyISAM and only once for InnoDB? | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Sergei Golubchik [ 2022-09-12 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
10.0 was EOLed in March 2019 |