[ 
https://issues.apache.org/jira/browse/CALCITE-6278?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17824994#comment-17824994
 ] 

Julian Hyde commented on CALCITE-6278:
--------------------------------------

I think by 'unescaping' you mean handling backslashes in character literals. In 
Spark and Hive, backslashes have a special meaning in character literals. In 
Calcite, they don't.

(There was another discussion recently about the ESCAPE clause and escape 
characters in LIKE. It gets very confusing especially when we are trying to 
emulate MySQL. But I don't think you are talking about that. See CALCITE-6180.)

It doesn't make sense to deal with backslashes in the {{RLIKE}} function. Spark 
and Hive don't do it, and neither should Calcite. Think of it this way: If I 
have a table {{t}} with string columns {{x}} and {{y}}:

{code}
CREATE TABLE t (x VARCHAR(20), y VARCHAR(20);
{code}
I should be able to apply {{RLIKE}} to those strings:
{code}
SELECT *
FROM t
WHERE x RLIKE y
{code}

Unescaping may have happened when I populated that table, but no unescaping 
happens when I execute that SELECT query.

> Add REGEXP, REGEXP_LIKE  function (enabled in Spark library)
> ------------------------------------------------------------
>
>                 Key: CALCITE-6278
>                 URL: https://issues.apache.org/jira/browse/CALCITE-6278
>             Project: Calcite
>          Issue Type: Improvement
>            Reporter:  EveyWu
>            Priority: Minor
>              Labels: pull-request-available
>         Attachments: image-2024-03-07-09-32-27-002.png, 
> image-2024-03-09-11-13-49-064.png, image-2024-03-09-11-37-27-816.png, 
> image-2024-03-09-11-38-08-797.png
>
>
> Add Spark functions that have been implemented but have different 
> OperandTypes/Returns.
> Add Function 
> [REGEXP|https://spark.apache.org/docs/latest/api/sql/index.html#regexp], 
> [REGEXP_LIKE|https://spark.apache.org/docs/latest/api/sql/index.html#regexp_like]
>  # Since this function has the same implementation as the Spark 
> [RLIKE|https://spark.apache.org/docs/latest/api/sql/index.html#rlike] 
> function, the implementation can be directly reused.
>  # Since Spark 2.0, string literals (including regex patterns) are unescaped 
> in SQL parser, also fix this bug in calcite.
>  
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to