You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@druid.apache.org by "gianm (via GitHub)" <gi...@apache.org> on 2024/04/01 21:03:41 UTC

Re: [PR] Improve worst-case performance of LIKE filters by 20x (druid)

gianm commented on PR #16153:
URL: https://github.com/apache/druid/pull/16153#issuecomment-2030550437

   For `LIKE` it seems reasonable to have an optimized matcher specifically geared towards the needs of `LIKE`. I am disappointed that the JDK regexp library doesn't handle these relatively simple cases well. I would have hoped that it could realize that `.*.*` is equivalent to `.*` and not blow up runtime with naive matching.
   
   For `REGEXP_LIKE`, the possibility of runtime blowup has always been there, as you point out. I'm not aware of a regexp library for Java that is equivalent to `java.util.Pattern` but does not have any possibility of runtime blowup. I am not even sure if it's possible. As I understand it, regexp libraries that guarantee no runtime blowup tend to achieve that by limiting the pattern syntax somewhat. (Does `joni` guarantee no runtime blowup, btw? I don't see a note about that on its page.)
   
   Assuming such a library doesn't exist, probably good approaches would be optionally using an alternative library, or @abhishekagarwal87's suggestion (detecting runtime blowup and throwing an error). But that's out of scope for this particular PR anyway, so let's focus on the `LIKE` situation.


-- 
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: commits-unsubscribe@druid.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org