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

peng wu updated CALCITE-6558:
-----------------------------
    Description: 
give the sql parser s simple input:
{code:java}
first(`my_column`){code}
After the SQL string is parsed as SqlNode, then an extra parameter is added to 
the first function, and the sql becomes:
{code:java}
first(`my_column`, 0) {code}
Error would be thrown when the above sql is executed by spark:
"The second argument in first should be a boolean literal"

 

  was:
give the sql parser s simple input:
{code:java}
first(`my_column`){code}
After the SQL string is parsed as SqlNode, then an extra parameter is added to 
the first function, and the sql becomes:
{code:java}
first(`my_column`, 0) {code}
Error would be thrown when the above sql is executed.

>From the source code, we can see that the FIRST/LAST functions are classified 
>as Match Recognize Navigation function but I cannot understand why this zero 
>literal is appended.
{code:java}
public class SqlParserImpl {
   final public SqlCall MatchRecognizeNavigationLogical() throws ParseException 
{
  ...
  default:     
    jj_la1[357] = jj_gen;
    args.add(LITERAL_ZERO);
 }
}{code}
 

 

        Summary: zero literal is appended as a paramer for FIRST/LAST but Spark 
requires boolean  (was: zero literal is appended as a paramer for FIRST/LAST 
but it is not desired)

> zero literal is appended as a paramer for FIRST/LAST but Spark requires 
> boolean
> -------------------------------------------------------------------------------
>
>                 Key: CALCITE-6558
>                 URL: https://issues.apache.org/jira/browse/CALCITE-6558
>             Project: Calcite
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 1.32.0
>            Reporter: peng wu
>            Priority: Major
>
> give the sql parser s simple input:
> {code:java}
> first(`my_column`){code}
> After the SQL string is parsed as SqlNode, then an extra parameter is added 
> to the first function, and the sql becomes:
> {code:java}
> first(`my_column`, 0) {code}
> Error would be thrown when the above sql is executed by spark:
> "The second argument in first should be a boolean literal"
>  



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

Reply via email to