You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@calcite.apache.org by "hongyu guo (Jira)" <ji...@apache.org> on 2023/08/13 08:05:00 UTC

[jira] [Created] (CALCITE-5922) POSITION signature incorrect for SparkSQL

hongyu guo created CALCITE-5922:
-----------------------------------

             Summary: POSITION signature incorrect for SparkSQL
                 Key: CALCITE-5922
                 URL: https://issues.apache.org/jira/browse/CALCITE-5922
             Project: Calcite
          Issue Type: Bug
          Components: core
    Affects Versions: 1.35.0
            Reporter: hongyu guo
             Fix For: 1.36.0


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

For example:
{code:java}
// SparkSQL accepted SQL
select POSITION('a', 'abc', 1);{code}
Calcite will use the IN and FROM keyword to separate the input arguments when unparsing.
{code:java}
// Calcite accepted and unparsed SQL
select POSITION('a' IN 'abc' FROM 1){code}
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.

 



--
This message was sent by Atlassian Jira
(v8.20.10#820010)