first() and last() methods do not accept non-null default

Bug #1543873 reported by Stan Lagun
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
YAQL
Fix Released
Undecided
Stan Lagun

Bug Description

[].first(null) returns null because single optional method parameter means default value
however [].first(123) will result in exception
The same goes for last() method

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to yaql (stable/liberty)

Fix proposed to branch: stable/liberty
Review: https://review.openstack.org/278175

Revision history for this message
Stan Lagun (slagun) wrote :
Changed in yaql:
assignee: nobody → Stan Lagun (slagun)
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to yaql (master)

Reviewed: https://review.openstack.org/278173
Committed: https://git.openstack.org/cgit/openstack/yaql/commit/?id=4f72e08888f73981b04f6558ab086fb25fadaa8d
Submitter: Jenkins
Branch: master

commit 4f72e08888f73981b04f6558ab086fb25fadaa8d
Author: Stan Lagun <email address hidden>
Date: Wed Feb 10 04:03:36 2016 +0300

    Wrong parameter default for first()/last() was fixed

    queries module had its own NO_VALUE constant
    that was used for specification of default value for
    first() and last() method arguments.

    Because yaql runtime doesn't know anything about this
    value it assumed that the parameter must be of its default
    value type (type(DEFAULT_VALUE)) or null. Because NO_VALUE
    is not accessible from YAQL expressions the only possible
    default was null value. Or other parameter values caused
    an exception.

    Change-Id: I9518611fa02ec6eb5f43014182750c4c1ddff072
    Closes-Bug: #1543873

Changed in yaql:
status: In Progress → Fix Released
tags: added: in-stable-liberty
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to yaql (stable/liberty)

Reviewed: https://review.openstack.org/278175
Committed: https://git.openstack.org/cgit/openstack/yaql/commit/?id=2917427d2950dedcf961f49464abc138e35a4a8f
Submitter: Jenkins
Branch: stable/liberty

commit 2917427d2950dedcf961f49464abc138e35a4a8f
Author: Stan Lagun <email address hidden>
Date: Wed Feb 10 04:03:36 2016 +0300

    Wrong parameter default for first()/last() was fixed

    queries module had its own NO_VALUE constant
    that was used for specification of default value for
    first() and last() method arguments.

    Because yaql runtime doesn't know anything about this
    value it assumed that the parameter must be of its default
    value type (type(DEFAULT_VALUE)) or null. Because NO_VALUE
    is not accessible from YAQL expressions the only possible
    default was null value. Or other parameter values caused
    an exception.

    Change-Id: I9518611fa02ec6eb5f43014182750c4c1ddff072
    Closes-Bug: #1543873

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.