[
https://issues.apache.org/jira/browse/CALCITE-5114?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Julian Hyde resolved CALCITE-5114.
----------------------------------
Resolution: Duplicate
{{CORR}} is a reserved keyword because standard SQL (since 2014) has had a CORR
function. CALCITE-1776 is logged to implement it and there's even a pull
request from [~snuyanzin].
Closing as duplicate.
> 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)