[
https://issues.apache.org/jira/browse/CALCITE-5922?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17759009#comment-17759009
]
Jiajun Xie commented on CALCITE-5922:
-------------------------------------
Fixed in
[730361b|https://github.com/apache/calcite/commit/730361b66442e5d12448e120e8ce67fc070b271a].
[~hongyuguo] , Thanks for you PR.
[~nobigo] , Thanks for your review.
> The SQL generated for the POSITION function(with 3 input arguments) by the
> SparkSqlDialect is not recognized by Spark SQL
> -------------------------------------------------------------------------------------------------------------------------
>
> 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
> Assignee: 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)