You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@calcite.apache.org by 莫失莫忘 <xi...@qq.com> on 2020/12/18 09:12:41 UTC

回复: how to set string representation in calcite SQL;

not like this。I said&nbsp; string contant 。&nbsp;setQuoting(Quoting.DOUBLE_QUOTE)&nbsp; &nbsp;affect&nbsp;&nbsp;identifiers,like column name、table name。not affect&nbsp;&nbsp;string contant
setQuoting(Quoting.DOUBLE_QUOTE)&nbsp; &nbsp; make&nbsp; &nbsp; &nbsp; &nbsp;select * from table1 where "column1" = 'word'&nbsp; Ok




------------------&nbsp;原始邮件&nbsp;------------------
发件人:                                                                                                                        "dev"                                                                                    <jhyde@apache.org&gt;;
发送时间:&nbsp;2020年12月17日(星期四) 凌晨3:48
收件人:&nbsp;"dev@calcite.apache.org"<dev@calcite.apache.org&gt;;

主题:&nbsp;Re: how to set string representation in calcite SQL;



Alessandro is correct. But also, you can set using connect-string
parameters: lex=BIG_QUERY will, I believe, have the desired effect.

On Wed, Dec 16, 2020 at 3:13 AM Alessandro Solimando
<alessandro.solimando@gmail.com&gt; wrote:
&gt;
&gt; Hello,
&gt; you can achieve what you want via the SqlParser configuration
&gt; (.setQuoting() method), for instance:
&gt;
&gt;&nbsp; private static final SqlParser.Config SQL_PARSER_CONFIG =
&gt;
&gt;&nbsp;&nbsp; SqlParser.configBuilder(SqlParser.Config.DEFAULT)
&gt; &gt;&nbsp;&nbsp; .setCaseSensitive(false)
&gt; &gt;&nbsp;&nbsp; .setConformance(SqlConformanceEnum.DEFAULT)
&gt; &gt;&nbsp;&nbsp; .setQuoting(Quoting.DOUBLE_QUOTE) <----
&gt; &gt;&nbsp;&nbsp; .build();
&gt;
&gt;
&gt; Hth,
&gt; Alessandro
&gt;
&gt; On Wed, 16 Dec 2020 at 09:55, 莫失莫忘 <xiaoxiong.wei@qq.com&gt; wrote:
&gt;
&gt; &gt; Default ,String representation is apostrophe in calcite SQL
&gt; &gt; ,like&amp;nbsp;'word'. how do I set this to Double quotes ,like&amp;nbsp;"word".
&gt; &gt;
&gt; &gt; Default is :
&gt; &gt; select * from table1 where column1 = 'word'
&gt; &gt; I hope to support:
&gt; &gt; select * from table1 where column1 = "word"

Re: how to set string representation in calcite SQL;

Posted by Julian Hyde <jh...@gmail.com>.
Right. Something like

  SqlParser.configBuilder(SqlParser.Config.DEFAULT)
      .withCharLiteralStyles(EnumSet.of(CharLiteralStyle.BQ_DOUBLE))
      .build();

will do the trick. Or use lex=BIG_QUERY, as I mentioned previously.

Julian


> On Dec 18, 2020, at 2:12 AM, Stamatis Zampetakis <za...@gmail.com> wrote:
> 
> Hi,
> 
> The message is a bit hard to understand since there are many HTML character
> entity references; next time try to use plain text if possible.
> 
> As Julian mentioned, what you need is probably covered by CALCITE-4247 [1].
> 
> Best,
> Stamatis
> 
> [1] https://issues.apache.org/jira/browse/CALCITE-4247
> 
> On Fri, Dec 18, 2020 at 10:13 AM 莫失莫忘 <xi...@qq.com> wrote:
> 
>> not like this。I said&nbsp; string contant
>> 。&nbsp;setQuoting(Quoting.DOUBLE_QUOTE)&nbsp;
>> &nbsp;affect&nbsp;&nbsp;identifiers,like column name、table name。not
>> affect&nbsp;&nbsp;string contant
>> setQuoting(Quoting.DOUBLE_QUOTE)&nbsp; &nbsp; make&nbsp; &nbsp; &nbsp;
>> &nbsp;select * from table1 where "column1" = 'word'&nbsp; Ok
>> 
>> 
>> 
>> 
>> ------------------&nbsp;原始邮件&nbsp;------------------
>> 发件人:
>>                                                  "dev"
>>                                                                <
>> jhyde@apache.org&gt;;
>> 发送时间:&nbsp;2020年12月17日(星期四) 凌晨3:48
>> 收件人:&nbsp;"dev@calcite.apache.org"<dev@calcite.apache.org&gt;;
>> 
>> 主题:&nbsp;Re: how to set string representation in calcite SQL;
>> 
>> 
>> 
>> Alessandro is correct. But also, you can set using connect-string
>> parameters: lex=BIG_QUERY will, I believe, have the desired effect.
>> 
>> On Wed, Dec 16, 2020 at 3:13 AM Alessandro Solimando
>> <alessandro.solimando@gmail.com&gt; wrote:
>> &gt;
>> &gt; Hello,
>> &gt; you can achieve what you want via the SqlParser configuration
>> &gt; (.setQuoting() method), for instance:
>> &gt;
>> &gt;&nbsp; private static final SqlParser.Config SQL_PARSER_CONFIG =
>> &gt;
>> &gt;&nbsp;&nbsp; SqlParser.configBuilder(SqlParser.Config.DEFAULT)
>> &gt; &gt;&nbsp;&nbsp; .setCaseSensitive(false)
>> &gt; &gt;&nbsp;&nbsp; .setConformance(SqlConformanceEnum.DEFAULT)
>> &gt; &gt;&nbsp;&nbsp; .setQuoting(Quoting.DOUBLE_QUOTE) <----
>> &gt; &gt;&nbsp;&nbsp; .build();
>> &gt;
>> &gt;
>> &gt; Hth,
>> &gt; Alessandro
>> &gt;
>> &gt; On Wed, 16 Dec 2020 at 09:55, 莫失莫忘 <xiaoxiong.wei@qq.com&gt; wrote:
>> &gt;
>> &gt; &gt; Default ,String representation is apostrophe in calcite SQL
>> &gt; &gt; ,like&amp;nbsp;'word'. how do I set this to Double quotes
>> ,like&amp;nbsp;"word".
>> &gt; &gt;
>> &gt; &gt; Default is :
>> &gt; &gt; select * from table1 where column1 = 'word'
>> &gt; &gt; I hope to support:
>> &gt; &gt; select * from table1 where column1 = "word"


Re: how to set string representation in calcite SQL;

Posted by Stamatis Zampetakis <za...@gmail.com>.
Hi,

The message is a bit hard to understand since there are many HTML character
entity references; next time try to use plain text if possible.

As Julian mentioned, what you need is probably covered by CALCITE-4247 [1].

Best,
Stamatis

[1] https://issues.apache.org/jira/browse/CALCITE-4247

On Fri, Dec 18, 2020 at 10:13 AM 莫失莫忘 <xi...@qq.com> wrote:

> not like this。I said&nbsp; string contant
> 。&nbsp;setQuoting(Quoting.DOUBLE_QUOTE)&nbsp;
> &nbsp;affect&nbsp;&nbsp;identifiers,like column name、table name。not
> affect&nbsp;&nbsp;string contant
> setQuoting(Quoting.DOUBLE_QUOTE)&nbsp; &nbsp; make&nbsp; &nbsp; &nbsp;
> &nbsp;select * from table1 where "column1" = 'word'&nbsp; Ok
>
>
>
>
> ------------------&nbsp;原始邮件&nbsp;------------------
> 发件人:
>                                                   "dev"
>                                                                 <
> jhyde@apache.org&gt;;
> 发送时间:&nbsp;2020年12月17日(星期四) 凌晨3:48
> 收件人:&nbsp;"dev@calcite.apache.org"<dev@calcite.apache.org&gt;;
>
> 主题:&nbsp;Re: how to set string representation in calcite SQL;
>
>
>
> Alessandro is correct. But also, you can set using connect-string
> parameters: lex=BIG_QUERY will, I believe, have the desired effect.
>
> On Wed, Dec 16, 2020 at 3:13 AM Alessandro Solimando
> <alessandro.solimando@gmail.com&gt; wrote:
> &gt;
> &gt; Hello,
> &gt; you can achieve what you want via the SqlParser configuration
> &gt; (.setQuoting() method), for instance:
> &gt;
> &gt;&nbsp; private static final SqlParser.Config SQL_PARSER_CONFIG =
> &gt;
> &gt;&nbsp;&nbsp; SqlParser.configBuilder(SqlParser.Config.DEFAULT)
> &gt; &gt;&nbsp;&nbsp; .setCaseSensitive(false)
> &gt; &gt;&nbsp;&nbsp; .setConformance(SqlConformanceEnum.DEFAULT)
> &gt; &gt;&nbsp;&nbsp; .setQuoting(Quoting.DOUBLE_QUOTE) <----
> &gt; &gt;&nbsp;&nbsp; .build();
> &gt;
> &gt;
> &gt; Hth,
> &gt; Alessandro
> &gt;
> &gt; On Wed, 16 Dec 2020 at 09:55, 莫失莫忘 <xiaoxiong.wei@qq.com&gt; wrote:
> &gt;
> &gt; &gt; Default ,String representation is apostrophe in calcite SQL
> &gt; &gt; ,like&amp;nbsp;'word'. how do I set this to Double quotes
> ,like&amp;nbsp;"word".
> &gt; &gt;
> &gt; &gt; Default is :
> &gt; &gt; select * from table1 where column1 = 'word'
> &gt; &gt; I hope to support:
> &gt; &gt; select * from table1 where column1 = "word"