You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ignite.apache.org by "Konstantin Orlov (Jira)" <ji...@apache.org> on 2021/11/14 19:09:00 UTC

[jira] [Updated] (IGNITE-15909) Calcite. Default charset could be unsupported by Calcite

     [ https://issues.apache.org/jira/browse/IGNITE-15909?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Konstantin Orlov updated IGNITE-15909:
--------------------------------------
    Labels: calcite calcite2-required  (was: )

> Calcite. Default charset could be unsupported by Calcite
> --------------------------------------------------------
>
>                 Key: IGNITE-15909
>                 URL: https://issues.apache.org/jira/browse/IGNITE-15909
>             Project: Ignite
>          Issue Type: Bug
>          Components: sql
>            Reporter: Konstantin Orlov
>            Priority: Major
>              Labels: calcite, calcite2-required
>
> Currently the default charset is taken from JVM's defaults:
> {code:java|title=IgniteTypeFactory}
>     @Override
>     public Charset getDefaultCharset() {
>         // Use JVM default charset rather then Calcite default charset (ISO-8859-1).
>         return Charset.defaultCharset();
>     }
> {code}
> The problem occurs when someone tries to execute a query using calcite-based query engine on a specific platform which default charset in not supported (E.g Windows with its WINDOWS-1252). The list of supported charset is defined by this:
> {code:java|title=org.apache.calcite.sql.SqlUtil}
>   /**
>    * Translates a character set name from a SQL-level name into a Java-level
>    * name.
>    *
>    * @param name SQL-level name
>    * @return Java-level name, or null if SQL-level name is unknown
>    */
>   public static @Nullable String translateCharacterSetName(String name) {
>     switch (name) {
>     case "BIG5":
>       return "Big5";
>     case "LATIN1":
>       return "ISO-8859-1";
>     case "UTF8":
>       return "UTF-8";
>     case "UTF16":
>     case "UTF-16":
>       return ConversionUtil.NATIVE_UTF16_CHARSET_NAME;
>     case "GB2312":
>     case "GBK":
>     case "UTF-16BE":
>     case "UTF-16LE":
>     case "ISO-8859-1":
>     case "UTF-8":
>       return name;
>     default:
>       return null;
>     }
>   }
> {code}
> The possible solution is to fallback to the UTF-8 when default charset is not supported. Another option is to explicitly stick to UTF-8.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)