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

The SQL generated for the POSITION function(with 3 input arguments) by the SparkSqlDialect is not recognized by Spark SQL

    XMLWordPrintableJSON

Details

    Description

      In SparkSQL, POSITION(substr, str[, pos]) function only accept comma-separated when there are 3 arguments.

      For example:

      // SparkSQL accepted SQL
      select POSITION('a', 'abc', 1);

      Calcite will use the IN and FROM keyword to separate the input arguments when unparsing.

      // Calcite accepted and unparsed SQL
      select POSITION('a' IN 'abc' FROM 1)

      For 2 augument inputs, SparkSQL accept both syntaxes. So I think we should write a rule in SparkSqlDialect to convert keyword-separated syntax to comma-separted syntax for POSITION function.

       

      Attachments

        Issue Links

          Activity

            People

              hongyuguo hongyu guo
              hongyuguo hongyu guo
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: