[
https://issues.apache.org/jira/browse/CALCITE-7611?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18090394#comment-18090394
]
Julian Hyde commented on CALCITE-7611:
--------------------------------------
Do all of these variants use the same dialect of regular expressions? (E.g.
Java, PCRE - Perl Compatible Regular Expressions, POSIX)
> Support MySQL-style infix REGEXP operator
> -----------------------------------------
>
> Key: CALCITE-7611
> URL: https://issues.apache.org/jira/browse/CALCITE-7611
> Project: Calcite
> Issue Type: Improvement
> Components: core
> Affects Versions: 1.38.0
> Reporter: yibo wen
> Priority: Major
> Original Estimate: 336h
> Remaining Estimate: 336h
>
> Calcite supports regular-expression matching through RLIKE and the REGEXP
> library function, but the parser does not currently accept MySQL-style infix
> REGEXP expressions.
> Example:
> SELECT *
> FROM emp
> WHERE name REGEXP '^A.*';
> Expected behavior:
> In MySQL/Hive/Spark-compatible SQL libraries or conformances, Calcite
> should parse and validate infix REGEXP expressions similarly to RLIKE.
> Related syntax:
> NOT REGEXP should also be supported, for example:
> SELECT *
> FROM emp
> WHERE name NOT REGEXP '^A.*';
> It should be equivalent to:
> WHERE NOT (name REGEXP '^A.*')
> Motivation:
> MySQL supports expr REGEXP pattern. Hive and Spark users also commonly use
> regular-expression predicates in infix form. Supporting this syntax would
> improve dialect compatibility.
> Possible implementation direction:
> Add parser support for infix REGEXP and NOT REGEXP, map REGEXP to an
> RLIKE-like operator, and add parser/validator tests for the supported
> libraries.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)