[
https://issues.apache.org/jira/browse/CALCITE-1517?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Julian Hyde resolved CALCITE-1517.
----------------------------------
Resolution: Not A Problem
Not a bug. When you compare to a {{CHAR(n)}} type, all values are right-padded
to length n. So in {{CHAR(1)}}, yes, '' and ' ' are the same.
If you don't like weird behavior, use {{VARCHAR}}.
> Calcite use ReduceExpressionsRule make '' to ' '
> ------------------------------------------------
>
> Key: CALCITE-1517
> URL: https://issues.apache.org/jira/browse/CALCITE-1517
> Project: Calcite
> Issue Type: Bug
> Affects Versions: 1.11.0
> Reporter: Dongming Liu
> Assignee: Julian Hyde
>
> SQL
> {code}
> select * from ta where ta.a <> '';
> {code}
> If the type of {{ta.a}} is {{CHAR(1)}}, when I call {{SqlToRelConverter}},
> will add a CAST function to cast the empty string to CHAR(1), like this:
> {code}
> CAST(''):CHAR(1) CHARACTER SET "ISO-8859-1" COLLATE
> "ISO-8859-1$en_US$primary" NOT NULL
> {code}
> But, when I use the {{ReduceExpressionsRule}} rule in planner, it will remove
> the cast and convert the empty string '' to ' '(string with a
> space)。Obviously, '' is not equal to ' '。
> Is this a bug?
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)