Laurens Versluis created CALCITE-5114:
-----------------------------------------

             Summary: 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


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)

Reply via email to