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:49:00 UTC

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

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

Xikui Wang updated ASTERIXDB-2394:
----------------------------------
    Description: 
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}

  was:
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]


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