[
https://issues.apache.org/jira/browse/CALCITE-7906?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18134869#comment-18134869
]
Ruben Q L commented on CALCITE-7906:
------------------------------------
[~julianhyde] I have added some examples to the description, together with the
current regex. The new algorithm will not be based on regex, but on a simpler
"segment matching algorithm" (since we do not need to support all the
capabilities of regex, just % and _ ).
The target class (LikePattern) is not used in query execution, but on the
schema lookup (e.g. to retrieve a subset of the tables in the schema), no I'm
not sure we can provide a quidem test for this.
> LikePattern matching time grows exponentially with the number of '%' wildcards
> ------------------------------------------------------------------------------
>
> Key: CALCITE-7906
> URL: https://issues.apache.org/jira/browse/CALCITE-7906
> Project: Calcite
> Issue Type: Improvement
> Components: core
> Reporter: Ruben Q L
> Assignee: Ruben Q L
> Priority: Major
> Labels: pull-request-available
> Fix For: 1.43.0
>
>
> LikePattern.likeToRegex turns each % into .* and matches with
> java.util.regex. For example:
> {noformat}
> %%%%%%%%%%x => .*.*.*.*.*.*.*.*.*.*x
> %a%a%a%a%a%a%a%a%a%a%x => .*a.*a.*a.*a.*a.*a.*a.*a.*a.*a.*x
> {noformat}
> A pattern with many wildcards makes the regex engine backtrack heavily when
> the name doesn't match.
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)