[
https://issues.apache.org/jira/browse/CALCITE-7267?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Yu Xu updated CALCITE-7267:
---------------------------
Description:
When generating SQL targeted at Oracle, the JDBC adapter should translate calls
to the CHAR_LENGTH function as if they were calls to LENGTH. This is because
Oracle has no CHAR_LENGTH function.
refer:
[https://docs.oracle.com/en/database/oracle/oracle-database/18/sqlrf/LENGTH.html]
currently Oracle dialect in Calcite not convert CHAR_LENGTH to LENGTH function,
which would error as follow:
execute sql1
{code:java}
select CHAR_LENGTH('aaa') {code}
error message report:
{code:java}
ORA-00904: "CHAR_LENGTH": invalid identifier
https://docs.oracle.com/error-help/db/ora-00904/
00904. 00000 - "%s: invalid identifier"
*Cause: The identifier or column name entered was invalid.
*Action: Ensure the following
Error at Line: 1 Column: 6 {code}
execute sql2
{code:java}
select LENGTH('aaa') {code}
then result is ok:
{code:java}
3
{code}
so in Oracle dialect, CHAR_LENGTH should convert to LENGTH function. such as
other dialect presto https://issues.apache.org/jira/browse/CALCITE-6643
was:
*CHAR_LENGTH* function is not support for Oracle, but LENGTH is supported.
refer:
[https://docs.oracle.com/en/database/oracle/oracle-database/18/sqlrf/LENGTH.html]
currently Oracle dialect in Calcite not convert CHAR_LENGTH to LENGTH function,
which would error as follow:
execute sql1
{code:java}
select CHAR_LENGTH('aaa') {code}
error message report:
{code:java}
ORA-00904: "CHAR_LENGTH": invalid identifier
https://docs.oracle.com/error-help/db/ora-00904/
00904. 00000 - "%s: invalid identifier"
*Cause: The identifier or column name entered was invalid.
*Action: Ensure the following
Error at Line: 1 Column: 6 {code}
execute sql2
{code:java}
select LENGTH('aaa') {code}
then result is ok:
{code:java}
3
{code}
so in Oracle dialect, CHAR_LENGTH should convert to LENGTH function. such as
other dialect presto https://issues.apache.org/jira/browse/CALCITE-6643
> CHAR_LENGTH function is not recognized in Oracle dialect
> --------------------------------------------------------
>
> Key: CALCITE-7267
> URL: https://issues.apache.org/jira/browse/CALCITE-7267
> Project: Calcite
> Issue Type: Bug
> Components: core
> Affects Versions: 1.41.0
> Reporter: Yu Xu
> Assignee: Yu Xu
> Priority: Minor
> Labels: pull-request-available
> Fix For: 1.42.0
>
>
> When generating SQL targeted at Oracle, the JDBC adapter should translate
> calls to the CHAR_LENGTH function as if they were calls to LENGTH. This is
> because Oracle has no CHAR_LENGTH function.
> refer:
> [https://docs.oracle.com/en/database/oracle/oracle-database/18/sqlrf/LENGTH.html]
>
> currently Oracle dialect in Calcite not convert CHAR_LENGTH to LENGTH
> function, which would error as follow:
> execute sql1
> {code:java}
> select CHAR_LENGTH('aaa') {code}
> error message report:
> {code:java}
> ORA-00904: "CHAR_LENGTH": invalid identifier
> https://docs.oracle.com/error-help/db/ora-00904/
> 00904. 00000 - "%s: invalid identifier"
> *Cause: The identifier or column name entered was invalid.
> *Action: Ensure the following
> Error at Line: 1 Column: 6 {code}
>
> execute sql2
> {code:java}
> select LENGTH('aaa') {code}
> then result is ok:
> {code:java}
> 3
> {code}
>
> so in Oracle dialect, CHAR_LENGTH should convert to LENGTH function. such as
> other dialect presto https://issues.apache.org/jira/browse/CALCITE-6643
>
--
This message was sent by Atlassian Jira
(v8.20.10#820010)