You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "hongyu guo (Jira)" <ji...@apache.org> on 2023/08/13 08:36:00 UTC
[jira] [Commented] (CALCITE-5922) POSITION signature incorrect for SparkSQL
[ https://issues.apache.org/jira/browse/CALCITE-5922?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17753669#comment-17753669 ]
hongyu guo commented on CALCITE-5922:
-------------------------------------
I submit a PR for this bug, [https://github.com/apache/calcite/pull/3363]
I would appreciate it if someone could review my code :)
> 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
> Priority: Minor
> Labels: pull-request-available
> 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)