You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@asterixdb.apache.org by "Michael J. Carey (JIRA)" <ji...@apache.org> on 2019/06/17 21:10:00 UTC

[jira] [Commented] (ASTERIXDB-2595) Positional vars and array indexes are inconsistent in SQL++

    [ https://issues.apache.org/jira/browse/ASTERIXDB-2595?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16865993#comment-16865993 ] 

Michael J. Carey commented on ASTERIXDB-2595:
---------------------------------------------

Better yet, try this:

LET grades = ["A", "B", "C"]
FROM grades AS g AT i
SELECT i, grades[i];

> Positional vars and array indexes are inconsistent in SQL++
> -----------------------------------------------------------
>
>                 Key: ASTERIXDB-2595
>                 URL: https://issues.apache.org/jira/browse/ASTERIXDB-2595
>             Project: Apache AsterixDB
>          Issue Type: Bug
>          Components: *DB - AsterixDB, SQL - Translator SQL++
>    Affects Versions: 0.9.4.1
>            Reporter: Michael J. Carey
>            Assignee: Dmitry Lychagin
>            Priority: Major
>             Fix For: 0.9.5
>
>
> Positional variables in SQL++ seem to start at 1 -- while array indexes start at 0 -- this is pretty annoying in a use case like:
> CREATE FUNCTION grade(score)  {
> LET stdcutoffs = [96.5, 93.5, 90.0, 86.5, 83.5, 80.0, 76.5, 73.5, 70.0, 66.5, 63.5, 60.0, 0.0],
>             grades  = [“A+“, “A”, “A-“, “B+“, “B”, “B-“, “C+“, “C”, “C-“, “D+“, “D”, “D-“, “F”]
> FROM grades AS g AT i
> WHERE score >= stdcutoffs[i-1]
> SELECT VALUE g
> ORDER BY i ASC
> LIMIT 1
> };



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)