You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Alessandro Solimando (Jira)" <ji...@apache.org> on 2022/04/27 14:11:00 UTC
[jira] [Comment Edited] (CALCITE-5118) SqlDatePartFunction#rewriteCall should check operands length
[ https://issues.apache.org/jira/browse/CALCITE-5118?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17528815#comment-17528815 ]
Alessandro Solimando edited comment on CALCITE-5118 at 4/27/22 2:10 PM:
------------------------------------------------------------------------
Thanks [~libenchao], I was wondering indeed if you wanted to keep the AIOOB in the first case or have a more graceful validation error like "we expect 1 parameter, X found" (which could accommodate both cases probably). WDYT?
was (Author: asolimando):
Thanks [~libenchao], I was wondering indeed if you wanted to keep the AIOOB in the first case or have a more graceful error like "we expect 1 parameter, X found" (which could accommodate both cases probably). WDYT?
> SqlDatePartFunction#rewriteCall should check operands length
> ------------------------------------------------------------
>
> Key: CALCITE-5118
> URL: https://issues.apache.org/jira/browse/CALCITE-5118
> Project: Calcite
> Issue Type: Improvement
> Components: core
> Affects Versions: 1.30.0
> Reporter: Benchao Li
> Assignee: Benchao Li
> Priority: Major
> Fix For: 1.31.0
>
>
> {{SqlDatePartFunction#rewriteCall}} does not check operands length for now, and it will be rewrite to {{EXTRACT}} unconditionally before validation.
> E.g.
> {code:sql}
> select week(); -- will throw ArrayIndexOutOfBoundsException
> select week(date '2022-04-27', 1); -- will just ignore second param
> {code}
> However, these cases should throw validation exceptions, because {{week}} actually only accept 1 operand.
--
This message was sent by Atlassian Jira
(v8.20.7#820007)