Uploaded image for project: 'Calcite'
  1. Calcite
  2. CALCITE-5114

SqlParseException for Spark's "corr" function

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Blocker
    • Resolution: Duplicate
    • None
    • 1.32.0
    • None
    • None
    • Running Calcite 1.30.0 with Java 11.

    Description

      When parsing a string that contains Spark's "corr" function, Calcite will throw a SqlParseException.

       

      Minimal reproducible example:

      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();
          }
      } 

      Output:

      Exception in thread "main" org.apache.calcite.sql.parser.SqlParseException: Encountered "corr" at line 1, column 8.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              lfdversluis Laurens Versluis
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: