[
https://issues.apache.org/jira/browse/CALCITE-111?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17482169#comment-17482169
]
ZheHu commented on CALCITE-111:
-------------------------------
Based on Parser.jj and testConvertAndTranslate() in SqlParserTest.java, I find
CONVERT in Calcite same with the one in Mysql. So my former tests in JdbcTest
are:
{code:java}
1.select convert(cast(employee_id as varchar) using utf8) as alia from employee
limit 3
{code}
{code:java}
2.select convert(cast(null as varchar) using utf16) as alia from employee limit
1
{code}
{code:java}
3.select convert('' using utf16) as alia from employee
{code}
{code:java}
4.select convert('employ_id' using utf16) as alia from employee
{code}
{code:java}
5.select employee_id from employee where convert(cast(employee_id as varchar)
using utf8) <> 1 limit 3
{code}
According to the description of *<character transliteration>* in
{*}ISO-SQL-2016{*}(chapter 4.2.3.2) , CONVERT in Postgresql fits the standard
well. So, the existing semantics in Parser.jj need to be modified, so does the
use cases above. But I'm not sure if we need to support *MYSQL_CONVERT* in
Calcite(if yes, we might need to file another JIRA case to record).
As for TRANSLATE(not TRANSLATE3), I haven't found any proof for it yet, I will
spend some time searching afterwards.
> Support CONVERT function, for changing character sets
> -----------------------------------------------------
>
> Key: CALCITE-111
> URL: https://issues.apache.org/jira/browse/CALCITE-111
> Project: Calcite
> Issue Type: Improvement
> Reporter: GitHub Import
> Assignee: ZheHu
> Priority: Major
> Labels: github-import
>
> Support the CONVERT function, to convert strings from one character set to
> another.
> CONVERT is defined in SQL:2011 as a feature called <character
> transliteration>. Here is an example:
> ```sql
> SELECT * FROM emp WHERE CONVERT(name USING UTF16) = u&'\82f1\56fd'
> ```
> The <a
> href="http://dev.mysql.com/doc/refman/5.0/en/charset-convert.html">MySQL
> site</a> has other examples.
> ---------------- Imported from GitHub ----------------
> Url: https://github.com/julianhyde/optiq/issues/111
> Created by: [julianhyde|https://github.com/julianhyde]
> Labels: enhancement,
> Created at: Tue Jan 14 03:40:53 CET 2014
> State: open
--
This message was sent by Atlassian Jira
(v8.20.1#820001)