You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Anton Haidai (JIRA)" <ji...@apache.org> on 2018/10/09 15:45:00 UTC

[jira] [Updated] (CALCITE-2616) Can't create Unicode literal by RelBuilder

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

Anton Haidai updated CALCITE-2616:
----------------------------------
    Description: 
Test in RelBuilderTest to reproduce the issue:
{code:java}
@Test public void testScanWithFilterByUnicodeValue() {
  final RelBuilder builder = RelBuilder.create(config().build());
  RelNode root =
      builder.scan("EMP")
          .filter(
              builder.call(SqlStdOperatorTable.EQUALS,
                  builder.field("ENAME"),
                  builder.literal("Петро ピーター")
              )
          )
          .build();
}
{code}
 Result:

org.apache.calcite.runtime.CalciteException: Failed to encode 'Петро ピーター' in character set 'ISO-8859-1'

Possible workaround: create saffron.properties with the following property

saffron.default.charset=UTF-16LE

But UTF-8 will not work as a value of this property, see SqlUtil.translateCharacterSetName

Related code:
 * SqlUtil.translateCharacterSetName(charsetName)
 * RelDataTypeFactoryImpl.getDefaultCharset()
 * SaffronProperties

 Could it be considered to switch defaults from "ISO-8859-1" to "UTF-8" in SaffronProperties?

 

  was:
Test in RelBuilderTest to reproduce the issue:
{code:java}
@Test public void testScanWithFilterByUnicodeValue() {
  final RelBuilder builder = RelBuilder.create(config().build());
  RelNode root =
      builder.scan("EMP")
          .filter(
              builder.call(SqlStdOperatorTable.EQUALS,
                  builder.field("ENAME"),
                  builder.literal("Петро ピーター")
              )
          )
          .build();
}
{code}
 Result:

org.apache.calcite.runtime.CalciteException: Failed to encode 'Петро ピーター' in character set 'ISO-8859-1'

Possible workaround: create saffron.properties with the following property

saffron.default.charset=UTF-16LE

But UTF-8 will not work as a value of this property, see SqlUtil.translateCharacterSetName

Related code:
 * SqlUtil.translateCharacterSetName(charsetName)
 * RelDataTypeFactoryImpl.getDefaultCharset()
 * SaffronProperties

 

 


> Can't create Unicode literal by RelBuilder
> ------------------------------------------
>
>                 Key: CALCITE-2616
>                 URL: https://issues.apache.org/jira/browse/CALCITE-2616
>             Project: Calcite
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 1.17.0
>            Reporter: Anton Haidai
>            Assignee: Julian Hyde
>            Priority: Major
>
> Test in RelBuilderTest to reproduce the issue:
> {code:java}
> @Test public void testScanWithFilterByUnicodeValue() {
>   final RelBuilder builder = RelBuilder.create(config().build());
>   RelNode root =
>       builder.scan("EMP")
>           .filter(
>               builder.call(SqlStdOperatorTable.EQUALS,
>                   builder.field("ENAME"),
>                   builder.literal("Петро ピーター")
>               )
>           )
>           .build();
> }
> {code}
>  Result:
> org.apache.calcite.runtime.CalciteException: Failed to encode 'Петро ピーター' in character set 'ISO-8859-1'
> Possible workaround: create saffron.properties with the following property
> saffron.default.charset=UTF-16LE
> But UTF-8 will not work as a value of this property, see SqlUtil.translateCharacterSetName
> Related code:
>  * SqlUtil.translateCharacterSetName(charsetName)
>  * RelDataTypeFactoryImpl.getDefaultCharset()
>  * SaffronProperties
>  Could it be considered to switch defaults from "ISO-8859-1" to "UTF-8" in SaffronProperties?
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)