You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@asterixdb.apache.org by "Xikui Wang (JIRA)" <ji...@apache.org> on 2018/05/31 00:48:00 UTC

[jira] [Created] (ASTERIXDB-2394) Variable substitution exception in SQLPP function

Xikui Wang created ASTERIXDB-2394:
-------------------------------------

             Summary: Variable substitution exception in SQLPP function
                 Key: ASTERIXDB-2394
                 URL: https://issues.apache.org/jira/browse/ASTERIXDB-2394
             Project: Apache AsterixDB
          Issue Type: Bug
            Reporter: Xikui Wang
            Assignee: Xikui Wang


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)