You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "ZheHu (Jira)" <ji...@apache.org> on 2022/01/24 15:04:00 UTC

[jira] [Commented] (CALCITE-111) Support CONVERT function, for changing character sets

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

ZheHu commented on CALCITE-111:
-------------------------------

Hi, [~julianhyde] . Based on your conversation in CALCITE-4014, I have two questions about this issue:
 # Does CONVERT function only work between two String value? I tried convert(int_field using utf8) in mysql, which also succeeded.
 # According to the java_doc, TRANSLATE works the same as CONVERT. Do we need to implement those two funcs in this case(including test cases)? If yes, can we add a new SqlKind like *CONVERT* on behalf of those two, instead of OTHER_FUNCTION.

After my local test, I find the following steps might work:
 * During validation, instead of identifier, treat and validate the param Charset by SqlUtil.getCharset(charsetName), which only support corresponding Standard Charsets in *java.nio.charset.Charset*.
 * Add a ConvertImplementor in RexImpTable for the codegen of CONVERT/TRANSLATE func.

If I understand this correctly, I'm happy to take this issue.

> 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
>            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 &lt;character transliteration&gt;. 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)