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

Faisal updated CALCITE-7107:
----------------------------
    Description: 
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}
 
 
  

  was:
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 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}
 
 
  


> 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