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

Faisal commented on CALCITE-7107:
---------------------------------

[~mbudiu]  - If I use the ClickhouseSqlDialect on an sql writer to write the 
sql after parsing with the "array" function in the sql, then by default it 
UPPERCASES the "array" function name. Only if I set key words to be lowercase 
on the sql pretty writer config hk then does it lowercase it - but along with 
all keywords.

I can't see a way of setting a dialect on the parser itself (only the writer 
config )- there's no .withDialect() method and no conformance enum on the 
parser config object that corresponds to Clickhouse. Am I missing something 
obvious (I hope so :))?

> Parsing clickhouse query that contains an array
> -----------------------------------------------
>
>                 Key: CALCITE-7107
>                 URL: https://issues.apache.org/jira/browse/CALCITE-7107
>             Project: Calcite
>          Issue Type: Bug
>            Reporter: Faisal
>            Priority: Major
>
> Hi
> I'm using the calcite-babel 1.40.0 lib and am doing some manipulation on sql 
> for Clickhouse. Specifically we're using array functions in the sql - e.g.
> {code:java}
> "Select * from someTable where hasAll(anArrayColumn, ['value1', 'value2']" 
> {code}
> When parsing this, calcite throws an exception relating to the "[" character. 
> Clickhouse itself supports using this array construct ['value1', 'value2'] or 
> using array('value1, 'value2') where "array" is case sensitive in clickhouse. 
> If I send in:
> {code:java}
> "Select * from someTable where hasAll(anArrayColumn, array('value1, 
> 'value2')" {code}
> for calcite parsing, then calcite detects "array" as a keyword and uppercases 
> it by default which does not work in Clickhouse, resulting in
> {code:java}
> "SELECT * FROM someTable WHERE hasAll(anArrayColumn, ARRAY('value1', 
> 'value2'))"{code}
> I understand that I can set calcite to lower case keywords by default, but 
> that may have knock on consequences
> I am using:
> {code:java}
> final var conf= SqlParser.config().withCaseSensitive(true)      
> .withUnquotedCasing(Casing.UNCHANGED).withQuotedCasing(Casing.UNCHANGED)      
> .withQuoting(Quoting.DOUBLE_QUOTE).withParserFactory(SqlBabelParserImpl.FACTORY);
> final var sqlParser = SqlParser.create(sql, conf);
> final var sqlNode = sqlParser.parseStmt();{code}
>  
>  
>   



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to