apache-calcite

How can I change calcite's default encode character set?


I use driver manager (eg. jdbc:calcite:inline) to get a calcite connection and run sql with it, but calcite's default encode character set(ISO) don't support Chinese characters, I want to find a method to change the encode character set.

I tried the following two sql:

  1. select * from tb where id= '啊'
  2. select * from tb where id= _UTF16'啊'

Firstly,I run a sql(select * from tb where id= '啊') and receive a error that is "org.apache.calcite.runtime.CalciteException: Failed to encode '啊' in character set 'ISO-8859-1'".

Secondly, I add a character set to the sql(select * from tb where id= _UTF16'啊'),but I receive another error that is "SqlValidatorException: Cannot apply = to the two different charsets ISO-8859-1 and UTF-16LE".


Solution

  • You should set the property calcite.default.charset to whatever character set you want to use. That said, I'm not sure this will solve all your problems. Support for other character sets is really a work in progress. See this discussion on the project mailing list.