doris icon indicating copy to clipboard operation
doris copied to clipboard

[Bug] fuzzy matching error of like '%%'

Open boluoge opened this issue 1 year ago • 1 comments

Search before asking

  • [X] I had searched in the issues and found no similar issues.

Version

doris-2.0.3

What's Wrong?

the match result is error,in my example,‘gzt’ should not be match

What You Expected?

What is the reason for this error?

How to Reproduce?

select 'DCache.LiveLinkWanzhePanelDataKKV_gzt_MKVCacheServer3' like 'DCache.LiveLinkWanzhePanelData_%MKVCacheServer%'

Anything Else?

No response

Are you willing to submit PR?

  • [ ] Yes I am willing to submit a PR!

Code of Conduct

boluoge avatar May 31 '24 03:05 boluoge

Sorry, there was an error in my description of What's Wrong. Please correct it as follows: ‘KKV’ should not be match

boluoge avatar May 31 '24 03:05 boluoge

the underscore (_) represents a single character. refer to doris - like I guess you want to use the literal underscore (_), so u should prepend it with a backslash: \_.
such as:

mysql> select 'DCache.LiveLinkWanzhePanelDataKKV_gzt_MKVCacheServer3' like 'DCache.LiveLinkWanzhePanelData_%MKVCacheServer%';
+------------------------------------------------------------------------------------------------------------------+
| ('DCache.LiveLinkWanzhePanelDataKKV_gzt_MKVCacheServer3' like 'DCache.LiveLinkWanzhePanelData_%MKVCacheServer%') |
+------------------------------------------------------------------------------------------------------------------+
|                                                                                                                1 |
+------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)
mysql> select 'DCache.LiveLinkWanzhePanelDataKKV_gzt_MKVCacheServer3' like 'DCache.LiveLinkWanzhePanelData\_%MKVCacheServer%';
+-------------------------------------------------------------------------------------------------------------------+
| ('DCache.LiveLinkWanzhePanelDataKKV_gzt_MKVCacheServer3' like 'DCache.LiveLinkWanzhePanelData\_%MKVCacheServer%') |
+-------------------------------------------------------------------------------------------------------------------+
|                                                                                                                 0 |
+-------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)

Dragonliu2018 avatar May 31 '24 12:05 Dragonliu2018