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

Xikui Wang resolved ASTERIXDB-2394.
-----------------------------------
    Resolution: Fixed

> Variable substitution exception in SQLPP function
> -------------------------------------------------
>
>                 Key: ASTERIXDB-2394
>                 URL: https://issues.apache.org/jira/browse/ASTERIXDB-2394
>             Project: Apache AsterixDB
>          Issue Type: Bug
>    Affects Versions: 0.9.4
>            Reporter: Xikui Wang
>            Assignee: Xikui Wang
>            Priority: Major
>
> Given query cannot be executed as in a function body, but can be executed as 
> a plain query. There is some issue with the variable counter in the language 
> rewriting process which causes different variables has the same varId. This 
> further causes mappings are overwritten in the variable substitution phase.
> {code}
> use Starbucks;
> create function StarbucksFriends(user_id){
> (
>     select * from Starbucks sb, (select * from Tweets tw
>     let dumb = (select * from Tweets f where f.user.id_str in (select value 
> fw.followers from Followers fw where fw.twitter_id= user_id ))
>     where tw.user.id_str = user_id) t
>     order by spatial_distance(sb.location,create_point(0,0)) limit 1
> )
> };
> use Starbucks;
> StarbucksFriends("123");
> use Starbucks;
> select * from Starbucks sb, (select * from Tweets tw
>     let dumb = (select * from Tweets f where f.user.id_str in (select value 
> fw.followers from Followers fw where fw.twitter_id= "123" ))
>     where tw.user.id_str = "123") t
>     order by spatial_distance(sb.location,create_point(0,0)) limit 1;
> {code}



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

Reply via email to