[
https://issues.apache.org/jira/browse/CALCITE-5684?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17719259#comment-17719259
]
Benchao Li edited comment on CALCITE-5684 at 5/5/23 3:13 PM:
-------------------------------------------------------------
[~zineeddine998] What the version of Calcite are using? And do you have any
extensions to the Parser? I'm asking because I cannot reproduce your problem
with below SQL on the current main branch:
{code:sql}
select case when emps.city is not null then '' else emps.name end name from
emps where (name like '%r%');
{code}
was (Author: libenchao):
[~zineeddine998] That the version of Calcite are using? And do you have any
extensions to the Parser? I'm asking because I cannot reproduce your problem
with below SQL on the current main branch:
{code:sql}
select case when emps.city is not null then '' else emps.name end name from
emps where (name like '%r%');
{code}
> Parser fails to differentiate between empty string '' and escaped string
> literal single quote
> ---------------------------------------------------------------------------------------------
>
> Key: CALCITE-5684
> URL: https://issues.apache.org/jira/browse/CALCITE-5684
> Project: Calcite
> Issue Type: New Feature
> Components: core
> Reporter: Zine eddine Zidane
> Priority: Blocker
>
> In the example query below (redshift):
>
> {code:java}
> SELECT CASE WHEN table.columnA IS NOT NULL THEN '' ELSE table.columnA END
> columnA FROM table where (columnA LIKE '%example%') {code}
> When the parser reaches "THEN ''" it considers the second single quote as an
> escape character so rather than returning the correct string literal which is
> an empty string '' it returns:
>
> '' ELSE table.columnA END columnA FROM table where (columnA LIKE '
> The query is valid on redshift
--
This message was sent by Atlassian Jira
(v8.20.10#820010)