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

xiong duan updated CALCITE-6931:
--------------------------------
    Description: 
*origin sql:*
select startswith(\"brand_name\", 'a') from  \"product\"
 
*currently spark dialect would convert to:*
SELECT STARTS_WITH(`brand_name`, 'a')  FROM `foodmart`.`product`
 
*this is not right, if execute would error out:*
spark-sql> select starts_with('aab', 'a');
Error in query: Undefined function: 'starts_with'. This function is neither a 
registered temporary function nor a permanent function registered in the 
database 'default'.; line 1 pos 7
 
*correct should convert to:*
SELECT STARTSWITH(`brand_name`, 'a')  FROM `foodmart`.`product`
 
the same is function ENDSWITH,we also find out in doc: 
[https://spark.apache.org/docs/latest/sql-ref-functions-builtin.html#string-functions]
need to fix the bug.

  was:
*origin sql:*
select startswith(\"brand_name\", 'a') from  \"product\"
 
*currently spark dialect would convert to:*
SELECT STARTS_WITH(`brand_name`, 'a')  FROM `foodmart`.`product`
 
*this is not right, if execute would error out:*
spark-sql> select starts_with('aab', 'a');
Error in query: Undefined function: 'starts_with'. This function is neither a 
registered temporary function nor a permanent function registered in the 
database 'default'.; line 1 pos 7
 
*correct should convert to:*
SELECT STARTSWITH(`brand_name`, 'a')  FROM `foodmart`.`product`
 
 
the same is function ENDSWITH,we also find out in doc: 
[https://spark.apache.org/docs/latest/sql-ref-functions-builtin.html#string-functions]
need to fix the bug.
 
 
 
 
 
 
 
 
 
 


> STARTSWITH/ENDSWITH in SPARK should not convert to STARTS_WITH/ENDS_WITH
> ------------------------------------------------------------------------
>
>                 Key: CALCITE-6931
>                 URL: https://issues.apache.org/jira/browse/CALCITE-6931
>             Project: Calcite
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 1.39.0
>            Reporter: Yu Xu
>            Assignee: Yu Xu
>            Priority: Critical
>              Labels: pull-request-available
>             Fix For: 1.40.0
>
>
> *origin sql:*
> select startswith(\"brand_name\", 'a') from  \"product\"
>  
> *currently spark dialect would convert to:*
> SELECT STARTS_WITH(`brand_name`, 'a')  FROM `foodmart`.`product`
>  
> *this is not right, if execute would error out:*
> spark-sql> select starts_with('aab', 'a');
> Error in query: Undefined function: 'starts_with'. This function is neither a 
> registered temporary function nor a permanent function registered in the 
> database 'default'.; line 1 pos 7
>  
> *correct should convert to:*
> SELECT STARTSWITH(`brand_name`, 'a')  FROM `foodmart`.`product`
>  
> the same is function ENDSWITH,we also find out in doc: 
> [https://spark.apache.org/docs/latest/sql-ref-functions-builtin.html#string-functions]
> need to fix the bug.



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

Reply via email to