[ 
https://issues.apache.org/jira/browse/ASTERIXDB-2595?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Michael J. Carey updated ASTERIXDB-2595:
----------------------------------------
    Description: 
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
};}}

  was:
Positional variables in SQL++ seem to start at 1 -- while array indexes start 
at 0 -- this is pretty annoying in a use case like:

{quote}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
};{quote}


> 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)

Reply via email to