tanruixiang commented on issue #7185:
URL: 
https://github.com/apache/arrow-datafusion/issues/7185#issuecomment-1664050608

   > `_` has special meaning in SQL regex syntax, specifically matching any 
single character. Thus I am not sure the rewrite you propose is correct
   
   Hi @alamb, Thank you very much for your reply.
   `_`  has special meaning just in `Like`, Postgres(or mysql) use the `~` to  
do the regex match.
   If it's just the test cases I've given, there should be no correctness 
issues, but I'm not sure if the current complex datafusion rewrite rules cause 
`Like` to be hidden. Strings with `_` should be very common in the data, and if 
the current optimization framework doesn't support it, maybe we need to 
redesign the optimization framework.
   
   ```
   test_db=> select 'id_1'  ~  '^(id_1)$';
    ?column?
   ----------
    t
   (1 row)
   
   test_db=> select 'id1'  ~  '^(id_1)$';
    ?column?
   ----------
    f
   (1 row)
   
   test_db=> select 'id%1'  ~  '^(id_1)$';
    ?column?
   ----------
    f
   (1 row)
   
   test_db=> select 'idt1'  ~ '^(id_1)$';
    ?column?
   ----------
    f
   (1 row)
   ``


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to