You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "xiong duan (Jira)" <ji...@apache.org> on 2022/04/26 11:51:00 UTC

[jira] [Commented] (CALCITE-5114) SqlParseException for Spark's "corr" function

    [ https://issues.apache.org/jira/browse/CALCITE-5114?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17528111#comment-17528111 ] 

xiong duan commented on CALCITE-5114:
-------------------------------------

I have tested this function in PG and Oracle, They all support this Corr Function. But MySQL doesn't support it. So I think we can improve the summary to "Core parser support parse CORR function". And welcome to contribute.

> SqlParseException for Spark's "corr" function
> ---------------------------------------------
>
>                 Key: CALCITE-5114
>                 URL: https://issues.apache.org/jira/browse/CALCITE-5114
>             Project: Calcite
>          Issue Type: Bug
>         Environment: Running Calcite 1.30.0 with Java 11.
>            Reporter: Laurens Versluis
>            Priority: Blocker
>
> When parsing a string that contains Spark's "corr" function, Calcite will throw a SqlParseException.
>  
> Minimal reproducible example:
> {code:java}
> import org.apache.calcite.sql.dialect.SparkSqlDialect;
> import org.apache.calcite.sql.parser.SqlParseException;
> import org.apache.calcite.sql.parser.SqlParser;
> class Scratch {
>     public static void main(String[] args) throws SqlParseException {
>         // Example SQL provided by spark, see https://spark.apache.org/docs/latest/api/sql/#corr
>         String sqlQuery = "SELECT corr(c1, c2) FROM VALUES (3, 2), (3, 3), (6, 4) as tab(c1, c2);";
>         SqlParser.create(sqlQuery, SparkSqlDialect.DEFAULT.configureParser(SqlParser.config())).parseQuery();
>     }
> } {code}
> Output:
> {noformat}
> Exception in thread "main" org.apache.calcite.sql.parser.SqlParseException: Encountered "corr" at line 1, column 8.{noformat}



--
This message was sent by Atlassian Jira
(v8.20.7#820007)