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

hongyu guo updated CALCITE-5922:
--------------------------------
    Description: 
In SparkSQL, POSITION(substr, str[, pos]) function only accept comma-separated 
when there are 3 arguments.

For example:
{code:java}
// SparkSQL accepted SQL
select POSITION('a', 'abc', 1);{code}
Calcite will use the IN and FROM keyword to separate the input arguments when 
unparsing.
{code:java}
// Calcite accepted and unparsed SQL
select POSITION('a' IN 'abc' FROM 1){code}
For 2 augument inputs, SparkSQL accept both syntaxes. So I think we should 
write a rule in SparkSqlDialect to convert keyword-separated syntax to 
comma-separted syntax for POSITION function.

 

  was:
In SparkSQL, POSITION(substr, str[, pos]) function only accept comma-separated 
when there are 3 arguments.

For example:
{code:java}
// SparkSQL accepted SQL
select POSITION('a', 'abc', 1);{code}
Calcite will use the IN and FROM keyword to separate the input arguments when 
unparsing.
{code:java}
// Calcite accepted and unparsed SQL
select POSITION('a' IN 'abc' FROM 1){code}
For 2 augument inputs, SparkSQL accept both syntaxes, So I think we should 
write a rule in SparkSqlDialect to convert keyword-separated syntax to 
comma-separted syntax for POSITION function.

 


> POSITION signature incorrect for SparkSQL
> -----------------------------------------
>
>                 Key: CALCITE-5922
>                 URL: https://issues.apache.org/jira/browse/CALCITE-5922
>             Project: Calcite
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 1.35.0
>            Reporter: hongyu guo
>            Priority: Minor
>              Labels: pull-request-available
>             Fix For: 1.36.0
>
>
> In SparkSQL, POSITION(substr, str[, pos]) function only accept 
> comma-separated when there are 3 arguments.
> For example:
> {code:java}
> // SparkSQL accepted SQL
> select POSITION('a', 'abc', 1);{code}
> Calcite will use the IN and FROM keyword to separate the input arguments when 
> unparsing.
> {code:java}
> // Calcite accepted and unparsed SQL
> select POSITION('a' IN 'abc' FROM 1){code}
> For 2 augument inputs, SparkSQL accept both syntaxes. So I think we should 
> write a rule in SparkSqlDialect to convert keyword-separated syntax to 
> comma-separted syntax for POSITION function.
>  



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

Reply via email to