yibo wen created CALCITE-7611:
---------------------------------

             Summary: 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


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)

Reply via email to