[
https://issues.apache.org/jira/browse/CALCITE-6967?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Yu Xu updated CALCITE-6967:
---------------------------
Description:
In ClickHouse select STARTWITH('aa', 'a'); would convert to
{code:java}
select STARTS_WITH('aa', 'a'); {code}
this is not work and error out:
{code:java}
Code: 46. DB::Exception: Received from localhost:9000. DB::Exception: Function
with name `starts_with` does not exist. In scope SELECT starts_with('aa', 'a').
Maybe you meant: ['startsWith']. (UNKNOWN_FUNCTION) {code}
at the same time, startswith also not work(lower/upper):
{code:java}
select startswith('aa', 'a');
>Code: 46. DB::Exception: Received from localhost:9000. DB::Exception: Function
>with name `startswith` does not exist. In scope SELECT startswith('aa', 'a').
>Maybe you meant: ['startsWith']. (UNKNOWN_FUNCTION){code}
{code:java}
select STARTSWITH('aa', 'a');
>Code: 46. DB::Exception: Received from localhost:9000. DB::Exception: Function
>with name `STARTSWITH` does not exist. In scope SELECT STARTSWITH('aa', 'a').
>Maybe you meant: ['startsWith']. (UNKNOWN_FUNCTION)
{code}
it is the same with endswith function, this is a bit strange because
startsWith/endsWith is need camel case and other string functions not need(such
as char_length/CHAR_LENGTH both work well in ClickHouse).
we can refer to the document:
[https://clickhouse.com/docs/sql-reference/functions/string-functions#startswith]
{code:java}
select startsWith('aa', 'a');
>1 {code}
[https://clickhouse.com/docs/sql-reference/functions/string-functions#endswith]
{code:java}
select endsWith('aa', 'a');
>1 {code}
so we need adapt it with convert startswith to startsWith and endswith to
endswith.
was:
In ClickHouse select STARTWITH('aa', 'a'); would convert to
{code:java}
select STARTS_WITH('aa', 'a'); {code}
this is not work and error out:
{code:java}
Code: 46. DB::Exception: Received from localhost:9000. DB::Exception: Function
with name `starts_with` does not exist. In scope SELECT starts_with('aa', 'a').
Maybe you meant: ['startsWith']. (UNKNOWN_FUNCTION) {code}
at the same time, startswith also not work(lower/upper):
{code:java}
select startswith('aa', 'a');
>Code: 46. DB::Exception: Received from localhost:9000. DB::Exception: Function
>with name `startswith` does not exist. In scope SELECT startswith('aa', 'a').
>Maybe you meant: ['startsWith']. (UNKNOWN_FUNCTION){code}
{code:java}
select STARTSWITH('aa', 'a');
>Code: 46. DB::Exception: Received from localhost:9000. DB::Exception: Function
>with name `STARTSWITH` does not exist. In scope SELECT STARTSWITH('aa', 'a').
>Maybe you meant: ['startsWith']. (UNKNOWN_FUNCTION)
{code}
it is the same with endswith function, this is a bit strange because
startsWith/endsWith is need camel case and other string functions not need(such
as char_length/CHAR_LENGTH both work well in ClickHouse).
we can refer to the document:
https://clickhouse.com/docs/sql-reference/functions/string-functions#startswith
{code:java}
select startsWith('aa', 'a');
>1 {code}
[https://clickhouse.com/docs/sql-reference/functions/string-functions#endswith]
{code:java}
select endsWith('aa', 'a');
>1 {code}
so we need adapt it with convert startswith to startsWith and endswith to
endswith
> STARTSWITH/ENDSWITH can not parse correctly in ClickHouse
> ---------------------------------------------------------
>
> Key: CALCITE-6967
> URL: https://issues.apache.org/jira/browse/CALCITE-6967
> Project: Calcite
> Issue Type: Bug
> Components: core
> Affects Versions: 1.39.0
> Reporter: Yu Xu
> Assignee: Yu Xu
> Priority: Major
> Labels: pull-request-available
> Fix For: 1.40.0
>
>
> In ClickHouse select STARTWITH('aa', 'a'); would convert to
> {code:java}
> select STARTS_WITH('aa', 'a'); {code}
> this is not work and error out:
> {code:java}
> Code: 46. DB::Exception: Received from localhost:9000. DB::Exception:
> Function with name `starts_with` does not exist. In scope SELECT
> starts_with('aa', 'a'). Maybe you meant: ['startsWith']. (UNKNOWN_FUNCTION)
> {code}
> at the same time, startswith also not work(lower/upper):
> {code:java}
> select startswith('aa', 'a');
> >Code: 46. DB::Exception: Received from localhost:9000. DB::Exception:
> >Function with name `startswith` does not exist. In scope SELECT
> >startswith('aa', 'a'). Maybe you meant: ['startsWith'].
> >(UNKNOWN_FUNCTION){code}
> {code:java}
> select STARTSWITH('aa', 'a');
> >Code: 46. DB::Exception: Received from localhost:9000. DB::Exception:
> >Function with name `STARTSWITH` does not exist. In scope SELECT
> >STARTSWITH('aa', 'a'). Maybe you meant: ['startsWith']. (UNKNOWN_FUNCTION)
> {code}
> it is the same with endswith function, this is a bit strange because
> startsWith/endsWith is need camel case and other string functions not
> need(such as char_length/CHAR_LENGTH both work well in ClickHouse).
> we can refer to the document:
> [https://clickhouse.com/docs/sql-reference/functions/string-functions#startswith]
>
> {code:java}
> select startsWith('aa', 'a');
> >1 {code}
> [https://clickhouse.com/docs/sql-reference/functions/string-functions#endswith]
> {code:java}
> select endsWith('aa', 'a');
> >1 {code}
> so we need adapt it with convert startswith to startsWith and endswith to
> endswith.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)